/* ============================================================
   Modo oscuro — Pana Solution OÜ
   Se activa poniendo data-theme="dark" en <html> (ver el script
   inline en <head> y el interruptor del menú). El color de marca
   (lima) se mantiene igual en los dos modos.
   ============================================================ */

html[data-theme="dark"] {
    --surface: #14170F;
    --surface-rgb: 20, 23, 15;
    --light-surface: #1C2214;
    --dark-surface: #1C2214;
    --text-dark: #F2F4EC;
    --text-muted: #9BA68C;
    --border-light: rgba(255, 255, 255, 0.12);
    --accent-text: #BAE40E;
    color-scheme: dark;
}

/* La mayoría de las secciones ya usan estas variables (--white, --light-surface,
   --text-dark, --text-muted) directamente en su CSS, así que cambian solas.
   Lo que sigue cubre las clases propias de Bootstrap, que traen su color fijo. */

html[data-theme="dark"] body {
    background-color: var(--surface);
}

html[data-theme="dark"] .bg-white {
    background-color: var(--surface) !important;
}

html[data-theme="dark"] .bg-light,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background-color: var(--light-surface) !important;
    color: var(--text-dark) !important;
}

html[data-theme="dark"] .text-dark {
    color: var(--text-dark) !important;
}

html[data-theme="dark"] .text-muted {
    color: var(--text-muted) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] .border-end {
    border-color: var(--border-light) !important;
}

/* Formularios: borde e icono del placeholder legibles en fondo oscuro */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    border-color: var(--border-light);
}
html[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
    opacity: 1;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    background-color: var(--light-surface);
    color: var(--text-dark);
    border-color: var(--maincolor);
    box-shadow: 0 0 0 0.2rem rgba(186, 228, 14, 0.25);
}
html[data-theme="dark"] .form-select {
    /* flecha del select en claro para que se vea sobre fondo oscuro */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23F2F4EC' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

/* Slider de la calculadora */
html[data-theme="dark"] .form-range::-webkit-slider-runnable-track { background-color: #2A3220; }
html[data-theme="dark"] .form-range::-moz-range-track { background-color: #2A3220; }

/* Botones "outline-dark" (selector de buzones de la calculadora) */
html[data-theme="dark"] .btn-outline-dark {
    color: var(--text-dark) !important;
    border-color: var(--border-light) !important;
}
html[data-theme="dark"] .btn-check:checked + .btn-outline-dark {
    background-color: var(--maincolor) !important;
    border-color: var(--maincolor) !important;
    color: var(--dark-bg, #0E1109) !important;
}

/* Modales con fondo claro (Solicitar Propuesta) */
html[data-theme="dark"] .modal-content.rounded-4:not(.text-bg-dark) {
    background-color: var(--surface);
}
html[data-theme="dark"] .modal-body {
    color: var(--text-dark);
}

/* Acordeón de preguntas frecuentes */
html[data-theme="dark"] .accordion-item {
    background-color: var(--surface);
    color: var(--text-dark);
}
html[data-theme="dark"] .accordion-button {
    background-color: var(--surface);
    color: var(--text-dark);
}
html[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: var(--light-surface);
    color: var(--text-dark);
    box-shadow: none;
}
html[data-theme="dark"] .accordion-button::after {
    filter: invert(1) brightness(1.6);
}
html[data-theme="dark"] .accordion-body {
    background-color: var(--surface);
}

/* Tarjeta flotante del hero y tarjetas con fondo blanco explícito por inline style */
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: white"] {
    background: var(--surface) !important;
}

/* El icono de la rueda del formulario y los campos "shadow-lg" del simulador */
html[data-theme="dark"] .shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.5) !important;
}

/* Imágenes: un pelín menos brillantes para no deslumbrar sobre fondo oscuro */
html[data-theme="dark"] img:not(.logo-badge img):not(.brand-svg) {
    filter: brightness(0.92);
}

/* Texto oscuro garantizado sobre fondos lima (botones, insignias, resaltados) */
html[data-theme="dark"] .on-lime,
html[data-theme="dark"] .on-lime.text-dark { color: var(--on-lime) !important; }

/* Botón oscuro secundario: en modo oscuro pasa a contorno para que se distinga del fondo */
html[data-theme="dark"] .default-btn.dark-btn {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.28);
    color: var(--text-dark);
}
html[data-theme="dark"] .default-btn.dark-btn:hover {
    background-color: var(--maincolor);
    border-color: var(--maincolor);
    color: var(--on-lime);
}
html[data-theme="dark"] .default-btn:not(.dark-btn):hover {
    background-color: transparent;
    border-color: var(--maincolor);
    color: var(--maincolor);
}

/* Cabecera translúcida y logo */
html[data-theme="dark"] .navbar { background: rgba(var(--surface-rgb), 0.92); }
html[data-theme="dark"] .navbar-toggler { color: var(--text-dark); }
