/*
 * configurator-mobile.css  —  MODDYS-STYLE LAYOUT
 * ─────────────────────────────────────────────────────────
 * Full-screen mobile configurator for phones (≤ 768px).
 * Loaded AFTER the main CSS so rules take priority.
 *
 * Layout map:
 *  ┌────────────────────────────────────┐  ← top 0
 *  │  .mob-header  (64px, fixed)        │  name · price · add to cart
 *  ├────────────────────────────────────┤  ← top: 64px
 *  │  .viewer-section  (white, ~55vh)   │  large watch preview
 *  ├────────────────────────────────────┤  ← ~55vh
 *  │  .options-section  (grey, scroll)  │  step heading + circular thumbs
 *  ├────────────────────────────────────┤  ← bottom: 64px
 *  │  .mob-step-nav  (64px, fixed)      │  ← · ≡ 2/7 · →
 *  └────────────────────────────────────┘  ← bottom: 0
 */

/* ── Show/hide helpers for mobile-only elements ─────────── */
.mob-header {
    display: none;
}

.mob-topbar {
    display: none;
}

.mob-step-nav {
    display: none;
}

.mob-step-head {
    display: none;
}


/* ════════════════════════════════════════════════════════════
   MOBILE STYLES  (phones ≤ 768px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── base resets ──────────────────────────────────── */
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    html {
        -webkit-text-size-adjust: 100%;
    }

    body {
        overflow: hidden;
        overscroll-behavior: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* ── hide standard site header ───────────────────── */
    .fixed-header {
        display: none !important;
    }


    /* ══════════════════════════════════════════════════
       0.  BRAND TOP BAR  (44px, sits above product bar)
       Shows: ← Home  |  logo + LUPS MODS
    ══════════════════════════════════════════════════ */
    .mob-topbar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 44px;
        z-index: 601;
        background: #111;
        border-bottom: 1px solid rgba(212, 175, 55, 0.2);
        align-items: center;
        justify-content: space-between;
        padding: 0 12px;
    }

    /* ── Hamburger button in mob-topbar ──────────────── */
    .mob-topbar__menu {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 28px;
        height: 18px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        flex-shrink: 0;
    }

    .mob-topbar__menu span {
        width: 100%;
        height: 2px;
        background-color: #c5a059;
        border-radius: 2px;
        transition: all 0.3s ease;
        display: block;
    }

    .mob-topbar__menu.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mob-topbar__menu.active span:nth-child(2) {
        opacity: 0;
    }

    .mob-topbar__menu.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* ── Mobile nav overlay for configurators ────────── */
    .mob-nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(5, 5, 5, 0.97);
        backdrop-filter: blur(15px);
        z-index: 10001;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 28px;
        opacity: 0;
        transition: opacity 0.35s ease;
    }

    .mob-nav-overlay.active {
        display: flex;
        opacity: 1;
    }

    .mob-nav-overlay a {
        font-family: 'Cinzel', serif;
        font-size: 1.8rem;
        color: #F2F7F4;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        text-decoration: none;
        transition: color 0.3s ease;
    }

    .mob-nav-overlay a:hover {
        color: #c5a059;
    }

    .mob-nav-overlay .mob-nav-close {
        position: absolute;
        top: 14px;
        right: 16px;
        background: none;
        border: none;
        color: #c5a059;
        font-size: 2rem;
        cursor: pointer;
        line-height: 1;
    }



    .mob-topbar__back {
        display: flex;
        align-items: center;
        gap: 4px;
        color: #c5a059;
        font-family: 'Inter', sans-serif;
        font-size: 0.72rem;
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        text-decoration: none;
        min-width: 64px;
    }

    .mob-topbar__back svg {
        stroke: #c5a059;
        flex-shrink: 0;
    }

    .mob-topbar__logo {
        display: flex;
        align-items: center;
        gap: 8px;
        text-decoration: none;
    }

    .mob-topbar__logo img {
        width: 24px;
        height: 24px;
        object-fit: contain;
        filter: drop-shadow(0 0 4px rgba(197, 160, 89, 0.3));
    }

    .mob-topbar__logo span {
        font-family: 'Cinzel', serif;
        font-size: 0.65rem;
        font-weight: 700;
        color: #c5a059;
        letter-spacing: 0.18em;
        white-space: nowrap;
    }

    /* ══════════════════════════════════════════════════
       1.  MOBILE HEADER BAR  (64px, sits below topbar)
       Shows: product name · price · Add to cart button
    ══════════════════════════════════════════════════ */
    .mob-header {
        display: flex;
        position: fixed;
        top: 44px;
        /* pushed down by topbar */
        left: 0;
        right: 0;
        height: 64px;
        z-index: 600;
        background: #ffffff;
        border-bottom: 1px solid #e8e8e8;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
    }

    .mob-header__info {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-width: 0;
    }

    .mob-header__name {
        font-family: var(--font-heading, 'Cinzel', serif);
        font-size: 0.95rem;
        font-weight: 700;
        color: #111;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mob-header__price {
        font-size: 0.82rem;
        color: #555;
        font-weight: 500;
        white-space: nowrap;
    }

    /* actions group — wraps icon buttons + cart button */
    .mob-header__actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    /* small icon-only buttons (download / reset) */
    .mob-icon-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 1.5px solid #ddd;
        border-radius: 8px;
        background: #f6f6f6;
        color: #666;
        cursor: pointer;
        flex-shrink: 0;
        padding: 0;
        transition: background 0.15s, border-color 0.15s;
    }

    .mob-icon-btn:active {
        background: #ebebeb;
        border-color: #aaa;
        color: #222;
    }

    .mob-header__cart {
        flex-shrink: 0;
        padding: 8px 16px;
        min-height: 38px;
        border: 1.5px solid #222;
        border-radius: 7px;
        background: transparent;
        color: #222;
        font-family: var(--font-body, 'Inter', sans-serif);
        font-size: 0.78rem;
        font-weight: 600;
        letter-spacing: 0.03em;
        cursor: pointer;
        white-space: nowrap;
        transition: background 0.18s, color 0.18s;
    }

    .mob-header__cart:active {
        background: #222;
        color: #fff;
    }


    /* ══════════════════════════════════════════════════
       2.  PAGE CONTAINER
       Fills viewport below the fixed mob-header bar.
    ══════════════════════════════════════════════════ */
    .page-container {
        position: fixed !important;
        top: 108px !important;
        /* 44px topbar + 64px mob-header */
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: auto !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }


    /* ══════════════════════════════════════════════════
       3.  WATCH VIEWER  (top ~58% of remaining space)
       overflow:hidden clips any layer bleed.
       No transform:scale — container size = zoom level.
    ══════════════════════════════════════════════════ */
    .viewer-section {
        flex: 0 0 58% !important;
        width: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #ffffff;
        padding: 10px !important;
        position: relative;
        z-index: 5;
    }

    .watch-container {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        transform: scale(1.5) !important;
        /* ← 50% close-up zoom */
        position: relative;
        flex-shrink: 0;
    }

    .part-name-display {
        display: none !important;
        /* step-heading takes over this role */
    }


    /* ══════════════════════════════════════════════════
       4.  OPTIONS SECTION  (remaining space, scrollable)
       Shows only the active option-group at a time.
    ══════════════════════════════════════════════════ */
    .options-section {
        flex: 1 !important;
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        background: #f2f2f2;
        border-top: 1px solid #e0e0e0;
        border-right: none;
        border-radius: 0;
        padding: 0 !important;
        /* space for fixed step-nav + iOS home bar */
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* hide desktop price/cart bar */
    .options-header {
        display: none !important;
    }

    /* ── step heading (category + selected value) ─── */
    .mob-step-head {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 14px 16px 6px;
        gap: 2px;
    }

    .mob-step-head__cat {
        font-family: var(--font-heading, 'Cinzel', serif);
        font-size: 1rem;
        font-weight: 700;
        color: #111;
        letter-spacing: 0.01em;
    }

    .mob-step-head__val {
        font-size: 0.8rem;
        color: #888;
        font-weight: 400;
    }

    /* ── option-group visibility (JS controls .mob-active) ── */
    .dynamic-options-container {
        padding: 0 !important;
        gap: 0 !important;
    }

    .option-group {
        display: none !important;
    }

    .option-group.mob-active {
        display: block !important;
    }

    /* hide each group's own h2 — step-heading replaces it */
    .option-group h2 {
        display: none !important;
    }


    /* ══════════════════════════════════════════════════
       5.  CIRCULAR THUMBNAILS
       64px circles with the actual part image inside.
       Active one gets a black ring border.
    ══════════════════════════════════════════════════ */
    .option-buttons {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 16px !important;
        /* Increased gap to prevent label overlap */
        /* edge padding stops first/last circle from clipping, add bottom padding for labels */
        padding: 10px 20px 40px !important;
        align-items: flex-start;
        /* Align flex-start to prevent circles vertical shifting if labels wrap differently */
    }

    .option-buttons::-webkit-scrollbar {
        display: none;
    }

    .option-btn {
        flex-shrink: 0 !important;
        scroll-snap-align: start;

        /* circle sizing */
        width: 80px !important;
        height: 80px !important;
        min-width: 80px !important;
        min-height: 80px !important;
        max-width: 80px !important;
        max-height: 80px !important;
        border-radius: 50% !important;
        overflow: visible !important;
        position: relative !important;
        padding: 0 !important;

        border: 3px solid transparent !important;
        background: #d8d8d8;

        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        cursor: pointer;
        touch-action: manipulation;
        transition: border-color 0.15s, transform 0.12s;
    }

    .option-btn:active {
        transform: scale(0.91);
    }

    /* active / selected state */
    .option-btn.active {
        border-color: #111 !important;
    }

    /* the part image fills the circle */
    .option-btn .mob-thumb,
    .option-btn img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
        display: block;
        pointer-events: none;
        transform: scale(1.6);
        /* Zoom into the centered watch part */
    }

    /* show text labels below the circle on mobile */
    .option-btn .option-label {
        display: block !important;
        position: absolute;
        top: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        line-height: 1.15;
        text-align: center;
        color: #333;
        width: 90px;
        white-space: normal;
        font-weight: 500;
        pointer-events: none;
        word-wrap: break-word;
    }


    /* ══════════════════════════════════════════════════
       6.  STEP NAVIGATION BAR  (bottom, fixed 64px)
       ←  |  ≡ 2/7  |  →
    ══════════════════════════════════════════════════ */
    .mob-step-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        z-index: 600;
        background: #ffffff;
        border-top: 1px solid #e0e0e0;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
        box-sizing: border-box;
    }

    .mob-nav-btn {
        flex: 1;
        height: 44px;
        border-radius: 9px;
        font-size: 1.2rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity 0.15s;
        /* ← outlined */
        border: 1.5px solid #ccc;
        background: #fff;
        color: #333;
    }

    .mob-nav-btn:disabled {
        opacity: 0.3;
        pointer-events: none;
    }

    /* → filled dark */
    .mob-nav-btn.mob-nav-next {
        background: #111;
        border-color: #111;
        color: #fff;
    }

    .mob-nav-label {
        flex: 1.2;
        text-align: center;
        font-family: var(--font-body, 'Inter', sans-serif);
        font-size: 0.8rem;
        font-weight: 600;
        color: #666;
        white-space: nowrap;
        letter-spacing: 0.05em;
    }

    /* ── hide desktop selection summary ───────────── */
    .selection-summary {
        display: none !important;
    }
}


/* ── small phones  ≤ 390px  (SE, iPhone 12, Galaxy S) ── */
@media (max-width: 390px) {
    .viewer-section {
        flex: 0 0 54% !important;
    }

    .mob-header__name {
        font-size: 0.88rem;
    }

    .mob-header__cart {
        padding: 7px 12px;
        font-size: 0.74rem;
    }

    .option-btn {
        width: 58px !important;
        height: 58px !important;
        min-width: 58px !important;
        min-height: 58px !important;
        max-width: 58px !important;
        max-height: 58px !important;
    }
}