/* checkout.css — Dawn Checkout (single-column, Shopify-inspired) */
/* Cart styles are in cart.css — this file handles checkout only */

/* ─── Checkout: Layout (single column, centered) ─── */
.vl-checkout-layout {
  width: 100% !important; max-width: none !important; margin: 0 auto;
  padding-top: 0; padding-bottom: 60px;
  display: block !important; grid-template-columns: none !important;
  box-sizing: border-box;
}
.vl-commerce-hero {
  width: 100%;
  padding: clamp(44px, 7vw, 80px) 0 clamp(28px, 5vw, 52px);
  text-align: center;
}
.vl-commerce-hero__eyebrow {
  margin: 0;
  color: var(--accent-action);
  font-family: var(--font-h);
  font-size: var(--fs-badge);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.vl-commerce-hero__title {
  margin: .55rem 0 .6rem;
  color: var(--ink);
  font-family: var(--font-h);
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: .98;
  text-transform: uppercase;
}
.vl-commerce-hero__copy {
  max-width: 560px;
  margin: 0 auto;
  color: var(--text-muted);
  line-height: 1.6;
}
.vl-checkout-summary {
  background: var(--card); border-radius: 8px; padding: 24px;
  height: fit-content; position: static;
}

/* ─── Section cards ─── */
.vl-checkout-section {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 24px; margin-bottom: 16px;
}
.vl-checkout-section h3 {
  font-family: var(--font-h); font-size: var(--fs-h4); font-weight: 700;
  color: var(--ink); margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}

/* ─── Form fields ─── */
.vl-form-row { margin-bottom: 16px; }
.vl-form-row label {
  display: block; font-size: var(--fs-small); font-weight: 500;
  color: var(--text); margin-bottom: 6px;
}
.vl-form-row .required { color: var(--accent-action); }
.vl-input,
.vl-checkout-layout input:not([type="radio"]):not([type="checkbox"]),
.vl-checkout-layout select,
.vl-checkout-layout textarea {
  width: 100%; padding: 12px 14px;
  min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-family: var(--font-b); font-size: var(--fs-body); color: var(--ink);
  background: var(--card); transition: border-color 0.15s, box-shadow 0.15s;
}
.vl-input:focus,
.vl-checkout-layout input:focus,
.vl-checkout-layout select:focus,
.vl-checkout-layout textarea:focus {
  outline: none; border-color: var(--accent-action);
  box-shadow: 0 0 0 2px rgba(201,54,61,0.12);
}
.vl-form-helper { display: block; margin-top: 4px; font-size: var(--fs-small); color: var(--text-muted); }
.vl-checkout-layout textarea { resize: vertical; min-height: 80px; }

/* Configurable WooCommerce fields */
.vl-checkout-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px;
}
.vl-checkout-fields .form-row { grid-column: 1 / -1; margin: 0 0 16px; }
.vl-checkout-fields .vl-field-half { grid-column: span 1; }
.vl-checkout-fields .woocommerce-input-wrapper { display: block; width: 100%; }
.vl-checkout-fields .description {
  display: block; margin-top: 4px; font-size: var(--fs-small); color: var(--text-muted);
}
.vl-checkout-fields .optional { color: var(--text-muted); font-weight: 400; }

/* Country-aware phone input */
.vl-checkout-fields .iti { width: 100%; }
.vl-checkout-fields .iti input { width: 100%; }
.vl-checkout-fields .iti__selected-country { min-height: 44px; }
.vl-input--invalid { border-color: var(--accent-action) !important; box-shadow: 0 0 0 1px rgba(201,54,61,0.2) !important; }

/* Error state */
.vl-form-row--error .vl-input,
.vl-form-row--error input { border-color: var(--accent-action); box-shadow: 0 0 0 1px rgba(201,54,61,0.2); }
.vl-form-error { font-size: var(--fs-small); color: var(--accent-action); margin-top: 4px; font-weight: 500; }

/* Error summary banner */
.vl-error-summary {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px;
  padding: 14px 18px; margin-bottom: 24px; font-size: var(--fs-small);
  color: var(--accent-action);
}
.vl-error-summary strong {
  display: block; margin-bottom: 6px; font-family: var(--font-h);
  font-size: var(--fs-body);
}
.vl-error-summary ul { list-style: none; padding-left: 0; }
.vl-error-summary li { padding: 2px 0; }
.vl-error-summary li::before { content: '• '; }

/* Half-width row (e.g., first name + last name) */
.vl-form-row--half { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── Order summary accordion ─── */
.vl-order-summary {
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); overflow: hidden; margin-bottom: 24px;
}
.vl-summary-toggle {
  display: flex; justify-content: space-between; align-items: center;
  min-height: 58px; padding: 14px 20px; font-size: var(--fs-body); font-weight: 500;
  color: var(--ink); cursor: pointer; border: none;
  background: var(--card); width: 100%; text-align: left;
  font-family: var(--font-b);
}
.vl-summary-toggle__price { font-family: var(--font-h); font-weight: 700; }
.vl-summary-body {
  padding: 0 20px 16px; border-top: 1px solid var(--border);
  display: block;
}
.vl-order-summary.vl-checkout-js .vl-summary-body { display: none; }
.vl-order-summary.vl-checkout-js.vl-order-summary--open .vl-summary-body { display: block; }
.vl-summary-toggle__price::after { content: ' ▾'; color: var(--text-muted); }
.vl-order-summary--open .vl-summary-toggle__price::after { content: ' ▴'; }
.vl-summary-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
}
.vl-summary-item + .vl-summary-item { border-top: 1px solid var(--border); }
.vl-summary-item__img {
  width: 48px; height: 48px; background: var(--border); border-radius: var(--r-md);
  flex-shrink: 0; position: relative;
}
.vl-summary-item__img img {
  width: 100%; height: 100%; object-fit: contain; border: 1px solid var(--border);
  border-radius: var(--r-md); background: #fff;
}
.vl-summary-item__qty {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  background: var(--ink); color: #fff; border-radius: 50%;
  font-size: 10px; font-weight: 700; display: flex;
  align-items: center; justify-content: center; line-height: 1;
}
.vl-summary-item__content { min-width: 0; flex: 1; }
.vl-summary-item__name { display: block; font-size: var(--fs-small); color: var(--ink); }
.vl-summary-item__content dl.variation {
  margin: 4px 0 0; color: var(--accent-action); font-size: var(--fs-badge); line-height: 1.45;
}
.vl-summary-item__content dl.variation dt,
.vl-summary-item__content dl.variation dd { display: inline; float: none; margin: 0; }
.vl-summary-item__content dl.variation dt::after { content: ': '; }
.vl-summary-item__content dl.variation dd::after { content: ' '; }
.vl-summary-item__content dl.variation p { display: inline; margin: 0; }
.vl-summary-item__price {
  font-family: var(--font-h); font-size: var(--fs-small); font-weight: 600;
  color: var(--ink);
}
.vl-summary-divider { height: 1px; background: var(--border); margin: 8px 0; }
.vl-summary-total-row {
  display: flex; justify-content: space-between; padding: 5px 0;
  font-size: var(--fs-small); color: var(--text);
}
.vl-summary-total-row--discount { color: var(--success-text); }
.vl-summary-total-row--final {
  font-family: var(--font-h); font-weight: 700; font-size: var(--fs-body);
  color: var(--ink); margin-top: 2px; padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── COD payment pill ─── */
.wc_payment_methods {
  list-style: none; padding: 0; margin: 0;
}
.vl-checkout-payment-section { margin-top: 0; }
.wc_payment_method.payment_method_cod {
  border: 2px solid var(--accent-action); border-radius: 8px;
  padding: 14px 20px; background: color-mix(in srgb, var(--accent-action) 7%, var(--card));
}
.wc_payment_method.payment_method_cod label {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-body); font-weight: 700; color: var(--ink);
}
.wc_payment_method.payment_method_cod label::before {
  content: ''; width: 12px; height: 12px; flex: 0 0 12px; border-radius: 50%;
  border: 3px solid #fff; background: var(--accent-action); box-shadow: 0 0 0 1px var(--accent-action);
}

.woocommerce form .form-row label.woocommerce-form__label-for-checkbox,
.woocommerce-form__label-for-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px 0;
  margin: 0;
  cursor: pointer;
  font-weight: 500;
}
.woocommerce-form__label-for-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 18px;
  appearance: auto;
  -webkit-appearance: checkbox;
}
.woocommerce-form__label-for-checkbox .woocommerce-terms-and-conditions-checkbox-text {
  flex: 1;
}

/* ─── Place order CTA ─── */
#place_order,
.woocommerce-checkout .button.alt {
  display: block; width: 100%; padding: 14px 28px;
  background: var(--accent-action); color: var(--card);
  border: none; border-radius: var(--r-btn);
  font-family: var(--font-h); font-size: var(--fs-btn); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  cursor: pointer; text-align: center; margin-top: 20px;
  transition: background 0.15s; min-height: 44px;
}
.woocommerce-checkout-payment > .place-order {
  margin: 0; padding: 0; background: transparent;
}
.woocommerce-checkout-payment .woocommerce-privacy-policy-text {
  margin: 0 0 12px; color: var(--text-muted); font-size: var(--fs-small); line-height: 1.55;
}
.woocommerce-checkout-payment .woocommerce-terms-and-conditions-wrapper { margin-top: 22px; }
/* Inline terms box that slide-toggles open — give it a card so it stands out */
.woocommerce-terms-and-conditions {
  margin: 12px 0 4px;
  padding: 16px 18px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface-warm, #f7f4f0);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 3%, transparent), 0 6px 20px rgba(0,0,0,.06);
  color: var(--text);
  font-size: var(--fs-small);
  line-height: 1.6;
}
.woocommerce-terms-and-conditions h1,
.woocommerce-terms-and-conditions h2,
.woocommerce-terms-and-conditions h3 {
  margin: 14px 0 6px; color: var(--ink); font-family: var(--font-h); font-size: var(--fs-body); font-weight: 700;
}
.woocommerce-terms-and-conditions h1:first-child,
.woocommerce-terms-and-conditions h2:first-child,
.woocommerce-terms-and-conditions h3:first-child { margin-top: 0; }
.woocommerce-terms-and-conditions p { margin: 0 0 8px; }
.vl-place-order__total {
  font-family: var(--font-h);
  font-weight: 800;
}
.woocommerce-checkout .vl-secure-badge {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 16px; font-size: var(--fs-small); color: var(--text-muted);
}
#place_order:hover,
.woocommerce-checkout .button.alt:hover { background: var(--accent-hover); }

/* ─── WC Notices ─── */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
  font-family: var(--font-b); font-size: var(--fs-small);
  padding: 0.75rem 1rem; border-radius: 8px;
  border: 1px solid transparent; margin-bottom: 1.25rem;
  list-style: none; display: flex; align-items: center; gap: 0.5rem;
  flex-wrap: wrap; background: none;
}
.woocommerce-message { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.woocommerce-error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.woocommerce-info { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }

/* ─── Order review table (used inside accordion) ─── */
.woocommerce-checkout-review-order-table {
  width: 100%; border-collapse: collapse; font-size: var(--fs-small);
}
.woocommerce-checkout-review-order-table thead { display: none; }
.woocommerce-checkout-review-order-table td {
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.woocommerce-checkout-review-order-table tbody tr {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
}
.woocommerce-checkout-review-order-table tbody .product-name { min-width: 0; }
.woocommerce-checkout-review-order-table .product-name { font-weight: 500; color: var(--text); }
.woocommerce-checkout-review-order-table .product-total {
  text-align: right; font-weight: 600; color: var(--ink);
}
.woocommerce-checkout-review-order-table .cart_item:last-child td { border-bottom: none; }
.woocommerce-checkout-review-order-table tfoot th {
  padding: 5px 0; font-size: var(--fs-small); font-weight: 400; color: var(--text);
  text-align: left;
}
.woocommerce-checkout-review-order-table tfoot td {
  padding: 5px 0; text-align: right; font-size: var(--fs-small);
}
.woocommerce-checkout-review-order-table .woocommerce-shipping-totals th {
  font-size: 0;
}
.woocommerce-checkout-review-order-table .woocommerce-shipping-totals th::after {
  content: 'Livraison'; font-size: var(--fs-small);
}
.woocommerce-checkout-review-order-table .woocommerce-shipping-methods {
  margin: 0; padding: 0; list-style: none;
}
.woocommerce-checkout .woocommerce-checkout-review-order-table .order-total th,
.woocommerce-checkout .woocommerce-checkout-review-order-table .order-total td {
  font-family: var(--font-h); font-weight: 800; font-size: var(--fs-h2);
  color: var(--ink); padding-top: 12px; border-top: 1px solid var(--border);
}

/* ─── WC Blocks checkout button (if blocks are ever activated) ─── */
.wc-block-components-checkout-place-order-button {
  background: var(--accent-action); color: #fff;
  border: none; border-radius: var(--r-btn);
  font-family: var(--font-h); font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; min-height: 44px;
}
.wc-block-components-checkout-place-order-button:hover { background: var(--accent-hover); }

/* ─── Loading state ─── */
.vl-btn--loading {
  position: relative; color: transparent !important; pointer-events: none;
}
.vl-btn--loading::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: vl-spin 0.6s linear infinite;
}
@keyframes vl-spin { to { transform: rotate(360deg); } }

/* ─── Mobile (≤480px) ─── */
@media (max-width: 480px) {
  .vl-checkout-layout { padding-bottom: 40px; }
  .vl-commerce-hero { padding-top: 36px; padding-bottom: 24px; }
  .vl-form-row--half { grid-template-columns: 1fr; }
  .vl-checkout-fields { grid-template-columns: 1fr; }
  .vl-checkout-fields .vl-field-half { grid-column: 1 / -1; }
  .vl-input,
  .vl-checkout-layout input,
  .vl-checkout-layout select,
  .vl-checkout-layout textarea { font-size: 1rem; } /* prevent iOS zoom */
  .vl-checkout-section { padding: 16px; }
  .vl-summary-toggle { gap: 10px; padding-inline: 16px; }
  .vl-summary-toggle__price { flex: 0 0 auto; white-space: nowrap; }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table {
    display: block; width: 100%;
  }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tbody {
    display: block; width: 100%;
  }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tfoot {
    display: table; width: 100%; table-layout: fixed;
  }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tbody tr { display: block; }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tbody td.product-name {
    display: block; width: 100%; padding-bottom: 0; border-bottom: 0;
  }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tbody td.product-total {
    display: block; width: 100%; padding: 0 0 10px 60px; text-align: left;
  }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tfoot th,
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tfoot td {
    width: auto; padding-right: 2px;
  }
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tr.order-total th,
  body.woocommerce-checkout table.woocommerce-checkout-review-order-table tr.order-total td {
    font-size: 1.75rem !important;
  }
  body.woocommerce-checkout .vl-wa-float { display: none; }
}
