/* ==========================================================================
   Simulator Warna Kendaraan — interactive SVG color visualizer
   ========================================================================== */

.vf-sim {
    --vf-sim-radius: var(--glob-border-radius-base, 0.4rem);
    --vf-sim-gap: 24px;
    --vf-sim-panel-bg: #f7f8fa;
    --vf-sim-border: #e3e6ea;
    width: 100%;
}

.vf-sim-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 16px;
    margin-bottom: 20px;
}

.vf-sim-subtitle {
    flex: 1 1 240px;
    margin: 0;
    color: var(--color-g-text-alpha-70, rgba(40, 40, 40, .7));
    font-size: .95rem;
}

/* ---- Layout: stage + controls ------------------------------------------ */

.vf-sim-layout {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: var(--vf-sim-gap);
    align-items: stretch;
}

/* ---- Preview stage ----------------------------------------------------- */

.vf-sim-stage-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(180deg, #fbfcfd 0%, #eef1f4 100%);
    border: 1px solid var(--vf-sim-border);
    border-radius: var(--vf-sim-radius);
}

.vf-sim-stage {
    position: relative;
    transition: opacity .3s ease;
    border-radius: var(--glob-border-radius-inner, 0.3rem);
    overflow: hidden;
    --vf-shift-1: var(--vf-light, #c3c8cf);
    --vf-shift-2: var(--vf-body, #8a8f98);
    --vf-shift-3: var(--vf-deep, #5a5f66);
}

.vf-sim-stage.is-switching {
    opacity: 0;
}

.vf-sim-vehicle-wrap {
    display: none;
}

.vf-sim-vehicle-wrap.is-active {
    display: block;
}

.vf-sim-vehicle {
    display: block;
    width: 100%;
    height: auto;
}

/* Painted body — fill driven by --vf-body, animated on change */
.vf-sim-body {
    fill: var(--vf-body, #8a8f98);
    transition: fill .35s ease;
}

/* Finishing overlays — cross-fade per active tier */
.vf-sim-finish rect {
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}

.vf-sim-stage.is-glossy .vf-finish-glossy,
.vf-sim-stage.is-glossy .vf-finish-gloss-hi,
.vf-sim-stage.is-matte .vf-finish-matte,
.vf-sim-stage.is-metallic .vf-finish-metallic,
.vf-sim-stage.is-candy .vf-finish-candy,
.vf-sim-stage.is-candy .vf-finish-candy-glass,
.vf-sim-stage.is-chrome .vf-finish-chrome,
.vf-sim-stage.is-moonlight .vf-finish-moonlight,
.vf-sim-stage.is-moonlight .vf-finish-lembayung,
.vf-sim-stage.is-moonlight .vf-finish-lembayung-burn {
    opacity: 1;
}

/* Stage-level finishing character */
.vf-sim-stage.is-glossy .vf-sim-vehicle {
    filter: saturate(1.12) contrast(1.05);
}
.vf-sim-stage.is-matte .vf-sim-vehicle {
    filter: saturate(.82) contrast(.92) brightness(.98);
}
.vf-sim-stage.is-metallic .vf-sim-vehicle {
    filter: saturate(1.05);
}
.vf-sim-stage.is-candy .vf-sim-vehicle {
    filter: saturate(1.15);
}
.vf-sim-stage.is-chrome .vf-sim-vehicle {
    filter: contrast(1.3) brightness(1.12) saturate(.7);
}
.vf-sim-stage.is-moonlight .vf-sim-vehicle {
    filter: saturate(1.08);
}

/* Pearl colour-shift shimmer */
.vf-sim-stage.is-moonlight .vf-finish-moonlight,
.vf-sim-stage.is-moonlight .vf-finish-lembayung {
    animation: vf-hue-shift 7s ease-in-out infinite alternate;
}

/* Iridescence overlay (color-dodge rainbow shift) — moonlight only */
.vf-finish-iridescent {
    opacity: 0;
    mix-blend-mode: color-dodge;
    transition: opacity .35s ease;
    pointer-events: none;
}

.vf-sim-stage.is-moonlight .vf-finish-iridescent {
    opacity: .12;
}

/* Glossy pure-white specular highlight (overlay blend) */
.vf-finish-gloss-hi {
    mix-blend-mode: overlay;
}

/* Candy glass-top wet reflection (overlay blend) */
.vf-finish-candy-glass {
    mix-blend-mode: overlay;
}

/* Lembayung / Pearl colour-shift layers — per-swatch dynamic gradient */
.vf-finish-lembayung {
    mix-blend-mode: color-dodge;
    animation: vf-hue-shift 7s ease-in-out infinite alternate;
}

.vf-finish-lembayung-burn {
    mix-blend-mode: color-burn;
    opacity: .35;
    animation: vf-hue-shift 9s ease-in-out infinite alternate-reverse;
}

/* Body curvature volume shading + panel lines (inside clip, over the paint) */
.vf-sim-curvature {
    mix-blend-mode: soft-light;
    pointer-events: none;
}

.vf-sim-panel {
    fill: none;
    stroke: #0e1116;
    stroke-opacity: .3;
    stroke-width: 3;
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* Ambient occlusion pool under the body */
.vf-sim-ao {
    fill: #000000;
    opacity: .28;
    filter: blur(10px);
    pointer-events: none;
}

@keyframes vf-hue-shift {
    from { filter: hue-rotate(0deg); }
    to   { filter: hue-rotate(38deg); }
}

/* ---- Summary + WhatsApp CTA -------------------------------------------- */

.vf-sim-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--vf-sim-border);
    border-radius: var(--glob-border-radius-inner, 0.3rem);
}

.vf-sim-summary-color {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .12);
    transition: background .35s ease;
}

.vf-sim-summary-text {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
    min-width: 0;
}

.vf-sim-summary-text strong {
    font-size: 1rem;
}

.vf-sim-summary-text span {
    font-size: .85rem;
    color: var(--color-g-text-alpha-70, rgba(40, 40, 40, .7));
}

.vf-sim-cta {
    justify-content: center;
    width: 100%;
}

/* ---- Step controls ----------------------------------------------------- */

.vf-sim-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vf-sim-step-label {
    display: block;
    margin-bottom: 10px;
    font-family: var(--glob-subheading-family);
    font-weight: var(--glob-subheading-weight);
    font-size: var(--glob-subheading-size);
    text-transform: var(--glob-subheading-transform);
    letter-spacing: var(--glob-subheading-letter-spacing);
    color: var(--color-g-text-alpha-70, rgba(40, 40, 40, .7));
}

.vf-sim-tabs,
.vf-sim-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vf-sim-tab,
.vf-sim-pill {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--vf-sim-border);
    background: #fff;
    color: var(--color-g-text, #282828);
    padding: 9px 16px;
    border-radius: var(--glob-border-radius-pill, 9999rem);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
    white-space: nowrap;
}

.vf-sim-tab:hover,
.vf-sim-pill:hover {
    border-color: var(--color-g-accent, #1cff86);
    color: var(--color-g-accent, #1cff86);
}

.vf-sim-tab.is-active,
.vf-sim-pill.is-active {
    background: var(--color-g-accent, #1cff86);
    border-color: var(--color-g-accent, #1cff86);
    color: var(--color-g-accent-front, #ffffff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

/* ---- Swatch grid ------------------------------------------------------- */

.vf-sim-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.vf-swatch {
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 10px 6px 8px;
    border: 1px solid var(--vf-sim-border);
    border-radius: var(--glob-border-radius-inner, 0.3rem);
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.vf-swatch:hover {
    border-color: var(--color-g-accent, #1cff86);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

.vf-swatch.is-active {
    border-color: var(--color-g-accent, #1cff86);
    box-shadow: 0 0 0 2px var(--color-g-accent-a20, rgba(28, 255, 134, .2));
}

.vf-swatch-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 2px 5px rgba(0, 0, 0, .15);
    transition: background .35s ease;
}

/* Lembayung / Pearl swatches: colour-shifting dot instead of flat fill */
.vf-swatch-dot.is-duotone {
    position: relative;
    overflow: hidden;
}

.vf-swatch-dot.is-duotone::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg,
        var(--vf-shift-1, #fff),
        var(--vf-shift-2, #c9d6de),
        var(--vf-shift-3, #7c4dff));
    mix-blend-mode: normal;
    animation: vf-hue-shift 7s ease-in-out infinite alternate;
}

.vf-swatch-name {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-size: .76rem;
    font-weight: 600;
    color: var(--color-g-text-alpha-80, rgba(40, 40, 40, .8));
}

.vf-sim-hint {
    margin: 10px 0 0;
    font-size: .78rem;
    color: var(--color-g-text-alpha-50, rgba(40, 40, 40, .5));
}

.vf-sim-empty {
    grid-column: 1 / -1;
    margin: 8px 0;
    font-size: .9rem;
    color: var(--color-g-text-alpha-50, rgba(40, 40, 40, .5));
}

.vf-sim-swatches.is-loading {
    opacity: .5;
    pointer-events: none;
}

/* ---- Related products strip (full page) -------------------------------- */

.vf-sim-related {
    margin-top: 32px;
}

.vf-sim-related-title {
    margin: 0 0 16px;
    font-size: 1.05rem;
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 900px) {
    .vf-sim-layout {
        grid-template-columns: 1fr;
    }

    .vf-sim-tabs,
    .vf-sim-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
    }

    .vf-sim-tab,
    .vf-sim-pill {
        flex: 0 0 auto;
    }
}

@media (max-width: 560px) {
    .vf-sim-stage-wrap {
        padding: 12px;
    }

    .vf-sim-swatches {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
        gap: 8px;
    }

    .vf-sim-header {
        align-items: flex-start;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .vf-sim *,
    .vf-sim *::before,
    .vf-sim *::after {
        transition: none !important;
        animation: none !important;
    }
}
