/**
 * Rush SR Configurator V2 Styles
 *
 * CSS for the custom configurator UI built with BEM-style naming.
 * Uses `.configurator-v2__*` prefix for all components.
 *
 * @package RushAutoWorks2
 */

/* Base Layout */
.configurator-v2 {
    min-height: 100vh;
    background: var(--raw-navy, #041E42);
    overflow-x: clip;
}

.configurator-v2__loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(71, 199, 252, 0.2);
    border-top-color: var(--raw-cyan, #47C7FC);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.configurator-v2__error {
    padding: 2rem;
    text-align: center;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    margin: 2rem;
}

.configurator-v2__header {
    padding: 1rem 0;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.configurator-v2__title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
}

.configurator-v2__grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    padding: 2rem 0;
}

@media (max-width: 1024px) {
    .configurator-v2__grid {
        grid-template-columns: 1fr;
        max-width: calc(100vw - 2rem);
        padding-left: 0;
        padding-right: 0;
    }

    .configurator-v2__sidebar {
        display: none;
    }

    .configurator-v2__viewer {
        border-radius: 0;
        width: calc(100vw - 2rem);
        max-width: calc(100vw - 2rem);
    }

    .configurator-v2__viewer-area {
        aspect-ratio: 4 / 3;
        min-height: 280px;
        width: 100%;
        max-width: 100%;
    }

    .configurator-v2__viewer-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 8px;
        padding: 0.5rem;
    }

    .configurator-v2__viewer-hint {
        font-size: 0.6rem;
        top: 6px;
        padding: 3px 10px;
    }

    /* Color pickers: full-width first row */
    .configurator-v2__3d-colors.is-visible {
        order: -1;
        width: 100%;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 8px;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        flex: none;
    }

    .configurator-v2__color-group {
        flex-shrink: 0;
    }

    /* Anchor popover to the full-width 3d-colors bar */
    .configurator-v2__3d-colors.is-visible {
        position: relative;
    }

    /* Livery presets: hidden by default, pop out on tap */
    .configurator-v2__livery-presets {
        display: none !important;
        position: absolute;
        bottom: calc(100% + 8px);
        left: 0;
        right: 0;
        background: rgba(4, 30, 66, 0.95);
        border: 1px solid rgba(71, 199, 252, 0.25);
        border-radius: 8px;
        padding: 8px 10px;
        justify-content: center;
        gap: 6px;
        z-index: 20;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
    }
    .configurator-v2__color-group.is-presets-open .configurator-v2__livery-presets {
        display: flex !important;
    }

    /* Tap indicator on Wrap label */
    .configurator-v2__color-group .configurator-v2__section-label {
        cursor: pointer;
    }


    .configurator-v2__3d-colors .configurator-v2__color-label {
        flex-shrink: 0;
    }

    /* View toggle + right buttons: second row */
    .configurator-v2__controls-left {
        order: 1;
    }

    .configurator-v2__controls-right {
        order: 2;
        margin-left: auto;
    }
}

.configurator-v2__viewer {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.configurator-v2__viewer-placeholder {
    position: relative;
    display: flex;
    flex-direction: column;
}

.configurator-v2__viewer-fallback {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Contrast adjustment handled in viewer.js to merge with motion blur */

.configurator-v2__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.configurator-v2__canvas.is-ready {
    opacity: 1;
}

.configurator-v2__viewer-area {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Ensure viewer area has dimensions even when content is hidden */
    min-height: 400px;
    aspect-ratio: 16 / 9;
    /* Carbon fiber weave with blue tint */
    --weave: 7px;
    background:
        /* Carbon fiber weave pattern */
        linear-gradient(27deg, #0d1318 calc(var(--weave) * 0.25), transparent calc(var(--weave) * 0.25)) 0 calc(var(--weave) * 0.25),
        linear-gradient(207deg, #0d1318 calc(var(--weave) * 0.25), transparent calc(var(--weave) * 0.25)) calc(var(--weave) * 0.5) 0,
        linear-gradient(27deg, #1a2a38 calc(var(--weave) * 0.25), transparent calc(var(--weave) * 0.25)) 0 calc(var(--weave) * 0.5),
        linear-gradient(207deg, #1a2a38 calc(var(--weave) * 0.25), transparent calc(var(--weave) * 0.25)) calc(var(--weave) * 0.5) calc(var(--weave) * 0.25),
        linear-gradient(90deg, #0e1822 calc(var(--weave) * 0.5), transparent calc(var(--weave) * 0.5)),
        linear-gradient(#12222e 25%, #0c161c 25%, #0c161c 50%, transparent 50%, transparent 75%, #182835 75%, #182835);
    background-color: #091016;
    background-size: var(--weave) var(--weave);
    animation: carbon-scroll 60s linear infinite paused;
}

@keyframes carbon-scroll {
    from {
        background-position:
            0 calc(var(--weave) * 0.25),
            calc(var(--weave) * 0.5) 0,
            0 calc(var(--weave) * 0.5),
            calc(var(--weave) * 0.5) calc(var(--weave) * 0.25),
            0 0,
            0 0;
    }
    to {
        background-position:
            calc(var(--weave) * 10) calc(calc(var(--weave) * 0.25) + calc(var(--weave) * 10)),
            calc(calc(var(--weave) * 0.5) + calc(var(--weave) * 10)) calc(var(--weave) * 10),
            calc(var(--weave) * 10) calc(calc(var(--weave) * 0.5) + calc(var(--weave) * 10)),
            calc(calc(var(--weave) * 0.5) + calc(var(--weave) * 10)) calc(calc(var(--weave) * 0.25) + calc(var(--weave) * 10)),
            calc(var(--weave) * 10) calc(var(--weave) * 10),
            calc(var(--weave) * 10) calc(var(--weave) * 10);
    }
}

/* Animated light sheen overlay + vignette — own GPU layer for cheap compositing */
.configurator-v2__viewer-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        /* Cyan glow in center */
        radial-gradient(ellipse 70% 50% at 50% 55%, rgba(71, 199, 252, 0.06) 0%, transparent 60%),
        /* Vignette — wider transparent zone so 3D model isn't darkened */
        radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
    z-index: 3;
    will-change: opacity;
}

/* Film grain — SVG feTurbulence noise, promoted to own GPU layer so
   the filter renders once and composites cheaply each frame */
.configurator-v2__viewer-area::after {
    content: '';
    position: absolute;
    inset: 0;
    filter: url('#viewer-grain');
    opacity: 0.35;
    pointer-events: none;
    z-index: 4;
    mix-blend-mode: overlay;
    will-change: opacity;
}

.configurator-v2__viewer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(71, 199, 252, 0.1);
    gap: 8px;
}

.configurator-v2__controls-left,
.configurator-v2__controls-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 3D-only color pickers — direct child of viewer-controls */
.configurator-v2__3d-colors {
    display: none;
    align-items: center;
    gap: 12px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    flex: 1;
    min-width: 0;
}

.configurator-v2__3d-colors.is-visible {
    display: flex;
}

/* Paint group (customize + presets + wrap) */
.configurator-v2__color-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 1025px) {
    .configurator-v2__color-group {
        padding-right: 8px;
        border-right: 1px solid rgba(255, 255, 255, 0.15);
    }
}

/* Section label (e.g., "Wrap") */
.configurator-v2__section-label {
    font-size: 0.7rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

/* Livery preset swatches */
.configurator-v2__livery-presets {
    display: flex;
    align-items: center;
    gap: 4px;
}

.configurator-v2__livery-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
    flex-shrink: 0;
    background-clip: padding-box;
}

.configurator-v2__livery-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.7);
}

.configurator-v2__livery-swatch.is-active {
    border-color: var(--raw-cyan, #47C7FC);
    box-shadow: 0 0 6px var(--raw-cyan, #47C7FC);
}

.configurator-v2__color-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.7rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s ease;
}

.configurator-v2__color-label:hover {
    color: rgba(255, 255, 255, 0.9);
}

.configurator-v2__color-swatch {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    padding: 0;
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.configurator-v2__color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.configurator-v2__color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.configurator-v2__color-swatch::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.configurator-v2__color-swatch:hover {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.configurator-v2__color-swatch:focus {
    outline: none;
    border-color: var(--raw-cyan, #47C7FC);
}

/* Tooltip for wrap color picker */
.configurator-v2__color-label--with-tooltip {
    position: relative;
}

.configurator-v2__color-label--with-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--raw-navy-light, #0a2a4d);
    border: 1px solid rgba(71, 199, 252, 0.3);
    border-radius: 4px;
    font-size: 0.65rem;
    font-style: italic;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: 6px;
    z-index: 100;
}

.configurator-v2__color-label--with-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(71, 199, 252, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: -4px;
    z-index: 100;
}

.configurator-v2__color-label--with-tooltip:hover::before,
.configurator-v2__color-label--with-tooltip:hover::after,
.configurator-v2__color-label--with-tooltip:focus-within::before,
.configurator-v2__color-label--with-tooltip:focus-within::after {
    opacity: 1;
    visibility: visible;
}

/* Mobile: keep tooltips on-screen */
@media (max-width: 1024px) {
    .configurator-v2__color-label--with-tooltip::before {
        left: 0;
        transform: none;
        width: max-content;
    }
    .configurator-v2__color-label--with-tooltip::after {
        left: 12px;
        transform: none;
    }
}

/* Legacy play/pause (moved to topbar overlay) */

/* View Mode Toggle (3D / 360°) */
.configurator-v2__view-mode-toggle {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 2px;
    margin-right: 8px;
}

.configurator-v2__view-mode-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.configurator-v2__view-mode-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
}

.configurator-v2__view-mode-btn.is-active {
    background: var(--raw-cyan, #47C7FC);
    color: var(--raw-navy, #041E42);
}

.configurator-v2__view-mode-btn.is-active:hover {
    background: var(--raw-cyan, #47C7FC);
    color: var(--raw-navy, #041E42);
}

.configurator-v2__view-mode-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.configurator-v2__view-mode-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* Small-screen adjustments */
@media (max-width: 480px) {

    /* Shrink livery swatches on mobile */
    .configurator-v2__livery-swatch {
        width: 16px;
        height: 16px;
    }

    .configurator-v2__livery-presets {
        gap: 3px;
    }

    .configurator-v2__color-group {
        gap: 6px;
        padding-right: 6px;
    }
}

/* Viewer top-right overlay (reset, play/pause, zoom) */
.configurator-v2__viewer-topbar {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.configurator-v2__topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__topbar-btn > * {
    pointer-events: none;
}

.configurator-v2__topbar-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    color: white;
}

.configurator-v2__topbar-btn.is-paused {
    color: var(--raw-orange, #FF8000);
}

.configurator-v2__topbar-btn .play-icon {
    font-size: 12px;
    margin-top: 1px;
}

.configurator-v2__topbar-zoom {
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 0 8px;
    height: 32px;
    line-height: 32px;
    transition: color 0.2s ease;
}

.configurator-v2__topbar-zoom.is-zoomed {
    color: var(--raw-cyan, #47C7FC);
}

/* 3D Canvas styling — z-index 2 (below vignette z:3 and grain z:4) */
.configurator-v2__canvas--3d {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
}

.configurator-v2__canvas--3d.is-ready {
    opacity: 1;
}

/* 360° Canvas stays at base z-index */
.configurator-v2__canvas--360 {
    z-index: 1;
}

/* Legacy zoom display (moved to topbar overlay) */

/* Viewer hint overlay (top-center of viewer area) */
.configurator-v2__viewer-hint {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(0, 0, 0, 0.45);
    padding: 4px 14px;
    border-radius: 12px;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}

.configurator-v2__viewer-hint.is-hidden {
    opacity: 0;
}

/* Hide hint on narrow touch devices — overlaps topbar controls */
@media (pointer: coarse) and (max-width: 800px) {
    .configurator-v2__viewer-hint {
        display: none;
    }
}

.configurator-v2__viewer-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    cursor: pointer;
    transition: all 0.2s ease;
}

.configurator-v2__viewer-toggle:hover {
    background: rgba(255, 128, 0, 0.2);
    border-color: var(--raw-orange, #FF8000);
    color: white;
}

.configurator-v2__viewer-toggle svg {
    flex-shrink: 0;
}

/* Lights toggle (3-state: OFF / ON / STROBE) */
.configurator-v2__lights-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    cursor: pointer;
    transition: all 0.2s ease;
}

.configurator-v2__lights-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.configurator-v2__lights-toggle svg {
    flex-shrink: 0;
}

/* ON state - warm glow */
.configurator-v2__lights-toggle[data-mode="on"] {
    background: rgba(255, 255, 200, 0.15);
    border-color: rgba(255, 255, 200, 0.5);
    color: #ffffcc;
}

/* STROBE state - orange pulse */
.configurator-v2__lights-toggle[data-mode="strobe"] {
    background: rgba(255, 128, 0, 0.2);
    border-color: var(--raw-orange, #FF8000);
    color: var(--raw-orange, #FF8000);
}

/* Fullscreen styles — native Fullscreen API + iOS faux-fullscreen fallback.
   iOS Safari (iPhone) does not implement requestFullscreen on non-<video>,
   so the viewer JS toggles .is-faux-fullscreen instead, which uses fixed
   positioning to fill the viewport. */
.configurator-v2__viewer:fullscreen,
.configurator-v2__viewer.is-faux-fullscreen {
    background: #000;
    border-radius: 0;
}

.configurator-v2__viewer.is-faux-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    max-height: none !important;
}

/* Lock body scroll while faux-fullscreen is active. */
body.configurator-v2-faux-fullscreen {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

.configurator-v2__viewer:fullscreen .configurator-v2__viewer-placeholder,
.configurator-v2__viewer.is-faux-fullscreen .configurator-v2__viewer-placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.configurator-v2__viewer:fullscreen .configurator-v2__viewer-area,
.configurator-v2__viewer.is-faux-fullscreen .configurator-v2__viewer-area {
    flex: 1;
    aspect-ratio: auto;
    min-height: 0;
}

.configurator-v2__viewer:fullscreen .configurator-v2__viewer-area canvas,
.configurator-v2__viewer.is-faux-fullscreen .configurator-v2__viewer-area canvas {
    width: 100% !important;
    height: 100% !important;
}

.configurator-v2__viewer:fullscreen .viewer-image-wrapper,
.configurator-v2__viewer.is-faux-fullscreen .viewer-image-wrapper {
    aspect-ratio: auto !important;
    width: 100%;
    height: 100%;
}

.configurator-v2__viewer:fullscreen .viewer-image-wrapper img,
.configurator-v2__viewer.is-faux-fullscreen .viewer-image-wrapper img {
    object-fit: contain !important;
}

.configurator-v2__viewer:fullscreen .configurator-v2__viewer-controls,
.configurator-v2__viewer.is-faux-fullscreen .configurator-v2__viewer-controls {
    background: rgba(0, 0, 0, 0.8);
}

.configurator-v2__zoom-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.configurator-v2__zoom-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(4, 30, 66, 0.8);
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.configurator-v2__zoom-btn:hover {
    background: rgba(71, 199, 252, 0.3);
    border-color: var(--raw-cyan, #47C7FC);
    color: rgba(255, 255, 255, 0.5);
}

.configurator-v2__wraps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__wraps-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

.configurator-v2__wrap-swatch {
    width: 48px;
    height: 32px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background-color: #666;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.configurator-v2__wrap-swatch:hover {
    transform: scale(1.1);
}

.configurator-v2__wrap-swatch:hover,
.configurator-v2__wrap-swatch.is-active {
    border-color: var(--raw-orange, #FF8000);
}

.configurator-v2__category {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.configurator-v2__category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.configurator-v2__category-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__category-subtotal {
    font-size: 0.875rem;
    color: var(--raw-orange, #FF8000);
}

.configurator-v2__category-desc {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1rem;
}

.configurator-v2__options-grid {
    display: grid;
    gap: 0.75rem;
}

.configurator-v2__options-grid--single,
.configurator-v2__options-grid--multi {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.configurator-v2__option-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(4, 30, 66, 0.5);
    border: 2px solid rgba(71, 199, 252, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    text-transform: none;
    letter-spacing: normal;
    font-weight: normal;
}

.configurator-v2__option-card:hover {
    border-color: rgba(71, 199, 252, 0.4);
    background: rgba(4, 30, 66, 0.7);
}

.configurator-v2__option-card.is-selected {
    border-color: var(--raw-orange, #FF8000);
    background: rgba(4, 30, 66, 0.7);
}

.configurator-v2__option-card.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.configurator-v2__option-card.is-disabled:hover {
    border-color: rgba(71, 199, 252, 0.2);
    background: rgba(4, 30, 66, 0.5);
}

.configurator-v2__option-radio,
.configurator-v2__option-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}

.configurator-v2__option-radio {
    border-radius: 50%;
}

.configurator-v2__option-check {
    border-radius: 4px;
}

.configurator-v2__option-card.is-selected .configurator-v2__option-radio {
    border-color: var(--raw-orange, #FF8000);
    background: var(--raw-orange, #FF8000);
    box-shadow: inset 0 0 0 3px var(--raw-navy, #041E42);
}

.configurator-v2__option-card.is-selected .configurator-v2__option-check {
    border-color: var(--raw-orange, #FF8000);
    background: var(--raw-orange, #FF8000);
    box-shadow: inset 0 0 0 3px var(--raw-navy, #041E42);
}

.configurator-v2__option-content {
    flex: 1;
}

.configurator-v2__option-name {
    display: block;
    font-weight: 500;
}

.configurator-v2__option-price {
    display: block;
    font-size: 0.875rem;
    color: var(--raw-orange, #FF8000);
    margin-top: 0.25rem;
}

.configurator-v2__option-desc {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.25rem;
}

.configurator-v2__option-note {
    display: block;
    font-size: 0.7rem;
    color: var(--raw-cyan, #47C7FC);
    font-style: italic;
    margin-top: 0.25rem;
}

.configurator-v2__option-savings {
    display: inline-block;
    font-size: 0.7rem;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    margin-top: 0.375rem;
}

/* Subsection titles */
.configurator-v2__subsection-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__subsection-title:first-of-type {
    margin-top: 0;
}

/* Subsection description */
.configurator-v2__subsection-desc {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
    margin: -0.5rem 0 1rem;
}

.configurator-v2__discount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-right: 0.25rem;
}

/* Strikethrough original price */
.configurator-v2__price-original {
    text-decoration: line-through;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8em;
    margin-right: 0.375rem;
}

/* More info accordion - IMPROVED */
.configurator-v2__more-info {
    margin-top: 0.75rem;
}

.configurator-v2__more-info summary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--raw-cyan, #47C7FC);
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0.75rem;
    margin: -0.25rem -0.5rem;
    border-radius: 6px;
    background: rgba(71, 199, 252, 0.08);
    border: 1px solid rgba(71, 199, 252, 0.15);
    transition: all 0.2s ease;
}

.configurator-v2__more-info summary:hover {
    background: rgba(71, 199, 252, 0.15);
    border-color: rgba(71, 199, 252, 0.3);
}

.configurator-v2__more-info summary::before {
    content: '▸';
    font-size: 0.625rem;
    transition: transform 0.2s ease;
}

.configurator-v2__more-info[open] summary {
    background: rgba(71, 199, 252, 0.12);
    border-color: rgba(71, 199, 252, 0.25);
    margin-bottom: 0.5rem;
}

.configurator-v2__more-info[open] summary::before {
    transform: rotate(90deg);
}

.configurator-v2__more-info summary::-webkit-details-marker {
    display: none;
}

.configurator-v2__more-info-content {
    margin-top: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(71, 199, 252, 0.1);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.configurator-v2__more-info-content p {
    margin: 0 0 0.5rem;
}

.configurator-v2__more-info-content p:last-child {
    margin-bottom: 0;
}

.configurator-v2__more-info-content .text-muted {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9em;
}

.configurator-v2__more-info-content ul {
    margin: 0;
    padding-left: 1.25rem;
}

.configurator-v2__more-info-content li {
    margin-bottom: 0.25rem;
}

/* Included items table (for packages) */
.configurator-v2__included-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.configurator-v2__included-table th,
.configurator-v2__included-table td {
    padding: 0.375rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__included-table thead th {
    color: var(--raw-cyan, #47C7FC);
    font-weight: 500;
}

.configurator-v2__included-table th:last-child,
.configurator-v2__included-table td:last-child {
    text-align: right;
}

.configurator-v2__included-table tbody tr:last-child td,
.configurator-v2__included-table tbody tr:last-child th {
    border-bottom: none;
}

.configurator-v2__included-table tfoot th {
    padding-top: 0.75rem;
    border: none !important;
    text-decoration: none;
    font-size: 0.9375rem;
}

.configurator-v2__included-table tfoot tr,
.configurator-v2__included-table tfoot tr th,
.configurator-v2__included-table tfoot tr td {
    border: none !important;
    box-shadow: none;
}

.configurator-v2__included-table tfoot .savings th {
    color: #22c55e;
}

/* Specs table (for battery, etc.) */
.configurator-v2__specs-table {
    width: 100%;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    border-collapse: collapse;
}

.configurator-v2__specs-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__specs-table tr:last-child td {
    border-bottom: none;
}

.configurator-v2__specs-table td:first-child {
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    width: 40%;
}

.configurator-v2__specs-table td:last-child {
    text-align: right;
    color: white;
    font-weight: 500;
}

/* Card expands to full width when accordion is open */
.configurator-v2__option-card:has(details[open]) {
    grid-column: 1 / -1;
}

/* Ensure the more-info content uses available space when expanded */
.configurator-v2__option-card:has(details[open]) .configurator-v2__more-info-content {
    max-width: 800px;
}

/* More info content with image layout */
.configurator-v2__more-info-content--with-image {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.configurator-v2__specs-image {
    flex-shrink: 0;
    width: 200px;
}

.configurator-v2__specs-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.configurator-v2__specs-details {
    flex: 1;
    min-width: 0;
}

.configurator-v2__specs-details p {
    margin: 0 0 0.75rem;
    line-height: 1.6;
}

.configurator-v2__specs-details p:last-child {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .configurator-v2__more-info-content--with-image {
        flex-direction: column;
    }

    .configurator-v2__specs-image {
        width: 150px;
        margin: 0 auto;
    }
}

/* Wide option card (for competition package) */
.configurator-v2__option-card--wide {
    grid-column: 1 / -1;
}

/* Powder coat specific */
.configurator-v2__option-card--powder-coat {
    cursor: pointer;
}

.configurator-v2__color-picker-group {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__color-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.configurator-v2__color-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.configurator-v2__color-option input[type="radio"]:checked {
    border-color: var(--raw-orange, #FF8000);
    background: var(--raw-orange, #FF8000);
    box-shadow: inset 0 0 0 3px var(--raw-navy, #041E42);
}

.configurator-v2__color-input {
    width: 32px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    padding: 0;
}

.configurator-v2__color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.configurator-v2__color-input::-webkit-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.configurator-v2__color-input::-moz-color-swatch {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Sidebar */
.configurator-v2__sidebar {
    position: sticky;
    top: 8rem; /* Account for fixed header height */
    height: fit-content;
}

.configurator-v2__sidebar-inner {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(71, 199, 252, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
}

.configurator-v2__sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.configurator-v2__sidebar-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
    margin-bottom: 0;
}

.configurator-v2__reset-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    text-transform: none;
    font-family: inherit;
    transition: color 0.2s;
}

.configurator-v2__reset-btn:hover {
    color: rgba(255, 255, 255, 0.7);
}

.configurator-v2__summary {
    margin-bottom: 1.5rem;
    /* On desktop: grow up to ~50vh to ensure buttons stay visible */
    max-height: calc(100vh - 22rem);
    overflow-y: auto;
}

/* Hide scrollbar on desktop but allow scrolling if needed */
@media (min-width: 1025px) {
    .configurator-v2__summary {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    .configurator-v2__summary::-webkit-scrollbar {
        display: none; /* Chrome/Safari/Opera */
    }
}

.configurator-v2__summary__item,
.configurator-summary__item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(71, 199, 252, 0.1);
    font-size: 0.8125rem;
}

.configurator-v2__summary__item:last-child {
    border-bottom: none;
}

.configurator-v2__summary__item-name,
.configurator-summary__item-name {
    color: rgba(255, 255, 255, 0.85);
    flex: 1;
    line-height: 1.3;
}

.configurator-v2__summary__item-price,
.configurator-summary__item-price {
    color: white;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.configurator-v2__summary__item-price.is-free {
    color: rgba(255, 255, 255, 0.5);
}

/* Color swatch in sidebar */
.configurator-v2__summary__color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    vertical-align: middle;
    margin-left: 0.25rem;
}

.configurator-v2__summary__tbd {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.75rem;
}

.configurator-v2__totals {
    margin-bottom: 1.5rem;
}

.configurator-v2__total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

.configurator-v2__total-row--main {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
}

.configurator-v2__total-row--main span:last-child {
    color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__divider {
    border: none;
    border-top: 1px solid rgba(71, 199, 252, 0.2);
    margin: 0.5rem 0;
}

.configurator-v2__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.configurator-v2__debug {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Mobile drawer */
.configurator-v2__mobile-drawer,
.configurator-v2__mobile-cta {
    display: none;
}

@media (max-width: 1024px) {
    /* Drawer at bottom */
    .configurator-v2__mobile-drawer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(4, 30, 66, 0.98);
        border-top: 1px solid rgba(71, 199, 252, 0.2);
        z-index: 100;
    }

    /* Add padding for the drawer */
    .configurator-v2 {
        padding-bottom: 60px;
    }

    /* CTA inside drawer content */
    .configurator-v2__drawer-cta {
        padding: 1rem;
        border-top: 1px solid rgba(71, 199, 252, 0.1);
    }

    .configurator-v2__drawer-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 1rem;
        background: none;
        border: none;
        color: white;
        cursor: pointer;
    }

    .configurator-v2__drawer-total {
        color: var(--raw-cyan, #47C7FC);
    }

    .configurator-v2__drawer-content {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        /* Ensure content doesn't interfere with button when closed */
        pointer-events: none;
    }

    .configurator-v2__mobile-drawer.is-open .configurator-v2__drawer-content {
        max-height: 60vh;
        overflow-y: auto;
        pointer-events: auto;
        padding: 0 1rem 1rem;
    }

    .configurator-v2__mobile-drawer.is-open .configurator-v2__drawer-toggle-icon {
        transform: rotate(180deg);
    }

    .configurator-v2__mobile-cta {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.75rem 1rem;
        background: var(--raw-navy, #041E42);
        border-top: 1px solid rgba(71, 199, 252, 0.2);
        z-index: 100;
    }

    /* On mobile, summary needs scroll for drawer */
    .configurator-v2__summary {
        max-height: 200px;
        overflow-y: auto;
    }
}

/* Button utilities */
.btn-block {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-outline:hover {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Large screen layout: Viewer spans both columns */
@media (min-width: 1280px) {
    /* Flatten the nested structure so all elements become direct grid children */
    .configurator-v2.has-fullwidth-viewer .configurator-v2__grid,
    .configurator-v2.has-fullwidth-viewer .configurator-v2__left {
        display: contents;
    }

    /* Rebuild the layout on the container */
    .configurator-v2.has-fullwidth-viewer .configurator-v2__main .container {
        display: grid;
        grid-template-columns: 1fr 380px;
        grid-template-rows: auto 1fr;
        gap: 2rem;
    }

    /* Viewer spans both columns */
    .configurator-v2.has-fullwidth-viewer .configurator-v2__viewer {
        grid-column: 1 / -1;
        grid-row: 1;
        margin-bottom: 0;
    }

    /* Options in left column, row 2 */
    .configurator-v2.has-fullwidth-viewer .configurator-v2__options {
        grid-column: 1;
        grid-row: 2;
    }

    /* Sidebar in right column, row 2 */
    .configurator-v2.has-fullwidth-viewer .configurator-v2__sidebar {
        grid-column: 2;
        grid-row: 2;
        position: sticky;
        top: 8rem;
        align-self: start;
    }
}

/* ============================================================================
   Engine Sound - Toolbar Toggle Button
   ============================================================================ */

.configurator-v2__engine-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__engine-toggle > * {
    pointer-events: none;
}

.configurator-v2__engine-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.configurator-v2__engine-toggle.is-active {
    background: rgba(255, 128, 0, 0.2);
    border-color: var(--raw-orange, #FF8000);
    color: var(--raw-orange, #FF8000);
}

.configurator-v2__engine-toggle svg {
    flex-shrink: 0;
}

/* ============================================================================
   Engine HUD Overlay (RPM bar + controls)
   ============================================================================ */

.configurator-v2__engine-hud {
    position: absolute;
    bottom: 0;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 8px;
    z-index: 5;
}

/* Throttle button (hold to rev) */
.configurator-v2__hud-throttle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.65rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__hud-throttle > * {
    pointer-events: none;
}

/* Brake button (hold to brake) — mirror of throttle */
.configurator-v2__hud-brake {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.65rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__hud-brake > * {
    pointer-events: none;
}

.configurator-v2__hud-brake:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.configurator-v2__hud-brake.is-active {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.configurator-v2__hud-throttle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.configurator-v2__hud-throttle.is-active {
    background: rgba(255, 128, 0, 0.3);
    border-color: var(--raw-orange, #FF8000);
    color: var(--raw-orange, #FF8000);
    box-shadow: 0 0 8px rgba(255, 128, 0, 0.3);
}

/* RPM bar */
.configurator-v2__rpm-bar {
    flex: 1;
    min-width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.configurator-v2__rpm-fill {
    height: 100%;
    width: 10%;
    background: var(--raw-cyan, #47C7FC);
    border-radius: 3px;
    transition: width 0.05s linear, background-color 0.15s ease;
}

/* RPM color zones */
.configurator-v2__rpm-fill.rpm-zone-high {
    background: var(--raw-orange, #FF8000);
}

.configurator-v2__rpm-fill.rpm-zone-redline {
    background: #ef4444;
}

/* RPM value text */
.configurator-v2__rpm-value {
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    min-width: 38px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Gear controls: [−] [3] [+] */
.configurator-v2__hud-gears {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.configurator-v2__gear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 24px;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
    padding: 0 6px;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__gear-btn > * {
    pointer-events: none;
}

.configurator-v2__gear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.configurator-v2__gear-btn:active {
    background: rgba(71, 199, 252, 0.2);
    border-color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__gear-display {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 24px;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--raw-cyan, #47C7FC);
    text-align: center;
}

/* Auto/Manual toggle */
.configurator-v2__auto-toggle {
    display: flex;
    align-items: center;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 0.65rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__auto-toggle > * {
    pointer-events: none;
}

.configurator-v2__auto-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.configurator-v2__auto-toggle.is-active {
    background: rgba(71, 199, 252, 0.15);
    border-color: rgba(71, 199, 252, 0.4);
    color: var(--raw-cyan, #47C7FC);
}

/* Stop engine button */
.configurator-v2__hud-stop {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.configurator-v2__hud-stop > * {
    pointer-events: none;
}

.configurator-v2__hud-stop:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

/* Mobile: compact HUD — no physical keyboard, so hide keyboard hints
   (W/S/Q/E) and the Auto toggle (the "A" key shortcut) entirely.
   Touch users use the on-screen Throttle / Brake / shift arrows. */
@media (max-width: 768px) {
    .configurator-v2 .key-hint {
        display: none !important;
    }

    .configurator-v2__auto-toggle {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .configurator-v2__engine-hud {
        left: 6px;
        right: 6px;
        gap: 6px;
        padding: 5px 6px;
    }

    .configurator-v2__rpm-value {
        font-size: 0.7rem;
        min-width: 32px;
    }

    .configurator-v2__hud-throttle,
    .configurator-v2__hud-brake {
        padding: 5px 10px;
        font-size: 0.7rem;
        min-height: 30px;
    }

    /* Bigger tap targets for gear buttons */
    .configurator-v2__gear-btn {
        min-height: 30px;
        padding: 0 10px;
        font-size: 0.85rem;
    }
}

/* ============================================================================
   Customize Button & Popup
   ============================================================================ */

.configurator-v2__customize-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.configurator-v2__customize-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
}

.configurator-v2__customize-btn.is-active {
    background: rgba(71, 199, 252, 0.15);
    border-color: var(--raw-cyan, #47C7FC);
    color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__customize-btn svg {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .configurator-v2__customize-btn span {
        display: none;
    }
}

/* Customize popup panel */
.configurator-v2__customize-popup {
    position: absolute;
    bottom: 50px;
    right: 10px;
    width: 240px;
    background: rgba(4, 30, 66, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(71, 199, 252, 0.25);
    border-radius: 10px;
    padding: 12px;
    z-index: 20;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.configurator-v2__customize-popup.is-open {
    display: block;
}

.configurator-v2__popup-section {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(71, 199, 252, 0.1);
}

.configurator-v2__popup-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.configurator-v2__popup-heading {
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--raw-cyan, #47C7FC);
    margin: 0 0 8px;
}

.configurator-v2__popup-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.configurator-v2__popup-row:last-child {
    margin-bottom: 0;
}

.configurator-v2__popup-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    min-width: 40px;
    flex-shrink: 0;
}

.configurator-v2__popup-select {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    padding: 4px 6px;
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
}

.configurator-v2__popup-select:focus {
    outline: none;
    border-color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__popup-select option {
    background: #041E42;
    color: white;
}

.configurator-v2__popup-color {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    padding: 0;
    flex-shrink: 0;
}

.configurator-v2__popup-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.configurator-v2__popup-color::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.configurator-v2__popup-color::-moz-color-swatch {
    border: none;
    border-radius: 2px;
}

.configurator-v2__popup-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    padding: 5px 8px;
    font-size: 0.85rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    max-width: 60px;
    text-align: center;
}

.configurator-v2__popup-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.configurator-v2__popup-input:focus {
    outline: none;
    border-color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__popup-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    cursor: pointer;
}

.configurator-v2__popup-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--raw-cyan, #47C7FC);
    cursor: pointer;
}

.configurator-v2__popup-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--raw-cyan, #47C7FC);
    border: none;
    cursor: pointer;
}

/* Toggle switch for logo */
.configurator-v2__popup-toggle {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.configurator-v2__popup-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.configurator-v2__popup-toggle-track {
    display: block;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    transition: background 0.2s ease;
    position: relative;
}

.configurator-v2__popup-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.configurator-v2__popup-toggle input:checked + .configurator-v2__popup-toggle-track {
    background: var(--raw-cyan, #47C7FC);
}

.configurator-v2__popup-toggle input:checked + .configurator-v2__popup-toggle-track::after {
    transform: translateX(16px);
}

/* Mobile: reposition popup */
@media (max-width: 480px) {
    .configurator-v2__customize-popup {
        right: 4px;
        bottom: 44px;
        width: 220px;
        padding: 10px;
    }
}

/* ============================================================================
   Environment Drawer
   ============================================================================ */

.configurator-v2__topbar-btn--env {
    margin-left: auto;
    width: auto;
    padding: 0 10px;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.configurator-v2__env-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 180px;
    background: rgba(4, 30, 66, 0.95);
    backdrop-filter: blur(8px);
    border-left: 1px solid rgba(71, 199, 252, 0.2);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.configurator-v2__env-drawer.is-open {
    transform: translateX(0);
}

.configurator-v2__env-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(71, 199, 252, 0.15);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--raw-cyan, #47C7FC);
}

.configurator-v2__env-drawer-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s;
}

.configurator-v2__env-drawer-close:hover {
    color: white;
}

.configurator-v2__env-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.configurator-v2__env-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
}

.configurator-v2__env-item:hover {
    border-color: rgba(71, 199, 252, 0.4);
    transform: scale(1.02);
}

.configurator-v2__env-item.is-active {
    border-color: var(--raw-orange, #FF8000);
}

.configurator-v2__env-thumb {
    width: 100%;
    aspect-ratio: 2 / 1;
    object-fit: cover;
    display: block;
}

.configurator-v2__env-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    font-size: 0.7rem;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .configurator-v2__env-drawer {
        width: 140px;
    }

    .configurator-v2__env-drawer-header {
        padding: 10px 12px;
        font-size: 0.75rem;
    }

    .configurator-v2__env-grid {
        padding: 10px;
        gap: 6px;
    }
}

/* =========================================================================
   Lead Capture Popup
   ========================================================================= */

.lead-popup__overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.lead-popup__modal {
    position: relative;
    background: rgba(4, 30, 66, 0.97);
    border: 1px solid rgba(71, 199, 252, 0.3);
    border-radius: 12px;
    padding: 2rem;
    max-width: 780px;
    width: 100%;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
    animation: lead-popup-in 0.3s ease-out;
}

@keyframes lead-popup-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.lead-popup__title {
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 1.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin: 0 0 0.75rem;
}

.lead-popup__desc {
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 0.95rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 0.75rem;
}

.lead-popup__desc strong {
    color: var(--raw-orange, #FF8000);
}

.lead-popup__desc a {
    color: var(--raw-cyan, #47C7FC);
}

.lead-popup__form {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 1rem;
}

.lead-popup__input,
.lead-popup__textarea {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(71, 199, 252, 0.2);
    border-radius: 6px;
    padding: 0.625rem 0.75rem;
    color: #fff;
    font-family: var(--font-body, 'Inter', sans-serif);
    font-size: 16px; /* prevents iOS zoom */
    transition: border-color 0.2s;
}

.lead-popup__input:focus,
.lead-popup__textarea:focus {
    outline: none;
    border-color: var(--raw-cyan, #47C7FC);
}

.lead-popup__input::placeholder,
.lead-popup__textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.lead-popup__textarea {
    resize: vertical;
    min-height: 80px;
}

.lead-popup__submit {
    background: var(--raw-orange, #FF8000);
    color: #fff;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.25rem;
}

.lead-popup__submit:hover {
    background: #e67300;
}

.lead-popup__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.lead-popup__layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.lead-popup__image {
    flex: 1 1 0;
    align-self: center;
}

.lead-popup__hero-img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.lead-popup__body {
    flex: 1;
    min-width: 300px;
}

.lead-popup__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s;
}

.lead-popup__close:hover {
    color: #fff;
}

/* Tablet: stack layout */
@media (max-width: 640px) {
    .lead-popup__layout {
        flex-direction: column;
    }
    .lead-popup__image {
        flex: none;
        width: 100%;
        border-radius: 8px;
    }
    .lead-popup__hero-img {
        width: 100%;
        height: auto;
    }
}

/* Mobile: tighter padding, hide image */
@media (max-width: 480px) {
    .lead-popup__modal {
        padding: 1.25rem;
    }
    .lead-popup__image {
        display: none;
    }
    .lead-popup__title {
        font-size: 1.4rem;
    }
    .lead-popup__desc {
        font-size: 0.875rem;
    }
}
