/* ==========================================================================
   dark-mode.css — Modo oscuro del sitio IPS Los Ángeles
   Cárgalo AL FINAL de todos los CSS (después de header, footer y home-sections).
   Se activa con <html data-theme="dark"> (lo gestiona theme.js).
   ========================================================================== */

/* ---------- Botón del navbar (funciona en ambos modos) ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(31, 111, 139, 0.35);
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.3s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    background: rgba(31, 111, 139, 0.1);
    border-color: var(--primary);
}

html[data-theme="dark"] .theme-toggle {
    border-color: rgba(138, 208, 230, 0.35);
}

html[data-theme="dark"] .theme-toggle:hover {
    background: rgba(138, 208, 230, 0.12);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.4s ease;
}

.theme-toggle:hover svg {
    transform: rotate(18deg);
}

/* Luna en modo claro (clic = ir a oscuro); sol en modo oscuro */
.theme-toggle__sun { display: none; }
html[data-theme="dark"] .theme-toggle__sun { display: block; }
html[data-theme="dark"] .theme-toggle__moon { display: none; }

@media (max-width: 991.98px) {
    .theme-toggle {
        width: auto;
        padding: 0 1rem;
        border-radius: 999px;
        margin: 0.5rem 0;
    }
}

/* Transición suave solo mientras se cambia de tema */
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.3s ease, color 0.3s ease,
                border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ==========================================================================
   MODO OSCURO
   ========================================================================== */

/* ---------- 1. Variables globales (las usan header, footer y chatbot) ---------- */
html[data-theme="dark"] {
    color-scheme: dark;

    --primary: #4fb3d4;
    --primary-dark: #9bd6ea;
    --secondary: #121f2b;
    --text: #e3edf4;
    --muted: #9fb2c1;
    --border: rgba(138, 208, 230, 0.16);

    /* Tokens propios del modo oscuro */
    --dm-bg: #0b1620;
    --dm-surface: #121f2b;
    --dm-surface-2: #182a3a;
    --dm-heading: #e8f3f9;
    --dm-body: #c3d1dc;
    --dm-soft: #9fb2c1;
    --dm-accent: #6fb4ff;
    --dm-accent-bg: rgba(111, 180, 255, 0.14);
    --dm-pink: #ff7db3;
    --dm-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

/* ---------- 2. Fondo de página ---------- */
html[data-theme="dark"] body {
    background: var(--dm-bg);
    color: var(--text);
}

html[data-theme="dark"] body::before {
    background:
        radial-gradient(circle at 10% 20%, rgba(31, 111, 139, 0.28) 0%, transparent 32%),
        radial-gradient(circle at 85% 25%, rgba(20, 50, 80, 0.55) 0%, transparent 36%),
        radial-gradient(circle at 75% 80%, rgba(40, 110, 140, 0.22) 0%, transparent 28%),
        linear-gradient(120deg, #0b1620 0%, #0d1c29 50%, #0a141d 100%);
}

html[data-theme="dark"] body::after {
    opacity: 0.25;
}

/* Fondo rosado/azulado exclusivo de Ángeles Plus */
html[data-theme="dark"] body.page-plus main {
    background: linear-gradient(135deg, #0f1a2b 0%, #1b1330 50%, #2a1424 100%);
    background-attachment: fixed;
}

/* ---------- 3. Navbar y barra promocional ----------
   El navbar es blanco con texto var(--text); los links, la marca y el hover
   ya se adaptan solos por las variables. Aquí solo se cambia el fondo. */
html[data-theme="dark"] .top-promo-bar {
    background: #09131b;
    color: #dbe9f1;
    border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] .top-promo-bar__link {
    color: var(--primary-dark);
}

html[data-theme="dark"] .site-header {
    background: #0d1b27;
    border-bottom-color: var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* Logo: en modo oscuro se cambia a IPS_logo-dark.png (ambos <img> están en
   navbar.php; solo se muestra el que corresponde al tema). */
.navbar-logo--dark {
    display: none;
}

html[data-theme="dark"] .navbar-logo--light {
    display: none;
}

/* Mismo tamaño que el logo claro (navbar.css: 200x64, object-fit: contain),
   sin fondo, relleno ni sombra propios. */
html[data-theme="dark"] .navbar-logo--dark {
    display: block;
    width: 200px;
    height: 64px;
    max-width: 100%;
    object-fit: contain;
    background: transparent;
    padding: 0;
    border-radius: 0;
    filter: none;
}

html[data-theme="dark"] .navbar-toggler {
    border-color: rgba(138, 208, 230, 0.4);
}

html[data-theme="dark"] .dropdown-hover__menu a {
    color: var(--dm-heading);
}

html[data-theme="dark"] .dropdown-hover__menu a:hover {
    background: var(--dm-accent-bg);
    color: var(--dm-accent);
}

@media (min-width: 992px) {
    html[data-theme="dark"] .dropdown-hover__menu {
        background: var(--dm-surface-2);
        border: 1px solid var(--border);
        box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
    }
}

html[data-theme="dark"] .btn-primary {
    background: #1f6f8b;
    border-color: #1f6f8b;
    color: #ffffff;
}

html[data-theme="dark"] .btn-primary:hover {
    background: #2a86a8;
    border-color: #2a86a8;
}

/* ---------- 4. Superficies (tarjetas, bloques, footer) ---------- */
html[data-theme="dark"] .home-service-card,
html[data-theme="dark"] .home-location-card,
html[data-theme="dark"] .news-card,
html[data-theme="dark"] .empresa-objetivos__card,
html[data-theme="dark"] .empresa-mvv__card,
html[data-theme="dark"] .policy-card,
html[data-theme="dark"] .finance-card,
html[data-theme="dark"] .service-block,
html[data-theme="dark"] .section-divider__medallion,
html[data-theme="dark"] .news-carousel__arrow,
html[data-theme="dark"] .services-nav a,
html[data-theme="dark"] .plus-video,
html[data-theme="dark"] .plus-benefit-card,
html[data-theme="dark"] .plus-header__phone {
    background: var(--dm-surface);
    box-shadow: var(--dm-shadow);
}

html[data-theme="dark"] .home-service-card--all {
    background: linear-gradient(135deg, #144d63, #0b3f8f);
}

html[data-theme="dark"] .finance-card--latest {
    background: linear-gradient(160deg, var(--dm-surface) 55%, rgba(111, 180, 255, 0.12));
}

html[data-theme="dark"] .plus-cta {
    background: linear-gradient(135deg, #16223a, #2a1730);
    box-shadow: var(--dm-shadow);
}

html[data-theme="dark"] .services-nav a {
    border-color: var(--border);
}

html[data-theme="dark"] .sede-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .home-service-card__preview ul {
    border-top-color: var(--border);
}

/* Footer */
html[data-theme="dark"] .site-footer {
    background: #09131b;
    border-top-color: var(--border);
}

html[data-theme="dark"] .location-viewer {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

/* El mapa de Google (vista 3D) conserva sus colores originales:
   no se le aplica ningún filtro en modo oscuro. */
html[data-theme="dark"] .location-viewer iframe {
    filter: none;
}

/* Logos de aseguradoras: fondo claro para que se lean */
html[data-theme="dark"] .insurer-link {
    background: #ffffff;
    border-radius: 10px;
    padding: 0.4rem 0.9rem;
}

/* ---------- 5. Texto ---------- */
/* Títulos */
html[data-theme="dark"] .home-section-title,
html[data-theme="dark"] .home-service-card h3,
html[data-theme="dark"] .home-location-card,
html[data-theme="dark"] .home-location-card:hover,
html[data-theme="dark"] .news-card__caption h3,
html[data-theme="dark"] .empresa-mvv__card h3,
html[data-theme="dark"] .policy-card h3,
html[data-theme="dark"] .finance-card__year,
html[data-theme="dark"] .service-block__title,
html[data-theme="dark"] .services-nav a,
html[data-theme="dark"] .sede-row__info h2,
html[data-theme="dark"] .sede-row__contact a,
html[data-theme="dark"] .assoc-section__title,
html[data-theme="dark"] .assoc-doc__title,
html[data-theme="dark"] .plus-header__tagline p,
html[data-theme="dark"] .plus-benefits__title,
html[data-theme="dark"] .plus-benefit-card h3,
html[data-theme="dark"] .plus-cta h2,
html[data-theme="dark"] .plus-video__text h2,
html[data-theme="dark"] .home-service-card__link:hover,
html[data-theme="dark"] .news-carousel__arrow,
html[data-theme="dark"] .news-modal__nav,
html[data-theme="dark"] .news-modal__close {
    color: var(--dm-heading);
}

/* Los botones que quedan blancos conservan texto oscuro */
html[data-theme="dark"] .news-modal__close,
html[data-theme="dark"] .news-modal__nav {
    color: #144d63;
}

html[data-theme="dark"] .home-service-card--all h3,
html[data-theme="dark"] .home-service-card--all p {
    color: #ffffff;
}

html[data-theme="dark"] .services-nav a:hover,
html[data-theme="dark"] .news-carousel__arrow:hover {
    background: #0b3f8f;
    color: #ffffff;
    border-color: #0b3f8f;
}

/* Texto de cuerpo */
html[data-theme="dark"] .home-about__text p,
html[data-theme="dark"] .home-plus-banner__desc,
html[data-theme="dark"] .empresa-objetivos__list span,
html[data-theme="dark"] .empresa-mvv__card p,
html[data-theme="dark"] .empresa-mvv__values li,
html[data-theme="dark"] .service-block__body li,
html[data-theme="dark"] .sede-row__contact span {
    color: var(--dm-body);
}

/* Texto secundario */
html[data-theme="dark"] .home-section-subtitle,
html[data-theme="dark"] .home-service-card p,
html[data-theme="dark"] .home-service-card__preview li,
html[data-theme="dark"] .home-plus-banner__eyebrow,
html[data-theme="dark"] .news-card__caption p,
html[data-theme="dark"] .policy-card p,
html[data-theme="dark"] .finance-card__label,
html[data-theme="dark"] .service-block__chevron,
html[data-theme="dark"] .plus-video__text p,
html[data-theme="dark"] .plus-benefits__subtitle,
html[data-theme="dark"] .plus-benefit-card p,
html[data-theme="dark"] .plus-cta p {
    color: var(--dm-soft);
}

/* ---------- 6. Acentos azules (iconos, viñetas, enlaces) ---------- */
html[data-theme="dark"] .home-service-card__icon,
html[data-theme="dark"] .empresa-mvv__icon,
html[data-theme="dark"] .finance-card__icon,
html[data-theme="dark"] .service-block__icon,
html[data-theme="dark"] .sede-row__badge {
    background: var(--dm-accent-bg);
    color: var(--dm-accent);
}

html[data-theme="dark"] .home-service-card--all .home-service-card__icon {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

html[data-theme="dark"] .empresa-objetivos__list svg {
    background: var(--dm-accent-bg);
    color: var(--dm-accent);
}

html[data-theme="dark"] .section-divider__medallion,
html[data-theme="dark"] .home-location-card svg,
html[data-theme="dark"] .sede-row__contact svg,
html[data-theme="dark"] .news-card__time,
html[data-theme="dark"] .service-block__note,
html[data-theme="dark"] .sede-row__subtitle,
html[data-theme="dark"] .home-service-card__link,
html[data-theme="dark"] .sede-row__contact a:hover {
    color: var(--dm-accent);
}

html[data-theme="dark"] .section-divider__wave path {
    stroke: var(--dm-accent);
}

html[data-theme="dark"] .section-divider--pink .section-divider__wave path {
    stroke: #d4537e;
}

html[data-theme="dark"] .section-divider--pink .section-divider__medallion {
    color: var(--dm-pink);
}

html[data-theme="dark"] .empresa-mvv__values li::before,
html[data-theme="dark"] .service-block__body li::before,
html[data-theme="dark"] .home-service-card__preview li::before {
    background: var(--dm-accent);
}

/* Rosados de Ángeles Plus */
html[data-theme="dark"] .plus-header__phone,
html[data-theme="dark"] .plus-video__eyebrow,
html[data-theme="dark"] .plus-benefit-card__icon {
    color: var(--dm-pink);
}

html[data-theme="dark"] .plus-header__phone:hover {
    background: var(--dm-surface-2);
    color: var(--dm-pink);
}

html[data-theme="dark"] .plus-video__eyebrow {
    background: rgba(255, 125, 179, 0.12);
}

/* ---------- 7. Formulario PQRS ---------- */
html[data-theme="dark"] .pqrs-form-section {
    background: var(--dm-surface);
}

html[data-theme="dark"] .pqrs-form {
    border-color: rgba(138, 208, 230, 0.35);
}

html[data-theme="dark"] .pqrs-field label {
    color: var(--dm-body);
}

html[data-theme="dark"] .pqrs-field input[type="text"],
html[data-theme="dark"] .pqrs-field input[type="tel"],
html[data-theme="dark"] .pqrs-field input[type="email"],
html[data-theme="dark"] .pqrs-field select,
html[data-theme="dark"] .pqrs-field textarea {
    background: var(--dm-surface-2);
    border-color: rgba(138, 208, 230, 0.25);
    color: var(--text);
}

html[data-theme="dark"] .pqrs-field input:focus,
html[data-theme="dark"] .pqrs-field select:focus,
html[data-theme="dark"] .pqrs-field textarea:focus {
    box-shadow: 0 0 0 3px rgba(79, 179, 212, 0.25);
}

html[data-theme="dark"] .pqrs-alert-box--success {
    background: rgba(31, 158, 130, 0.18);
    color: #5fe0c0;
}

html[data-theme="dark"] .pqrs-alert-box--error {
    background: rgba(255, 138, 128, 0.12);
    color: #ff9a92;
}

html[data-theme="dark"] .finance-card__btn--disabled {
    background: #26394a;
    color: #7b8fa0;
}

/* ---------- 8. Chatbot ---------- */
html[data-theme="dark"] .ipsla-chat-widget {
    --ipsla-primary: #3a9dbf;
    --ipsla-primary-dark: #144d63;
    --ipsla-primary-deep: #0d3446;
    --ipsla-primary-light: #6cc3df;
    --ipsla-accent-soft: rgba(79, 179, 212, 0.16);
    --ipsla-bg: #121f2b;
    --ipsla-text: #e3edf4;
    --ipsla-text-soft: #9fb2c1;
    --ipsla-bubble-bot: #1b2f40;
    --ipsla-border: rgba(138, 208, 230, 0.18);
    --ipsla-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .ipsla-chat-input,
html[data-theme="dark"] .ipsla-login-input {
    background: var(--dm-surface-2);
    color: var(--text);
}

html[data-theme="dark"] .ipsla-quick-chip {
    color: #8ad0e6;
}

html[data-theme="dark"] .ipsla-quick-chip:hover {
    color: #ffffff;
}

html[data-theme="dark"] .ipsla-quick-chip--plus {
    background: rgba(79, 179, 212, 0.14);
    border-color: #4fb3d4;
    color: #bfe7f4;
}

html[data-theme="dark"] .ipsla-quick-chip--plus:hover {
    background: #1f6f8b;
    color: #ffffff;
}

html[data-theme="dark"] .ipsla-login-header h6 {
    color: #bfe7f4;
}

html[data-theme="dark"] .ipsla-login-back {
    color: #8ad0e6;
}

html[data-theme="dark"] .ipsla-login-error {
    color: #ff9a92;
}

/* reCAPTCHA de Google en el chat: la versión clara no se puede restyle; se deja tal cual */