/**
 * Lapoteca — Checkout page styles
 *
 * Design system: Alexandria headings, Noto Sans body,
 * --clr-primary #C51E3A, --clr-beige #faf8f5, --clr-dark #111
 *
 * HTML structure (WooCommerce 9.x):
 *   form.checkout.woocommerce-checkout
 *     .col2-set#customer_details  → billing fields (left column)
 *     h3#order_review_heading     → right col heading
 *     #order_review               → right col box (table + payment)
 */

/* ── Reset & base ── */
html,
body.woocommerce-checkout {
    overflow-x: hidden;
}

.woocommerce-checkout {
    overflow: visible !important;
    height: auto !important;
    position: relative !important;
}

/* ── Checkout uses wider container ── */
body.woocommerce-checkout .static-page__body {
    max-width: 1200px;
    padding-bottom: 60px;
}

body.woocommerce-checkout .entry-content {
    width: 100% !important;
    max-width: 100% !important;
}

/* ── Page title ── */
body.woocommerce-checkout .static-page__title,
body.woocommerce-checkout .page .site-main h1 {
    font-family: 'Alexandria', sans-serif;
    font-size: 2.2rem;
    font-weight: 600;
    letter-spacing: .5px;
    text-align: center;
    margin-bottom: 40px;
    color: var(--clr-dark, #111);
}

/* ── Hide default coupon toggle ── */
body.woocommerce-checkout .woocommerce-form-coupon-toggle {
    display: none !important;
}

/* ══════════════════════════════════════════════════════
   DESKTOP LAYOUT: CSS Grid — 55% | gap | 40%
   ══════════════════════════════════════════════════════ */

@media (min-width: 769px) {
    form.checkout {
        position: static !important;
        display: grid;
        grid-template-columns: 1fr 420px;
        column-gap: 48px;
        align-items: start;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    body.woocommerce-checkout #customer_details {
        grid-column: 1;
        grid-row: 1 / span 2;
        box-sizing: border-box;
    }

    body.woocommerce-checkout #customer_details.col2-set .col-1,
    body.woocommerce-checkout #customer_details.col2-set .col-2 {
        width: 100% !important;
        float: none !important;
        max-width: 100% !important;
    }

    body.woocommerce-checkout #order_review_heading {
        grid-column: 2;
        border: none;
        padding: 0;
        box-sizing: border-box;
        margin-bottom: 16px !important;
    }

    body.woocommerce-checkout #order_review {
        grid-column: 2;
        position: sticky;
        top: 20px;
    }

    body.woocommerce-checkout #order_review #order_review_heading {
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-bottom: 16px !important;
    }
}

/* ══════════════════════════════════════════════════════
   HEADINGS
   ══════════════════════════════════════════════════════ */

body.woocommerce-checkout h3,
body.woocommerce-checkout #order_review_heading {
    font-family: 'Alexandria', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--clr-dark, #111);
    text-transform: none;
    letter-spacing: .3px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--clr-gray-10, #eee);
}

/* Sub-headings inside billing/shipping */
body.woocommerce-checkout .woocommerce-billing-fields h3,
body.woocommerce-checkout .woocommerce-shipping-fields h3 {
    font-size: 1.15rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
}

/* ══════════════════════════════════════════════════════
   FORM FIELDS
   ══════════════════════════════════════════════════════ */

/* All single column */
body.woocommerce-checkout .woocommerce-billing-fields .form-row-first,
body.woocommerce-checkout .woocommerce-billing-fields .form-row-last,
body.woocommerce-checkout .woocommerce-shipping-fields .form-row-first,
body.woocommerce-checkout .woocommerce-shipping-fields .form-row-last {
    width: 100% !important;
    float: none !important;
    clear: both !important;
}

/* Labels */
body.woocommerce-checkout .form-row label {
    font-family: 'Noto Sans', sans-serif;
    font-size: .82rem;
    font-weight: 500;
    color: var(--clr-gray-60, #666);
    margin-bottom: 6px;
    display: block;
    text-transform: none;
    letter-spacing: .2px;
}

body.woocommerce-checkout .form-row label .required {
    color: var(--clr-primary, #C51E3A);
}

/* Inputs */
body.woocommerce-checkout input[type="text"],
body.woocommerce-checkout input[type="email"],
body.woocommerce-checkout input[type="tel"],
body.woocommerce-checkout input[type="number"],
body.woocommerce-checkout select,
body.woocommerce-checkout textarea {
    border: 1px solid var(--clr-gray-10, #e0e0e0);
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Noto Sans', sans-serif;
    font-size: .9rem;
    color: var(--clr-dark, #111);
    width: 100%;
    background: #fff;
    height: auto;
    box-sizing: border-box;
    transition: border-color .2s ease, box-shadow .2s ease;
}

body.woocommerce-checkout input:focus,
body.woocommerce-checkout select:focus,
body.woocommerce-checkout textarea:focus {
    border-color: var(--clr-dark, #111);
    outline: none;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, .06);
}

/* Select2 override (WC uses select2 for country/state) */
body.woocommerce-checkout .select2-container--default .select2-selection--single {
    border: 1px solid var(--clr-gray-10, #e0e0e0);
    border-radius: 6px;
    height: 46px;
    padding: 0 16px;
    display: flex;
    align-items: center;
}

body.woocommerce-checkout .select2-container--default .select2-selection--single:focus,
body.woocommerce-checkout .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--clr-dark, #111);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, .06);
}

body.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 46px;
    padding-left: 0;
    color: var(--clr-dark, #111);
    font-size: .9rem;
}

body.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px;
    right: 12px;
}

/* Form row spacing */
body.woocommerce-checkout .form-row {
    margin-bottom: 18px;
}

/* Ship to different address */
body.woocommerce-checkout #ship-to-different-address label {
    font-family: 'Noto Sans', sans-serif;
    font-size: .9rem;
    color: var(--clr-dark, #111);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

/* Notes textarea */
body.woocommerce-checkout .woocommerce-additional-fields textarea {
    min-height: 100px;
    resize: vertical;
}

/* ══════════════════════════════════════════════════════
   ORDER REVIEW BOX — beige sidebar
   ══════════════════════════════════════════════════════ */

#order_review {
    background: var(--clr-beige, #faf8f5);
    padding: 28px 28px 0;
    border: 1px solid var(--clr-gray-05, #f0f0f0) !important;
    border-radius: 10px;
    box-sizing: border-box;
}

#order_review table {
    margin-bottom: 0;
    width: 100%;
    table-layout: fixed;
    border: none !important;
    border-radius: 0 !important;
    background: none !important;
}

#order_review table td,
#order_review table th {
    padding: .9em 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: .9rem;
    border: none !important;
    background: none !important;
}

#order_review .woocommerce-checkout-review-order-table thead th,
#order_review .woocommerce-checkout-review-order-table thead td {
    border: none;
    font-family: 'Alexandria', sans-serif;
    font-size: .7rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--clr-gray-40, #999);
    padding-bottom: 12px;
}

#order_review .woocommerce-checkout-review-order-table th {
    color: var(--clr-dark, #111);
    font-size: .9rem;
    font-weight: 500;
}

#order_review .woocommerce-checkout-review-order-table th.product-total {
    text-align: right;
}

#order_review .woocommerce-checkout-review-order-table td {
    text-align: right;
    vertical-align: middle;
}

#order_review .woocommerce-checkout-review-order-table td.product-name {
    text-align: left;
    font-size: .88rem;
    line-height: 1.4;
    color: var(--clr-dark, #111);
}

#order_review .woocommerce-checkout-review-order-table th,
#order_review .woocommerce-checkout-review-order-table td {
    border-top: 1px solid rgba(0, 0, 0, .06);
}

table.woocommerce-checkout-review-order-table .product-name {
    width: 55%;
    word-wrap: break-word;
}

/* Subtotal row */
#order_review .woocommerce-checkout-review-order-table tfoot th {
    font-weight: 500;
    color: var(--clr-text, #524e4d);
}

/* Order total */
#order_review .woocommerce-checkout-review-order-table .order-total th {
    font-family: 'Alexandria', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--clr-dark, #111);
}

#order_review .woocommerce-checkout-review-order-table .order-total .amount {
    font-family: 'Alexandria', sans-serif;
    font-size: 1.35rem;
    color: var(--clr-dark, #111);
    font-weight: 700;
}

/* ── Shipping ── */
body.woocommerce-checkout .shipping-calculator-button {
    display: none !important;
}

#order_review tr.woocommerce-shipping-totals th,
#order_review tr.woocommerce-shipping-totals td {
    vertical-align: top;
    padding-top: .9em;
}

#order_review tr.woocommerce-shipping-totals td {
    text-align: left;
}

#shipping_method {
    list-style: none;
    margin: 0;
    padding: 0;
}

#shipping_method li {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0 8px;
    padding: 8px 0;
    font-size: .875rem;
    line-height: 1.4;
}

#shipping_method li > input[type="radio"] {
    flex-shrink: 0;
    margin-top: 3px;
    accent-color: var(--clr-dark, #111);
}

#shipping_method li > label {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    font-size: .88rem;
    color: var(--clr-dark, #111);
}

/* BOX NOW and similar plugin buttons */
#shipping_method li > button {
    flex-basis: 100%;
    margin-top: 8px;
    margin-bottom: 0 !important;
    background: var(--clr-dark, #111);
    color: #fff;
    border: none;
    padding: 10px 16px;
    font-family: 'Alexandria', sans-serif;
    font-size: .68rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    transition: background .3s ease;
}

#shipping_method li > button:hover {
    background: var(--clr-gray-80, #333);
}

/* ══════════════════════════════════════════════════════
   PAYMENT (nested inside #order_review)
   ══════════════════════════════════════════════════════ */

#payment {
    background-color: transparent !important;
    border: none !important;
    border-top: 1px solid rgba(0, 0, 0, .08) !important;
    padding: 0 0 28px !important;
    margin: 20px 0 0 !important;
    width: 100% !important;
    box-sizing: border-box;
}

#payment .payment_methods {
    margin: 0 !important;
    padding: 0 !important;
}

#payment .payment_methods > .woocommerce-PaymentMethod,
#payment .payment_methods > .wc_payment_method {
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

#payment .payment_methods > .woocommerce-PaymentMethod > label,
#payment .payment_methods > .wc_payment_method > label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
    cursor: pointer;
    font-size: .95rem;
    margin-left: 0;
    flex-wrap: wrap;
}

#payment .payment_methods li {
    list-style: none !important;
    margin-left: 0;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

#payment .payment_methods li > input[type="radio"] {
    flex-shrink: 0;
    margin: 0;
    accent-color: var(--clr-dark, #111);
}

#payment .payment_methods li img {
    float: none;
    border: 0;
    max-height: 24px;
    width: auto;
    margin-left: auto;
}

#payment .payment_methods li > label {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: var(--clr-dark, #111);
}

#payment .payment_methods li .payment_box {
    flex-basis: 100%;
    padding: 12px 16px 16px 28px;
    font-size: .85rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    background: rgba(0, 0, 0, .025);
    border-radius: 6px;
    margin: 4px 0 8px;
    line-height: 1.5;
    color: var(--clr-text, #524e4d);
}

#payment .payment_methods li .payment_box p {
    margin: 0;
    line-height: 1.5;
}

/* ── Place order button ── */
#payment .place-order {
    margin-top: 24px;
    margin-bottom: 0;
    float: none;
    width: 100%;
}

#payment .place-order .button,
body.woocommerce-checkout #place_order {
    width: 100% !important;
    background: var(--clr-dark, #111) !important;
    color: #fff !important;
    border: none !important;
    padding: 18px 32px !important;
    font-family: 'Alexandria', sans-serif !important;
    font-size: .72rem !important;
    font-weight: 600 !important;
    letter-spacing: 2.5px !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    border-radius: 0 !important;
    display: block !important;
    transition: background .3s ease, transform .15s ease !important;
    height: auto !important;
    line-height: 1.4 !important;
    box-sizing: border-box;
}

#payment .place-order .button:hover,
body.woocommerce-checkout #place_order:hover {
    background: var(--clr-gray-80, #333) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

/* ── Privacy / terms ── */
body.woocommerce-checkout .woocommerce-privacy-policy-text {
    font-size: .78rem;
    color: var(--clr-gray-40, #999);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body.woocommerce-checkout .woocommerce-privacy-policy-text a {
    color: var(--clr-gray-60, #666);
    text-decoration: underline;
    text-decoration-color: var(--clr-gray-10, #ddd);
    text-underline-offset: 2px;
}

body.woocommerce-checkout .woocommerce-privacy-policy-text a:hover {
    color: var(--clr-dark, #111);
}

/* ── Coupon row (custom, inside order table) ── */
body.woocommerce-checkout .coupon-row td {
    border-top: 1px solid rgba(0, 0, 0, .06);
    border-bottom: none;
    text-align: left;
}

body.woocommerce-checkout .coupon-row td > p {
    text-align: left !important;
    font-family: 'Alexandria', sans-serif !important;
    font-size: .68rem !important;
    color: var(--clr-gray-40, #999) !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    margin-bottom: 10px !important;
}

/* ── WooCommerce notices/alerts ── */
body.woocommerce-checkout .woocommerce-NoticeGroup,
body.woocommerce-checkout .woocommerce-notices-wrapper {
    grid-column: 1 / -1;
}

body.woocommerce-checkout .woocommerce-error,
body.woocommerce-checkout .woocommerce-message,
body.woocommerce-checkout .woocommerce-info {
    border-radius: 6px;
    font-size: .88rem;
    padding: 14px 20px;
}

body.woocommerce-checkout .woocommerce-error {
    border-left: 4px solid var(--clr-primary, #C51E3A);
    background: #fef5f5;
}

body.woocommerce-checkout .woocommerce-message {
    border-left: 4px solid #4caf50;
    background: #f5fbf5;
}

body.woocommerce-checkout .woocommerce-info {
    border-left: 4px solid var(--clr-gray-40, #999);
    background: var(--clr-gray-03, #fafafa);
}

/* ── Login/returning customer ── */
body.woocommerce-checkout .woocommerce-form-login-toggle .woocommerce-info {
    font-size: .88rem;
}

body.woocommerce-checkout .woocommerce-form-login-toggle .woocommerce-info a {
    color: var(--clr-dark, #111);
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════
   MOBILE
   ══════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    body.woocommerce-checkout .static-page__body {
        padding: 0 16px 40px;
    }

    body.woocommerce-checkout #customer_details,
    body.woocommerce-checkout #order_review_heading,
    body.woocommerce-checkout #order_review {
        width: 100% !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
    }

    body.woocommerce-checkout #order_review {
        margin-top: 32px;
        padding: 24px 20px 0 !important;
    }

    body.woocommerce-checkout #payment {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 0 0 20px !important;
    }

    body.woocommerce-checkout h3,
    body.woocommerce-checkout #order_review_heading {
        font-size: 1.15rem;
    }
}

/* ══════════════════════════════════════════════════════
   FREE SHIPPING NOTICE (cart + checkout)
   ══════════════════════════════════════════════════════ */

.free-shipping-notice {
    padding: 16px 20px;
    margin-bottom: 24px;
    border: 1px solid var(--clr-gray-05, #f0f0f0);
    background: var(--clr-gray-03, #fafafa);
    border-radius: 8px;
    box-sizing: border-box;
}

.free-shipping-notice > .container,
.free-shipping-notice {
    display: flex;
    align-items: center;
    gap: 14px;
}

.free-shipping-notice--success {
    background: #f5fbf5;
    border-color: #c3e6c3;
}

.free-shipping-notice__icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    line-height: 1;
}

.free-shipping-notice__body {
    flex: 1;
    min-width: 0;
}

.free-shipping-notice__body p,
.free-shipping-notice--success p {
    margin: 0 0 8px;
    font-size: .875rem;
    color: var(--clr-dark, #333);
    line-height: 1.4;
}

.free-shipping-notice--success p {
    margin-bottom: 0;
    color: #2e6b2e;
}

.free-shipping-notice__bar {
    height: 4px;
    background: var(--clr-gray-10, #e5e5e5);
    border-radius: 2px;
    overflow: hidden;
}

.free-shipping-notice__bar-fill {
    height: 100%;
    background: var(--clr-primary, #C51E3A);
    border-radius: 2px;
    transition: width .4s ease;
}
