:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-2-5: 0.625rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --radius-1: 0.3125rem;
  --radius-2: 0.5rem;
  --radius-3: 0.75rem;
  --radius-4: 1.875rem;
  --radius-pill: 3.125rem;

  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;

  --afro-teal: #2F4F4F;
  --afro-blue: #0000A3;
  --afro-gold: #FFD700;
  --afro-gold-dark: #FFC107;
  --afro-orange: #fa4725;
  --afro-orange-soft: #f59473;
  --panel-white: rgba(255, 255, 255, 0.78);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Barlow', sans-serif;
  background: linear-gradient(45deg, #6AD2E1, #a4e0d3, #4F718B);
  background: linear-gradient(90deg, #7BD9BA 0%, #65C9C4 35%, #448FAF 70%, #264C79 100%);
  color: var(--afro-teal);
}

button {
  font-family: inherit;
}

.checkout-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-6);
  padding: var(--space-5);
  box-sizing: border-box;
}

/* LEFT SIDEBAR */

.checkout-sidebar {
  position: sticky;
  top: var(--space-5);
  align-self: start;
  min-height: calc(100vh - 2.5rem);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;

  padding: var(--space-5);
  border-radius: var(--radius-3);
  box-sizing: border-box;

  background: transparent;

  box-shadow: none;
}

.checkout-logo-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-bottom: var(--space-8);
}

.checkout-logo {
  width: min(85%, 180px);
  height: auto;
  animation: checkoutLogoIn 1.3s ease forwards;
}

@keyframes checkoutLogoIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.checkout-menu {
  width: 100%;
  text-align: center;
}

/* Navigation: styled links for pages, button for the products toggle. */
.checkout-menu > a,
.checkout-menu > button,
.checkout-products a {
  display: block;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius-2);
  text-decoration: none;
  text-align: center;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #0B0B45;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Main-menu controls: red, raised 3D appearance. */
.checkout-menu > a,
.checkout-menu > button {
  background: linear-gradient(180deg, #ff795b 0%, #fa4725 55%, #d93617 100%);
  box-shadow: 0 5px 0 #a92c12, 0 8px 14px rgba(0,0,0,0.25),
    inset 0 2px 2px rgba(255,255,255,0.35);
}

.checkout-menu > a:hover,
.checkout-menu > button:hover {
  background: linear-gradient(180deg, #ffc0a8 0%, #f59473 55%, #dc7352 100%);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #a92c12, 0 12px 18px rgba(0,0,0,0.3),
    inset 0 2px 2px rgba(255,255,255,0.35);
}

.checkout-menu > a.selected,
.checkout-menu > a.selected:hover,
.checkout-menu > button.selected,
.checkout-menu > button.selected:hover {
  background: linear-gradient(180deg, #ffd0c5 0%, #f0a696 55%, #cd8173 100%);
}

.checkout-menu > a:active,
.checkout-menu > button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #a92c12, 0 3px 6px rgba(0,0,0,0.2);
}


.checkout-products {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: 0;
  border-top: none;
}

.checkout-products.hidden {
  display: none;
}

/* Individual product links: golden-orange 3D buttons. */
.checkout-products a {
  background: linear-gradient(180deg, #ffca57 0%, #ffa500 55%, #db8300 100%);
  overflow-wrap: break-word;
  white-space: normal;
  box-shadow: 0 5px 0 #a86600, 0 8px 14px rgba(0,0,0,0.25),
    inset 0 2px 2px rgba(255,255,255,0.35);
}

.checkout-products a:hover {
  background: linear-gradient(180deg, #ffe9a0 0%, #ffd147 55%, #e6ad2f 100%);
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #a86600, 0 12px 18px rgba(0,0,0,0.3),
    inset 0 2px 2px rgba(255,255,255,0.35);
}

.checkout-products a.selected,
.checkout-products a.selected:hover {
  background: linear-gradient(180deg, #ffffa3 0%, #ffff00 55%, #d4c900 100%);
}

.checkout-products a:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #a86600, 0 3px 6px rgba(0,0,0,0.2);
}

/* Shimmer only for navigation; basket action buttons stay independent. */
.checkout-menu > a::before,
.checkout-menu > button::before,
.checkout-products a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, rgba(255,225,225,0) 0%,
    rgba(255,225,225,0.5) 50%, rgba(255,225,225,0) 100%);
  transform: skewX(-20deg);
  pointer-events: none;
}

.checkout-menu > a:hover::before,
.checkout-menu > button:hover::before,
.checkout-products a:hover::before {
  animation: shimmer 0.7s ease-in-out 3 alternate;
}

@keyframes shimmer {
  0% { left: -75%; }
  100% { left: 125%; }
}

.close-checkout-products {
  align-self: flex-end;
  width: auto;
  padding: 0;
  margin: 0 0 var(--space-2-5)0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #333;
  font-size:
    calc(
      var(--text-xl) +
      var(--space-2)
    );
  font-weight: normal;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease,
    color 0.2s ease;
}

.close-checkout-products:hover {
  background: transparent;
  color: #000;
  transform: scale(1.2);
  box-shadow: none;
}

/* When product menu is open, hide main menu controls */
.checkout-menu.products-open > a,
.checkout-menu.products-open > .toggle-products {
  display: none;
}

/* MAIN AREA */

.checkout-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-6);
  align-items: start;
}

.basket-panel,
.order-summary {
  background: var(--panel-white);
  border-radius: var(--radius-3);
  box-shadow: 0 8px 22px rgba(0,0,0,0.12);
  backdrop-filter: blur(6px);
}

.basket-panel {
  padding: var(--space-6);
}

.checkout-heading-row {
  margin-bottom: var(--space-6);
}

.checkout-heading-row h1,
.order-summary h2 {
  margin: 0;
  color: var(--afro-blue);
  font-family: 'Lexend Peta', sans-serif;
  letter-spacing: 0.02em;
}

.checkout-heading-row h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.checkout-heading-row p {
  margin: var(--space-2) 0 0;
  font-size: var(--text-lg);
}

.basket-table-heading {
  display: grid;
  grid-template-columns: 1fr 110px 100px 44px;
  gap: var(--space-4);

  padding: 0 0 var(--space-3);
  border-bottom: 2px solid rgba(0,0,163,0.16);

  color: var(--afro-blue);
  font-weight: 700;
}

.basket-items {
  display: flex;
  flex-direction: column;
}

.basket-item {
  display: grid;
  grid-template-columns: 1fr 110px 100px 44px;
  gap: var(--space-4);
  align-items: center;

  padding: var(--space-5) 0;
  border-bottom: 1px solid rgba(47,79,79,0.18);
}

.line-total {
  margin-left: 12px;
}

.product-cell {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--space-4);
  align-items: center;
}

.product-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;

  border-radius: var(--radius-3);
  background: #fff;
  padding: var(--space-1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.product-info h3 {
  margin: 0 0 var(--space-1);
  color: var(--afro-teal);
  font-size: var(--text-lg);
}

.product-size {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  opacity: 0.85;
}

.product-price {
  display: block;
  margin-top: var(--space-1);
  font-weight: 700;
  color: #000;
}

.quantity-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);

  width: max-content;
  padding: var(--space-1);
  border: 2px solid rgba(0,0,163,0.25);
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.75);
}

.quantity-control button {
  width: 2rem;
  height: 2rem;

  border: none;
  border-radius: 50%;
  cursor: pointer;

  background: var(--afro-gold);
  color: #000;
  font-weight: 800;
}

.quantity-control button:hover {
  background: var(--afro-gold-dark);
}

.quantity-input {
  width: 2.4rem;
  border: none;
  background: transparent;
  text-align: center;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--afro-teal);
}

.quantity-input:focus {
  outline: 2px solid var(--afro-blue);
  border-radius: var(--radius-1);
}

.line-total {
  font-weight: 800;
  color: #000;
}

.delete-item {
  width: 2.4rem;
  height: 2.4rem;

  border: none;
  border-radius: 50%;
  cursor: pointer;

  background: rgba(250,71,37,0.12);
  color: var(--afro-orange);
  font-size: 1.15rem;

  transition: transform 0.2s ease, background-color 0.2s ease;
}

.delete-item:hover {
  background: rgba(250,71,37,0.22);
  transform: scale(1.08);
}

.empty-basket {
  padding: var(--space-6) 0;
  font-size: var(--text-lg);
}

/* ORDER SUMMARY */

.order-summary {
  position: sticky;
  top: var(--space-5);
  padding: var(--space-5);
}

.order-summary h2 {
  font-size: 1.5rem;
  margin-bottom: var(--space-5);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);

  margin-bottom: var(--space-4);
  font-size: var(--text-base);
}

.summary-line span {
  color: var(--afro-teal);
  font-weight: 600;
}

.summary-line strong {
  color: #000;
}

.summary-divider {
  height: 1px;
  margin: var(--space-5) 0;
  background: rgba(47,79,79,0.25);
}

.summary-total {
  font-size: var(--text-lg);
}

.checkout-button {
  position: relative;
  overflow: hidden;

  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);

  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;

  background: var(--afro-gold);
  color: #000;
  font-weight: 900;
  letter-spacing: 0.06em;

  box-shadow: 0 6px 14px rgba(0,0,0,0.18);
  transition: transform 0.2s ease, background-color 0.3s ease;
}

.checkout-button:hover {
  background: var(--afro-gold-dark);
  transform: scale(1.03);
}

.checkout-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;

  background: linear-gradient(
    120deg,
    rgba(255, 225, 225, 0) 0%,
    rgba(255, 225, 225, 0.5) 50%,
    rgba(255, 225, 225, 0) 100%
  );

  transform: skewX(-20deg);
  pointer-events: none;
}

.checkout-button:hover::before {
  animation: shimmer 0.7s ease-in-out 2 alternate;
}

.summary-note {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  opacity: 0.85;
  white-space: pre-line;
}

/* MOBILE */

@media (max-width: 900px) {
  .checkout-page {
    grid-template-columns: 1fr;
  }

  .checkout-sidebar {
    position: static;
    min-height: auto;
  }

  .checkout-logo {
    width: min(55%, 150px);
  }

  .checkout-content {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }
}

@media (max-width: 650px) {
  .checkout-page {
    padding: var(--space-3);
    gap: var(--space-3);
  }

  .basket-panel,
  .order-summary {
    padding: var(--space-4);
  }

  .basket-table-heading {
    display: none;
  }

  .basket-item {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding: var(--space-5) 0;
  }

  .product-cell {
    grid-template-columns: 76px 1fr;
  }

  .product-thumb {
    width: 76px;
    height: 76px;
  }

  .quantity-control {
    justify-self: start;
  }

  .line-total {
    font-size: var(--text-lg);
  }

  .delete-item {
    justify-self: start;
  }

  .checkout-menu {
    max-width: 320px;
  }
}


/* SHIPPING OPTIONS */

.delivery-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-5) 0;
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-3);
}

.delivery-options label {
  margin-top: var(--space-2);
  font-weight: 700;
}

.delivery-address {
  display: grid;
  gap: var(--space-2);
}


.delivery-address input {
  min-width: 0;
  box-sizing: border-box;
}

.delivery-address input,
.delivery-options select {
  width: 100%;
  padding: var(--space-3);
  font: inherit;
  color: var(--afro-teal);
  background: white;
  border: 1px solid rgba(47, 79, 79, 0.3);
  border-radius: var(--radius-2);
}


.checkout-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Delivery information beside the delivery estimate. */
.summary-delivery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-4);
}

.delivery-times-link {
  grid-column: 1 / -1;
  width: fit-content;
  color: var(--afro-blue);
  font-size: var(--text-base);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: var(--space-1);
}

.delivery-times-link:hover,
.delivery-times-link:focus-visible {
  color: var(--afro-teal);
}