/* ============================================
   WATCH BUILDER — MODDYS LIGHT THEME
   Exact matching of minimalist light aesthetic
   ============================================ */

:root {
    --color-bg-white: #FFFFFF;
    --color-bg-sidebar: #F4F4F4;
    --color-text-dark: #000000;
    --color-text-muted: #666666;
    --color-border: #E5E5E5;
    --color-border-hover: #AAAAAA;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    --ease-premium: cubic-bezier(0.2, 0.0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-white);
    color: var(--color-text-dark);
    min-height: 100vh;
    display: flex;
    overflow: hidden;
}

/* ============================================
   LAYOUT
   ============================================ */

.page-container {
    display: flex;
    flex-direction: row-reverse;
    /* Options on Left, Viewer on Right */
    width: 100%;
    height: 100vh;
    padding-top: 100px;
}

/* ============================================
   WATCH VIEWER (Right Side)
   ============================================ */

.viewer-section {
    flex: 1.8;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-white);
    padding: 40px;
}

.watch-container {
    position: relative;
    width: 100%;
    max-width: 1430px;
    aspect-ratio: 1;
    margin: 0 auto;
    z-index: 1;
    /* Completely removed all drop shadows for the crisp flat look */
    transition: transform 0.5s var(--ease-premium);
}

.watch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Part Name Label (Hidden or Minimal) */
.part-name-display {
    position: absolute;
    bottom: 50px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-text-dark);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
    z-index: 10;
}

.part-name-display.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   OPTIONS PANEL — Moddys Light Sidebar (Left)
   ============================================ */

.options-section {
    flex: 1.2;
    background: var(--color-bg-sidebar);
    border-right: 1px solid var(--color-border);
    /* Border now on the right */
    display: flex;
    flex-direction: column;
    padding: 0;
    height: 100vh;
    overflow-y: auto;
    position: relative;
}

/* HEADER */
.options-header {
    background: var(--color-bg-sidebar);
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 35px 40px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.options-section h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-text-dark);
    letter-spacing: 0.05em;
    margin: 0;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Price & Currency */
.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.price-display {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text-dark);
    background: transparent;
    padding: 0;
    border: none;
    text-align: right;
    min-width: auto;
}

.currency-select {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    padding: 0;
    text-align: right;
    outline: none;
    transition: all 0.3s ease;
}

.currency-select:hover {
    color: var(--color-text-dark);
}

.currency-select option {
    background: var(--color-bg-white);
    color: var(--color-text-dark);
}

/* Action Buttons */
.header-buttons {
    display: flex;
    gap: 15px;
    margin-top: 5px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--color-border);
    background: transparent;
    border-radius: 4px;
    /* Slight rounding for modern feel */
    color: var(--color-text-dark);
    font-family: var(--font-body);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-premium);
}

.action-btn:hover {
    background: #EAEAEA;
    border-color: #CCCCCC;
}

.cart-btn {
    background: var(--color-text-dark);
    color: var(--color-bg-white);
    border-color: var(--color-text-dark);
}

.cart-btn:hover {
    background: #333333;
    border-color: #333333;
    color: var(--color-bg-white);
}

/* ============================================
   OPTIONS LIST — Moddys Light Style
   ============================================ */

.dynamic-options-container {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-group h2 {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    color: var(--color-text-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border);
}

/* Option Buttons Wrapped */
.option-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    /* NEW: Let buttons stack to avoid horizontal scroll */
    padding-bottom: 10px;
}

.option-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 10px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-height: 48px;
    text-align: center;

    /* Removed fixed flex boundaries so they wrap naturally */
    flex: 0 0 auto;
    min-width: 90px;
    max-width: 140px;
}

/* Hide the inner thumbnail images on desktop (the desktop layout uses text pills) */
.option-btn img {
    display: none;
}

.option-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--color-text-dark);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

/* Hover */
.option-btn:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--color-border-hover);
}

/* Active / Selected */
.option-btn.active {
    background: var(--color-bg-white);
    border: 1px solid var(--color-text-dark);
}

.option-btn.active .option-label {
    color: var(--color-text-dark);
    font-weight: 700;
}

/* ============================================
   SCROLLBAR
   ============================================ */

.options-section::-webkit-scrollbar {
    width: 6px;
}

.options-section::-webkit-scrollbar-track {
    background: var(--color-bg-sidebar);
}

.options-section::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.options-section::-webkit-scrollbar-thumb:hover {
    background: #AAAAAA;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .page-container {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }

    .viewer-section {
        flex: 1 1 auto;
        height: 100%;
        padding: 20px;
    }

    .watch-container {
        max-width: 500px;
        margin-bottom: 25vh;
    }

    .options-section {
        flex: 0 0 auto;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 40vh;
        border-right: none;
        border-top: 1px solid var(--color-border);
        border-radius: 0;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
        z-index: 100;
        transition: height 0.3s ease;
    }

    .options-header {
        position: sticky;
        top: 0;
        background: var(--color-bg-sidebar);
        padding: 15px 25px;
        gap: 10px;
    }

    .header-top h1 {
        font-size: 1.1rem;
    }

    .price-display {
        font-size: 1.4rem;
    }

    .dynamic-options-container {
        padding: 25px;
        gap: 30px;
    }
}

/* ============================================
   MOBILE — Premium Responsive Layout (≤ 768px)
   ============================================

   Architecture:
   ┌──────────────────────────────────────────┐
   │  Fixed site header  (~70px)              │ z-index 200
   ├──────────────────────────────────────────┤
   │  Watch viewer  (flex 0 0 48%)            │ white bg
   ├──────────────────────────────────────────┤
   │  Scrollable options  (flex 1)            │ grey bg
   │  ...option groups / carousels...         │
   │  [padding-bottom clears sticky footer]   │
   ├──────────────────────────────────────────┤
   │  Sticky footer — price + cart  (fixed)   │ z-index 1000
   └──────────────────────────────────────────┘
*/
@media (max-width: 768px) {

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

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

    body {
        overflow: hidden;
        overscroll-behavior: none;
    }

    /* ── Page Container ───────────────────────── */
    /* Fills the viewport below the fixed site header.
       Use 'fixed inset' so iOS Safari doesn't miscalculate
       heights the way padding-top on a 100vh element does.  */
    .page-container {
        position: fixed;
        top: 70px;
        /* height of fixed site header */
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0;
        height: auto;
        /* let inset control height */
    }

    /* ── Watch Viewer ─────────────────────────── */
    /* Takes the top 48% of the area below the site header.
       overflow:hidden is CRITICAL — without it the absolutely-
       positioned watch layers bleed out and get clipped by the
       browser instead of the container.                        */
    .viewer-section {
        flex: 0 0 48%;
        width: 100%;
        overflow: hidden;
        /* clip image bleed */
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--color-bg-white);
        padding: 8px;
        position: relative;
        z-index: 5;
    }

    /* The watch layers are position:absolute children that use
       width:100% / height:100% / object-fit:contain.  Making
       the container the right size IS the zoom — no transform
       needed and no overflow risk.                             */
    .watch-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        transform: none;
        /* ← removed scale(2.6) */
        position: relative;
        flex-shrink: 0;
    }

    .part-name-display {
        bottom: 6px;
        font-size: 0.8rem;
        padding: 4px 10px;
    }

    /* ── Options Section (scrollable) ─────────── */
    /* flex:1 fills everything between viewer and footer.
       padding-bottom clears the fixed footer bar + iOS
       home indicator without extra JS.                         */
    .options-section {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        background: var(--color-bg-sidebar);
        border-top: 1px solid var(--color-border);
        border-right: none;
        border-radius: 0;
        height: auto !important;
        /* Clear sticky footer height + iOS home bar */
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    /* ── Sticky Price + Cart Footer ────────────── */
    /* Fixed to viewport bottom.  env() keeps content above
       the iOS home indicator on notched iPhones.              */
    .options-header {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        z-index: 1000;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        background: var(--color-bg-white);
        border-top: 1px solid var(--color-border);
        border-bottom: none;
        /* iOS safe area — padding-bottom grows on notched phones */
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }

    .options-header h1 {
        display: none;
    }

    .header-top {
        margin: 0;
        align-items: center;
        flex-shrink: 0;
    }

    .price-display {
        font-size: 1.25rem;
        white-space: nowrap;
        line-height: 1;
    }

    .header-buttons {
        gap: 8px;
        margin: 0;
        flex-shrink: 0;
        align-items: center;
    }

    /* Hide secondary actions — keep footer lean */
    .action-btn.download-btn,
    .action-btn.reset-btn {
        display: none !important;
    }

    /* ── Add to Cart Button ───────────────────── */
    /* Never collapses:  min-width + flex-shrink:0 + white-space  */
    .cart-btn {
        min-width: 130px;
        min-height: 48px;
        padding: 12px 20px;
        font-size: 0.8rem;
        font-weight: 600;
        flex-shrink: 0;
        white-space: nowrap;
        margin: 0;
    }

    /* ── Options Container ───────────────────── */
    .dynamic-options-container {
        padding: 16px 0 8px;
        gap: 22px;
    }

    .option-group {
        gap: 10px;
    }

    .option-group h2 {
        text-align: center;
        font-size: 0.9rem;
        letter-spacing: 0.08em;
        border-bottom: none;
        padding: 0 16px 4px;
        margin: 0;
    }

    /* ── Horizontal Option Carousel ──────────── */
    /* Edge padding stops first/last pill from being visually
       clipped against the container edge.  scroll-snap gives
       a premium tactile feel when swiping.                    */
    .option-buttons {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 10px;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        -ms-overflow-style: none;
        /* Horizontal padding keeps first/last item from edge-clipping */
        padding: 4px 20px 12px;
        align-items: center;
    }

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

    /* Option pill */
    .option-btn {
        flex-shrink: 0;
        scroll-snap-align: start;
        min-width: 76px;
        min-height: 44px;
        /* minimum recommended touch target */
        padding: 10px 12px;
        border-radius: 50px;
        white-space: nowrap;
    }

    .option-label {
        font-size: 0.65rem;
    }
}

/* ── Small phones (≤ 390px, e.g. iPhone SE / Galaxy S8) ── */
@media (max-width: 390px) {

    /* Slightly smaller viewer to give options more breathing room */
    .viewer-section {
        flex: 0 0 44%;
    }

    .price-display {
        font-size: 1.1rem;
    }

    .cart-btn {
        min-width: 110px;
        padding: 11px 16px;
        font-size: 0.75rem;
    }
}

/* ============================================
   SELECTION SUMMARY PANEL
   ============================================ */

.selection-summary {
    margin: 0 40px 40px;
    padding: 25px 30px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-white);
    border-radius: 8px;
}

@media (max-width: 768px) {
    .selection-summary {
        display: none;
    }
}

.selection-summary h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--color-text-dark);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.selection-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selection-summary li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-body);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.selection-summary .summary-category {
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

.selection-summary .summary-value {
    color: var(--color-text-dark);
    font-weight: 600;
}

.selection-summary .summary-value.none {
    color: #999;
    font-weight: 400;
    font-style: italic;
}