@import url("common.css");

html {
  height: 100%;
}

body {
  position: relative;
}

#content {
  padding-top: 6em;
  box-sizing: border-box;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#content > .checkout-wrapper {
  flex: 1 0 auto;
}

#content > .footer {
  flex-shrink: 0;
}

/* === WRAPPER === */
.checkout-wrapper {
  max-width: 1200px;
  margin: 2em auto 4em;
  padding: 0 1.5em;
  box-sizing: border-box;
}

.checkout-head {
  text-align: center;
  margin-bottom: 2em;
  position: relative;
}

.checkout-back {
  position: absolute;
  left: 0;
  top: 0.4em;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.55em 0.9em;
  border-radius: 999px;
  border: 1px solid rgba(255, 186, 1, 0.28);
  background: rgba(24, 20, 14, 0.55);
  color: #ffd66e;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.checkout-back:hover {
  background: rgba(255, 186, 1, 0.12);
  color: #fff2c2;
  border-color: rgba(255, 186, 1, 0.5);
}

.checkout-back svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .checkout-back {
    position: static;
    display: inline-flex;
    margin-bottom: 1em;
  }
}

.checkout-head h1 {
  display: inline-block;
  margin: 0;
  padding-left: 0.7em;
  border-left: 3px solid #ffba01;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  line-height: 1.15;
}

.checkout-head p {
  margin: 0.7em 0 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.7);
}

/* === GRID === */
.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 2em;
  align-items: start;
}

.checkout-form-card,
.checkout-cart-card {
  padding: 2.4em 2.2em;
  box-sizing: border-box;
}

.checkout-section-title {
  margin: 0 0 1.4em 0;
  padding-left: 0.7em;
  border-left: 3px solid #ffba01;
  font-size: 1.05rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
}

/* === FORM === */
.checkout-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em 1.1em;
}

.checkout-form label:not(.form-consent label) {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  min-width: 0;
}

.checkout-form-full {
  grid-column: 1 / -1;
}

.checkout-form label > span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  padding-left: 0.15em;
}

.checkout-form input,
.checkout-form select,
.checkout-form textarea {
  width: 100%;
  padding: 0.8em 1em;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid rgba(255, 186, 1, 0.25);
  border-radius: 0.8em;
  background: rgba(24, 20, 14, 0.55);
  color: #fff;
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.25s ease, background 0.25s ease,
    box-shadow 0.25s ease;
}

.checkout-form textarea {
  resize: vertical;
  min-height: 3.2em;
  line-height: 1.45;
}

.checkout-form label > span small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.45);
  margin-left: 0.3em;
}

.checkout-form select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23ffba01' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1em center;
  padding-right: 2.6em;
  cursor: pointer;
}

.checkout-form select option {
  background: #1f1b15;
  color: #fff;
}

.checkout-form input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.checkout-form input:hover,
.checkout-form select:hover {
  border-color: rgba(255, 186, 1, 0.45);
}

.checkout-form input:focus,
.checkout-form select:focus,
.checkout-form textarea:focus {
  outline: none;
  border-color: #ffba01;
  background: rgba(24, 20, 14, 0.75);
  box-shadow: inset 0 0 0 1px #ffba01;
}

/* === PHONE INPUT GROUP === */
.phone-input-group {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.phone-country-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0 0.85em;
  border: 1px solid rgba(255, 186, 1, 0.25);
  border-right: none;
  border-radius: 0.8em 0 0 0.8em;
  background: rgba(24, 20, 14, 0.7);
  color: #fff;
  font-family: "Montserrat", sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.phone-country-btn:hover {
  border-color: rgba(255, 186, 1, 0.5);
  background: rgba(24, 20, 14, 0.85);
}

.phone-country-btn[aria-expanded="true"] {
  border-color: #ffba01;
}

.phone-country-flag {
  font-size: 1.05rem;
  line-height: 1;
}

.phone-country-dial {
  color: #ffd66e;
  font-weight: 700;
  font-size: 0.85rem;
}

.phone-country-caret {
  width: 12px;
  height: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.phone-input-group > input[type="tel"] {
  flex: 1;
  border-radius: 0 0.8em 0.8em 0;
}

.phone-country-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  max-height: 260px;
  min-width: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35em;
  list-style: none;
  border: 1px solid rgba(255, 186, 1, 0.35);
  border-radius: 0.8em;
  background: rgba(24, 20, 14, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.phone-country-list li {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55em 0.75em;
  border-radius: 0.55em;
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.18s ease;
}

.phone-country-list li:hover,
.phone-country-list li[aria-selected="true"] {
  background: rgba(255, 186, 1, 0.12);
}

.phone-country-list .phone-country-dial {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.55);
}

/* === POSTCODE SUGGESTIONS === */
.postcode-input-wrap {
  position: relative;
}

.postcode-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35em;
  list-style: none;
  border: 1px solid rgba(255, 186, 1, 0.35);
  border-radius: 0.8em;
  background: rgba(24, 20, 14, 0.98);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.postcode-suggestions li {
  display: flex;
  flex-direction: column;
  gap: 0.15em;
  padding: 0.55em 0.75em;
  border-radius: 0.55em;
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.18s ease;
}

.postcode-suggestions li:hover,
.postcode-suggestions li[aria-selected="true"] {
  background: rgba(255, 186, 1, 0.12);
}

.postcode-suggestions .postcode-suggestion-region {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

.postcode-suggestions .postcode-suggestion-loading,
.postcode-suggestions .postcode-suggestion-empty,
.postcode-suggestions .postcode-suggestion-hint {
  display: block;
  padding: 0.6em 0.75em;
  border-radius: 0.55em;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  cursor: default;
  background: transparent;
}

.postcode-suggestions .postcode-suggestion-loading {
  color: rgba(255, 186, 1, 0.85);
  position: relative;
  padding-left: 2em;
}

.postcode-suggestions .postcode-suggestion-loading::before {
  content: "";
  position: absolute;
  left: 0.75em;
  top: 50%;
  width: 0.85em;
  height: 0.85em;
  margin-top: -0.45em;
  border-radius: 50%;
  border: 2px solid rgba(255, 186, 1, 0.25);
  border-top-color: rgba(255, 186, 1, 0.95);
  animation: postcode-spin 0.7s linear infinite;
}

.postcode-suggestions .postcode-suggestion-empty {
  color: rgba(255, 180, 180, 0.75);
}

.postcode-suggestions .postcode-fuzzy {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0.05em 0.45em;
  border-radius: 999px;
  background: rgba(255, 186, 1, 0.15);
  color: rgba(255, 186, 1, 0.85);
  font-style: normal;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* === COD LOCKED STATE (non-HR addresses) === */
.checkout-form select.is-cod-locked {
  border-color: rgba(255, 186, 1, 0.35);
}

.checkout-form select.is-cod-locked option[disabled] {
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
}

.checkout-form .cod-lock-note {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin-top: 0.5em;
  padding: 0.55em 0.8em;
  box-sizing: border-box;
  width: 100%;
  border-radius: 0.6em;
  border: 1px dashed rgba(255, 186, 1, 0.28);
  background: rgba(255, 186, 1, 0.05);
  color: rgba(255, 210, 130, 0.85);
  font-size: 0.78rem;
  line-height: 1.35;
}

.checkout-form .cod-lock-note svg {
  width: 0.95em;
  height: 0.95em;
  flex-shrink: 0;
  stroke: rgba(255, 210, 130, 0.85);
}

@keyframes postcode-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .postcode-suggestions .postcode-suggestion-loading::before {
    animation: none;
  }
}

/* === CONSENT === */
.checkout-form .form-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
  margin-top: 0.4em;
}

.checkout-form .form-consent label {
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  cursor: pointer;
}

.checkout-form .form-consent input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.05em;
  height: 1.05em;
  margin-top: 0.15em;
  accent-color: #ffba01;
  cursor: pointer;
}

.checkout-form .form-consent a {
  color: #ffba01;
  text-decoration: none;
  font-weight: 700;
}

.checkout-form .form-consent a:hover {
  text-decoration: underline;
}

/* === SUBMIT BUTTON === */
.checkout-submit {
  margin-top: 0.6em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 1em 1.4em;
  border-radius: 0.9em;
  border: 1px solid rgba(255, 186, 1, 0.55);
  background: linear-gradient(
      180deg,
      rgba(255, 186, 1, 0.28) 0%,
      rgba(255, 186, 1, 0.1) 100%
    ),
    rgba(24, 20, 14, 0.55);
  color: #fff;
  font-family: "Montserrat", sans-serif;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 186, 1, 0.35);
  transition: background 0.25s ease, border-color 0.25s ease,
    transform 0.25s ease, box-shadow 0.25s ease;
}

.checkout-submit:hover {
  border-color: #ffba01;
  background: linear-gradient(
      180deg,
      rgba(255, 186, 1, 0.4) 0%,
      rgba(255, 186, 1, 0.16) 100%
    ),
    rgba(24, 20, 14, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(255, 186, 1, 0.28),
    inset 0 1px 0 rgba(255, 186, 1, 0.45);
}

/* === CART CARD === */
.checkout-cart-card {
  position: sticky;
  top: 7em;
  display: flex;
  flex-direction: column;
}

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  max-height: 22em;
  overflow-y: auto;
  padding-right: 0.4em;
  margin-bottom: 0.4em;
}

.cart-items::-webkit-scrollbar {
  width: 8px;
}

.cart-items::-webkit-scrollbar-track {
  background: rgba(24, 20, 14, 0.4);
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: rgba(255, 186, 1, 0.4);
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
  background: #ffba01;
}

.cart-item {
  padding: 0.9em 1em;
  border-radius: 0.8em;
  border: 1px solid rgba(255, 186, 1, 0.18);
  background: rgba(24, 20, 14, 0.5);
}

.cart-item-layout {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  padding: 0;
  margin: 0;
  border: none;
}

.cart-layout1 strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4em;
  word-break: break-word;
}

.cart-item-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  width: 100%;
}

.cart-qty-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2em;
  height: 2em;
  padding: 0 0.6em;
  border-radius: 999px;
  border: 1px solid rgba(255, 186, 1, 0.3);
  background: rgba(255, 186, 1, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffba01;
}

.cart-item-total strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffba01;
}

.cart-layout2 {
  display: none;
}

.empty-cart-msg {
  margin: 0;
  padding: 1.4em;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  border-radius: 0.8em;
  background: rgba(24, 20, 14, 0.35);
  border: 1px dashed rgba(255, 186, 1, 0.2);
}

/* === CART SUMMARY === */
.cart-summary {
  margin-top: 1em;
  padding-top: 1em;
  border-top: 1px solid rgba(255, 186, 1, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.cart-total-nopdv,
.cart-total-pdv,
.cart-total-shipping,
.cart-total-cod {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
}

.cart-total-nopdv span:first-child,
.cart-total-pdv span:first-child,
.cart-total-shipping span:first-child,
.cart-total-cod span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.6em;
  padding-top: 0.9em;
  border-top: 1px dashed rgba(255, 186, 1, 0.22);
  font-size: 1.05rem;
  font-weight: 800;
}

.cart-total span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  font-size: 0.85rem;
}

.cart-total span:last-child {
  color: #ffba01;
  font-size: 1.2rem;
}

/* === RESPONSIVE === */
@media (max-width: 960px) {
  .checkout-grid {
    grid-template-columns: 1fr;
  }

  .checkout-cart-card {
    position: static;
    order: -1;
  }

  .cart-items {
    max-height: 18em;
  }
}

/* === LOW STOCK BANNER === */
.low-stock-banner[hidden] { display: none; }
.low-stock-banner {
  display: flex;
  gap: 0.8em;
  align-items: flex-start;
  padding: 0.9em 1em;
  margin-bottom: 1em;
  border-radius: 14px;
  background: rgba(255, 196, 106, 0.08);
  border: 1px solid rgba(255, 196, 106, 0.32);
  color: #ffc46a;
}

.low-stock-banner svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin-top: 0.1em;
}

.low-stock-banner strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2em;
}

.low-stock-banner p {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
}

/* === COUPON BOX === */
.coupon-box {
  margin: 1.2em 0;
  padding: 0.9em 1em;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.coupon-box > label {
  display: block;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 0.5em;
}

.coupon-box small {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 400;
}

.coupon-row {
  display: flex;
  gap: 0.5em;
}

.coupon-row input {
  flex: 1;
  min-width: 0;
  padding: 0.7em 0.9em;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.coupon-row input:focus {
  outline: none;
  border-color: rgba(255, 186, 1, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 186, 1, 0.12);
}

.coupon-apply-btn {
  padding: 0.7em 1.2em;
  border-radius: 10px;
  border: 1px solid rgba(255, 186, 1, 0.42);
  background: rgba(255, 186, 1, 0.12);
  color: #ffc46a;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.coupon-apply-btn:hover:not(:disabled) {
  background: rgba(255, 186, 1, 0.22);
  border-color: rgba(255, 186, 1, 0.6);
}

.coupon-apply-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.coupon-feedback {
  margin: 0.6em 0 0;
  font-size: 0.85rem;
  line-height: 1.35;
}

.coupon-feedback.is-ok {
  color: #6bd98a;
}

.coupon-feedback.is-error {
  color: #ff8a8a;
}

/* === DISCOUNT ROW === */
.cart-total-discount {
  display: flex;
  justify-content: space-between;
  color: #6bd98a;
  font-weight: 500;
}

.cart-total-discount-code {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
  font-size: 0.85em;
  margin-left: 0.25em;
}

@media (max-width: 600px) {
  .checkout-wrapper {
    padding: 0 1em;
  }

  .checkout-form-card,
  .checkout-cart-card {
    padding: 1.6em 1.4em;
  }

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

  .checkout-head h1 {
    font-size: 1.25rem;
  }
}

@media (max-width: 430px) {
  .checkout-wrapper {
    padding: 0 0.7em;
  }

  .checkout-form-card,
  .checkout-cart-card {
    padding: 1.2em 1em;
  }

  .checkout-head h1 {
    font-size: 1.1rem;
    padding-left: 0.55em;
  }

  .checkout-head p {
    font-size: 0.85rem;
  }

  .checkout-section-title {
    font-size: 0.95rem;
  }

  .checkout-form input,
  .checkout-form select,
  .checkout-form textarea {
    padding: 0.7em 0.8em;
    font-size: 0.85rem;
  }

  .checkout-form select {
    padding-right: 2.2em;
    background-position: right 0.75em center;
  }

  .phone-country-btn {
    padding: 0 0.6em;
    gap: 0.3em;
    font-size: 0.82rem;
  }

  .phone-country-dial {
    font-size: 0.78rem;
  }

  .phone-country-flag {
    font-size: 0.95rem;
  }

  .phone-country-list {
    min-width: 0;
    width: 100%;
    max-width: calc(100vw - 2.4em);
  }

  .checkout-submit {
    padding: 0.9em 1em;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
  }

  .coupon-box {
    padding: 0.8em 0.9em;
  }

  .coupon-row {
    flex-direction: column;
    gap: 0.5em;
  }

  .coupon-apply-btn {
    width: 100%;
    padding: 0.7em 1em;
  }

  .cart-item {
    padding: 0.75em 0.85em;
  }

  .cart-item-details {
    gap: 0.6em;
  }

  .cart-layout1 strong {
    font-size: 0.82rem;
  }

  .cart-qty-control {
    font-size: 0.72rem;
    min-width: 1.8em;
    height: 1.8em;
    padding: 0 0.5em;
  }

  .cart-item-total strong {
    font-size: 0.88rem;
  }

  .cart-total span:last-child {
    font-size: 1.05rem;
  }

  .low-stock-banner {
    padding: 0.75em 0.85em;
    gap: 0.6em;
  }

  .low-stock-banner strong {
    font-size: 0.88rem;
  }

  .low-stock-banner p {
    font-size: 0.78rem;
  }

  .checkout-form .cod-lock-note {
    font-size: 0.72rem;
    padding: 0.5em 0.7em;
  }
}
