/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0F0F0F;
    --surface: #1A1A1A;
    --surface-hover: #222222;
    --border: #2A2A2A;
    --text: #FFFFFF;
    --text-secondary: #888888;
    --accent: #C8A96E;
    --accent-hover: #D4B87A;
    --accent-glow: rgba(200, 169, 110, 0.15);
    --danger: #FF6B6B;
    --success: #4ECDC4;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* ===== CONFIGURATOR LAYOUT ===== */
.configurator {
    display: grid;
    grid-template-columns: 480px 1fr;
    height: 100vh;
}

/* ===== LEFT PANEL ===== */
.panel-left {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    height: 100vh;
}

.panel-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--border);
}

.panel-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--accent);
}

.panel-header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* ===== OPTIONS SCROLL ===== */
.options-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.options-scroll::-webkit-scrollbar {
    width: 4px;
}

.options-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.options-scroll::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== OPTION GROUP ===== */
.option-group {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.option-group:last-child {
    border-bottom: none;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.option-number {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0;
}

/* ===== BUTTONS ===== */
.opt-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.option-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Color swatches */
.opt-btn.color-swatch {
    width: auto;
    height: auto;
    border-radius: 22px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    padding: 4px 14px 4px 4px;
}

.opt-btn.color-swatch .swatch-inner {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    display: block;
}

.opt-btn.color-swatch .swatch-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.opt-btn.color-swatch.active .swatch-label {
    color: var(--accent);
}

@media (hover: hover) {
    .opt-btn.color-swatch:hover {
        border-color: var(--text-secondary);
        transform: scale(1.03);
    }
}

.opt-btn.color-swatch.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Text option buttons */
.opt-btn.text-opt {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (hover: hover) {
    .opt-btn.text-opt:hover {
        border-color: var(--text-secondary);
        color: var(--text);
        background: var(--surface-hover);
    }
}

.opt-btn.text-opt.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.price-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(200, 169, 110, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Electrodomésticos info */
.electro-info {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.electro-section {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.electro-section:last-child {
    margin-bottom: 0;
}

.electro-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.electro-list {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.promo-tag {
    font-size: 9px;
    font-weight: 700;
    color: #4ECDC4;
    background: rgba(78, 205, 196, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.optional-tag {
    font-size: 9px;
    font-weight: 600;
    color: #5B9BD5;
    background: rgba(91, 155, 213, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.included-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--success);
    background: rgba(78, 205, 196, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== FOOTER / PRICE ===== */
.panel-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.price-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.price-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.price-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -1px;
    transition: var(--transition);
}

.price-value.changing {
    color: var(--accent);
    transform: scale(1.05);
}

.btn-budget {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 101;
}

.btn-budget:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(200, 169, 110, 0.25);
}

.btn-budget:active {
    transform: translateY(0);
}

.budget-validity {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--text-muted, #999);
    text-align: center;
    letter-spacing: 0.2px;
}

/* ===== RIGHT PANEL - GALLERY ===== */
.panel-right {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 40px;
    position: relative;
    overflow: hidden;
}

.gallery {
    width: 100%;
    max-width: 960px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gallery-main {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    position: relative;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.gallery-main img.fade {
    opacity: 0;
}

.gallery-thumbs {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.thumb {
    width: 120px;
    height: 75px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.5;
    transition: var(--transition);
}

.thumb:hover {
    opacity: 0.8;
}

.thumb.active {
    border-color: var(--accent);
    opacity: 1;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 440px;
    max-width: 90vw;
    position: relative;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.modal-icon {
    color: var(--accent);
    margin-bottom: 20px;
}

.modal h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 16px;
}

.captcha-group {
    display: flex;
    justify-content: center;
    margin: 8px 0 4px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
}

.form-group input::placeholder {
    color: #555;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.referral-hint {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.consent-group {
    margin-bottom: 16px;
}

.consent-label {
    display: flex;
    position: relative;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Oculta visualmente pero accesible (teclado y lectores de pantalla) */
.consent-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.consent-label input[type="checkbox"]:focus-visible + .consent-check {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.consent-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-top: 1px;
}

.consent-label input[type="checkbox"]:checked + .consent-check {
    background: var(--accent);
    border-color: var(--accent);
}

.consent-label input[type="checkbox"]:checked + .consent-check::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #0f0f0f;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}

.consent-text a {
    color: var(--accent);
    text-decoration: underline;
}

.consent-text a:hover {
    color: var(--accent-hover);
}

.modal-summary {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 20px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.summary-row span:first-child {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--bg);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.btn-submit.btn-email {
    background: var(--accent);
    color: var(--bg);
}

.btn-submit.btn-email:hover {
    background: var(--accent-hover);
    box-shadow: 0 8px 24px rgba(200, 169, 110, 0.25);
}

.btn-submit.btn-download {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-submit.btn-download:hover {
    border-color: var(--text-secondary);
    color: var(--text);
    background: var(--surface-hover);
}

.btn-submit:hover {
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.85;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(15, 15, 15, 0.3);
    border-top-color: var(--bg);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    html, body {
        overflow: auto;
        height: auto;
    }

    .configurator {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .panel-right {
        order: 1;
        padding: 20px;
        height: auto;
    }

    .panel-left {
        order: 2;
        height: auto;
        border-right: none;
        border-top: 1px solid var(--border);
    }

    .options-scroll {
        overflow-y: visible;
    }

    .panel-footer {
        position: sticky;
        bottom: 0;
        z-index: 100;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .gallery-main {
        aspect-ratio: 16 / 9;
    }

    .modal-overlay {
        position: fixed;
        z-index: 1000;
    }
}

@media (max-width: 600px) {
    .panel-header {
        padding: 20px 20px 16px;
    }

    .options-scroll {
        padding: 12px 20px;
    }

    .panel-footer {
        padding: 16px 20px;
    }

    .price-value {
        font-size: 26px;
    }

    .text-buttons {
        flex-direction: column;
    }

    .opt-btn.text-opt {
        justify-content: center;
    }

    .modal {
        padding: 24px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .thumb {
        width: 80px;
        height: 50px;
    }

    .gallery-thumbs {
        gap: 8px;
    }

    .btn-submit {
        padding: 12px;
        font-size: 13px;
    }
}

/* ===================== Motor de configuradores (añadidos) ===================== */
/* Todo con las variables del tema (fondo oscuro): nada de colores fijos claros. */
[hidden] { display: none !important; }

.loading-state {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    font-family: 'Inter', sans-serif; color: var(--text-secondary); background: var(--bg);
    padding: 16px; text-align: center;
}

.price-tax { margin: -6px 0 12px; font-size: 12px; color: var(--text-secondary); }

.financing {
    border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 14px;
    overflow: hidden; background: var(--surface);
}
.financing-toggle {
    width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 14px; background: var(--surface); border: 0; cursor: pointer;
    font: inherit; font-weight: 600; color: var(--text); transition: background var(--transition);
}
.financing-toggle:hover { background: var(--surface-hover); }
.financing-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.financing-quote { font-weight: 600; color: var(--accent); }
.financing-body { padding: 12px 14px 14px; display: grid; gap: 14px; border-top: 1px solid var(--border); }
.financing-field { display: grid; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.financing-field strong { color: var(--text); font-weight: 600; }
.financing-field select {
    width: 100%; font: inherit; padding: 9px 10px; border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text); border: 1px solid var(--border);
}
.financing-field select:focus { outline: none; border-color: var(--accent); }
.financing-field input[type="range"] { width: 100%; accent-color: var(--accent); }
.financing-summary { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.financing-summary div { display: grid; gap: 3px; }
.financing-summary dt { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.financing-summary dd { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.financing-summary div:first-child dd { color: var(--accent); }
.financing-legal { margin: 0; font-size: 11px; color: var(--text-secondary); line-height: 1.5; }

.whatsapp-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 900; width: 56px; height: 56px; border-radius: 50%;
    background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.45); transition: transform .15s ease;
}
.whatsapp-fab:hover, .whatsapp-fab:focus-visible { transform: scale(1.07); }
.whatsapp-fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.form-error {
    margin: 8px 0 0; padding: 10px 12px; border-radius: var(--radius-sm);
    background: rgba(255, 107, 107, 0.12); border: 1px solid rgba(255, 107, 107, 0.35);
    color: var(--danger); font-size: 13px;
}
.consent-inline { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-secondary); margin: 4px 0 10px; }
.consent-inline input { accent-color: var(--accent); margin-top: 2px; }

@media (max-width: 600px) {
    .whatsapp-fab { right: 16px; bottom: 88px; }
    .financing-summary { grid-template-columns: 1fr; }
}

/* Aviso informativo (no error) tras registrar el presupuesto */
.form-error.form-info { background: var(--accent-glow); border-color: var(--accent); color: var(--text); }

/* Tipo de IVA: descripción del tipo elegido */
.iva-descripcion { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.electro-info + .option-buttons { margin-top: 10px; }
