/* ============================================================
   checkout-additions.css
   checkout.css ke BAAD load karo (ya iska content checkout.css
   ke bilkul end mein paste kar do).

   Isme:
   1. Mobile fix: forms pehle, Order Summary + Place Order baad mein
   2. Mobile par collapsible "Show order summary" bar (top par)
   3. Billing Address section ke styles
   4. Chhote mobile UX fixes (iOS zoom, sticky header scroll)
   ============================================================ */


/* ─────────────────────────────────────
   1. SCROLL OFFSET (sticky header ke neeche
      error field chhup na jaye)
───────────────────────────────────── */
.co-input,
.co-select,
.co-textarea {
    scroll-margin-top: 120px;
}


/* ─────────────────────────────────────
   2. SUMMARY HEAD — step badge (mobile only)
───────────────────────────────────── */
.co-summary__headleft {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

/* Desktop par badge chhupa hua, tablet/mobile par nazar aata hai */
.co-summary__step {
    display: none;
}


/* ─────────────────────────────────────
   3. MOBILE TOP SUMMARY TOGGLE
      (desktop par hidden)
───────────────────────────────────── */
.co-mobile-summary {
    display: none;
    background: var(--color-bg-subtle, #fafafa);
    border: 1px solid var(--color-border, #e8e8e8);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
}

.co-mobile-summary__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9375rem 1.125rem;
    background: none;
    border: none;
    font-family: var(--font-body, Inter, sans-serif);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text, #111);
    text-align: left;
    cursor: pointer;
}

.co-mobile-summary__toggle:focus-visible,
.co-billing-opt__label:focus-within {
    outline: 2px solid var(--color-text, #111);
    outline-offset: -2px;
}

.co-mobile-summary__left {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.co-mobile-summary__chev {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.co-mobile-summary.is-open .co-mobile-summary__chev {
    transform: rotate(180deg);
}

.co-mobile-summary__total {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
}

.co-mobile-summary__panel {
    display: none;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem 0;
    background: var(--color-surface, #fff);
    border-top: 1px solid var(--color-border, #e8e8e8);
}

.co-mobile-summary.is-open .co-mobile-summary__panel {
    display: block;
}


/* ─────────────────────────────────────
   4. BILLING ADDRESS SECTION
───────────────────────────────────── */
.co-billing-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.co-billing-opt {
    border: 1.5px solid var(--color-border, #e0e0e0);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.co-billing-opt.is-selected {
    border-color: var(--color-text, #111);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.co-billing-opt__label {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
}

.co-billing-opt__label input[type="radio"] {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--color-text, #111);
    cursor: pointer;
}

.co-billing-opt__text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.co-billing-opt__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text, #111);
}

.co-billing-opt__desc {
    font-size: 0.8125rem;
    color: var(--color-text-muted, #777);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Billing form sirf tab khulta hai jab "different" select ho */
.co-billing-form {
    display: none;
    margin: 0 1.25rem 1.25rem;
    padding-top: 1.125rem;
    border-top: 1px solid var(--color-border, #e8e8e8);
}

.co-billing-opt.is-selected .co-billing-form {
    display: block;
    animation: co-detail-in 0.22s ease;
    /* checkout.css mein already defined */
}


/* ─────────────────────────────────────
   5. TABLET + MOBILE  ≤ 960px
      Forms PEHLE, order summary + Place Order BAAD MEIN
───────────────────────────────────── */
@media (max-width: 960px) {
    .co-layout {
        gap: 1.25rem;
    }

    /* checkout.css ka "order: -1" cancel — summary ab forms ke neeche aata hai */
    .co-summary {
        order: 0;
    }

    .co-mobile-summary {
        display: block;
        max-width: 600px;
        width: 100%;
        margin: 0 auto;
    }

    .co-summary__step {
        display: inline-flex;
    }

    .co-forms {
        width: 100%;
    }
}


/* ─────────────────────────────────────
   6. MOBILE  ≤ 680px
───────────────────────────────────── */
@media (max-width: 680px) {

    /* 16px se kam font par iPhone focus par zoom kar deta hai */
    .co-input,
    .co-select,
    .co-textarea,
    .co-coupon__input {
        font-size: 16px;
    }

    .co-mobile-summary {
        max-width: 100%;
    }

    .co-billing-opt__label {
        padding: 0.875rem 1rem;
    }

    .co-billing-form {
        margin: 0 1rem 1rem;
    }
}


/* ─────────────────────────────────────
   7. REDUCED MOTION
───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    .co-billing-opt,
    .co-mobile-summary__chev {
        transition: none;
    }

    .co-billing-opt.is-selected .co-billing-form {
        animation: none;
    }
}