/*
|--------------------------------------------------------------------------
| SIGESM - Sistema global de temas
|--------------------------------------------------------------------------
|
| Cargar DESPUÉS de sigesm.css, sigesm-auth.css o sigesm-public.css.
|
*/

:root {
    --theme-dark-bg: #07111f;
    --theme-dark-bg-secondary: #0b1728;
    --theme-dark-surface: #101d2f;
    --theme-dark-surface-soft: #0d1929;
    --theme-dark-surface-hover: #14243a;
    --theme-dark-text: #f4f7fb;
    --theme-dark-text-soft: #b5bfcd;
    --theme-dark-text-light: #8190a5;
    --theme-dark-blue-text: #8fb7ff;
    --theme-dark-turquoise: #27c6bb;
    --theme-dark-border: rgba(255,255,255,.085);
    --theme-dark-shadow: 0 22px 58px rgba(0,0,0,.24);
    --theme-transition-duration: 560ms;
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --bg: var(--theme-dark-bg);
    --surface: var(--theme-dark-surface);
    --surface-soft: var(--theme-dark-surface-soft);

    --background-1: #07111f;
    --background-2: #0a1626;
    --background-3: #0d1a2c;

    --text: var(--theme-dark-text);
    --text-soft: var(--theme-dark-text-soft);
    --text-light: var(--theme-dark-text-light);

    --border: var(--theme-dark-border);
    --shadow: var(--theme-dark-shadow);
    --shadow-card: 0 30px 80px rgba(0,0,0,.28);

    --blue: var(--theme-dark-blue-text);
    --blue-light: #6f9fe8;

    --sigesm-blue: var(--theme-dark-blue-text);
    --sigesm-blue-light: #6f9fe8;
    --sigesm-turquoise: var(--theme-dark-turquoise);
}

/* Transición circular */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: var(--theme-transition-duration);
    animation-timing-function: cubic-bezier(.2,.82,.2,1);
}

::view-transition-old(root) {
    animation: none;
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 2;
    animation-name: sigesm-theme-reveal;
}

@keyframes sigesm-theme-reveal {
    from {
        clip-path: circle(
            0 at
            var(--theme-x, 50%)
            var(--theme-y, 50%)
        );
    }

    to {
        clip-path: circle(
            var(--theme-radius, 150vmax) at
            var(--theme-x, 50%)
            var(--theme-y, 50%)
        );
    }
}

/* Botón global */
.theme-toggle {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: rgba(255,255,255,.78);
    color: #002868;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0,40,104,.055);
    transition:
        transform 220ms cubic-bezier(.2,.8,.2,1),
        border-color 220ms ease,
        background 220ms ease,
        box-shadow 220ms ease;
}

.theme-toggle::before {
    content: "";
    position: absolute;
    width: 44px;
    height: 44px;
    left: -28px;
    top: -27px;
    border-radius: 50%;
    background: rgba(0,167,157,.15);
    transition: transform .42s cubic-bezier(.2,.8,.2,1);
}

.theme-toggle:hover {
    transform: translateY(-2px) rotate(-2deg);
    border-color: rgba(0,167,157,.28);
    box-shadow: 0 12px 28px rgba(0,40,104,.10);
}

.theme-toggle:hover::before {
    transform: translate(30px,28px) scale(1.25);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(0,167,157,.24);
    outline-offset: 3px;
}

.theme-icon {
    position: absolute;
    width: 19px;
    height: 19px;
    z-index: 2;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition:
        opacity .32s ease,
        transform .42s cubic-bezier(.2,.8,.2,1);
}

.theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-icon-sun {
    opacity: 0;
    transform: rotate(-100deg) scale(.45);
}

html[data-theme="dark"] .theme-toggle {
    background: rgba(16,29,47,.86);
    border-color: rgba(255,255,255,.10);
    color: #f5d774;
    box-shadow: 0 10px 26px rgba(0,0,0,.20);
}

html[data-theme="dark"] .theme-icon-moon {
    opacity: 0;
    transform: rotate(95deg) scale(.45);
}

html[data-theme="dark"] .theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.auth-theme-control {
    position: fixed;
    z-index: 120;
    top: 22px;
    right: 24px;
}

/* Base oscura */
html[data-theme="dark"] body {
    background: var(--theme-dark-bg);
    color: var(--theme-dark-text);
}

html[data-theme="dark"] .page-loader,
html[data-theme="dark"] .public-loader {
    background: linear-gradient(135deg,#07111f,#0c1b2d);
}

/* Área interna */
html[data-theme="dark"] .topbar {
    background: rgba(7,17,31,.88);
    border-bottom-color: var(--theme-dark-border);
    box-shadow: 0 10px 34px rgba(0,0,0,.10);
}

html[data-theme="dark"] .sidebar-toggle {
    background: var(--theme-dark-surface);
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-blue-text);
}

html[data-theme="dark"] .sidebar-toggle:hover {
    background: var(--theme-dark-surface-hover);
}

html[data-theme="dark"] .topbar-title,
html[data-theme="dark"] .page-title,
html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .panel-title,
html[data-theme="dark"] .module-name,
html[data-theme="dark"] .app-footer strong {
    color: var(--theme-dark-blue-text);
}

html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .panel {
    background: var(--theme-dark-surface);
    border-color: var(--theme-dark-border);
    box-shadow: 0 12px 36px rgba(0,0,0,.14);
}

html[data-theme="dark"] .stat-card:hover {
    border-color: rgba(39,198,187,.28);
    box-shadow: var(--theme-dark-shadow);
}

html[data-theme="dark"] .stat-card::after {
    background: rgba(39,198,187,.055);
}

html[data-theme="dark"] .module-card {
    background: var(--theme-dark-surface-soft);
    border-color: var(--theme-dark-border);
}

html[data-theme="dark"] .module-card:hover {
    background: var(--theme-dark-surface-hover);
    border-color: rgba(39,198,187,.23);
}

html[data-theme="dark"] .profile-row,
html[data-theme="dark"] .app-footer {
    border-color: var(--theme-dark-border);
}

html[data-theme="dark"] .user-avatar {
    background: linear-gradient(135deg,#164b8f,#008f88);
}

/* Autenticación */
html[data-theme="dark"] .auth-page {
    background: linear-gradient(135deg,#07111f 0%,#0a1626 48%,#0d1a2c 100%);
}

html[data-theme="dark"] .auth-liquid-one {
    opacity: .18;
}

html[data-theme="dark"] .auth-liquid-two {
    opacity: .14;
}

html[data-theme="dark"] .auth-badge,
html[data-theme="dark"] .auth-feature,
html[data-theme="dark"] .auth-card {
    border-color: var(--theme-dark-border);
    background: rgba(16,29,47,.78);
}

html[data-theme="dark"] .auth-card {
    box-shadow: 0 34px 90px rgba(0,0,0,.30);
}

html[data-theme="dark"] .auth-feature:hover {
    background: rgba(20,36,58,.92);
    border-color: rgba(39,198,187,.28);
    box-shadow: 0 18px 42px rgba(0,0,0,.16);
}

html[data-theme="dark"] .auth-card-brand span,
html[data-theme="dark"] .auth-title,
html[data-theme="dark"] .auth-feature-title,
html[data-theme="dark"] .auth-footer strong {
    color: var(--theme-dark-blue-text);
}

html[data-theme="dark"] .auth-input {
    background: rgba(9,21,36,.80);
    border-color: var(--theme-dark-border);
    color: var(--theme-dark-text);
}

html[data-theme="dark"] .auth-input::placeholder {
    color: #718096;
}

html[data-theme="dark"] .auth-input:focus {
    background: #0c1a2b;
    border-color: rgba(39,198,187,.72);
    box-shadow: 0 0 0 4px rgba(39,198,187,.10);
}

html[data-theme="dark"] .password-toggle {
    color: #8796aa;
}

html[data-theme="dark"] .password-toggle:hover {
    color: var(--theme-dark-blue-text);
    background: rgba(255,255,255,.055);
}

html[data-theme="dark"] .auth-button {
    background: linear-gradient(120deg,#0c3b80,#006f78);
    color: #fff;
    box-shadow: 0 14px 30px rgba(0,0,0,.24);
}

html[data-theme="dark"] .auth-logo img {
    filter:
        brightness(1.55)
        saturate(.92)
        drop-shadow(0 10px 24px rgba(0,0,0,.16));
}

/* Sitio público */
html[data-theme="dark"] .public-header {
    background: rgba(7,17,31,.88);
    border-bottom-color: var(--theme-dark-border);
    box-shadow: 0 10px 34px rgba(0,0,0,.08);
}

html[data-theme="dark"] .public-nav > a {
    color: var(--theme-dark-text-soft);
}

html[data-theme="dark"] .public-nav > a:hover,
html[data-theme="dark"] .public-nav > a.active {
    color: #fff;
}

html[data-theme="dark"] .public-menu-button {
    background: var(--theme-dark-surface);
    border-color: var(--theme-dark-border);
}

html[data-theme="dark"] .public-menu-button span {
    background: var(--theme-dark-text);
}

html[data-theme="dark"] .public-hero,
html[data-theme="dark"] .about-hero,
html[data-theme="dark"] .security-page-hero,
html[data-theme="dark"] .help-hero {
    background: linear-gradient(135deg,#07111f 0%,#0a1626 52%,#0d1a2c 100%);
}

html[data-theme="dark"] .public-section-soft {
    background: #0a1626;
}

html[data-theme="dark"] .public-badge {
    background: rgba(16,29,47,.72);
    border-color: rgba(39,198,187,.22);
    color: #dce8ff;
}

html[data-theme="dark"] .hero-glass-card,
html[data-theme="dark"] .about-main,
html[data-theme="dark"] .about-identity,
html[data-theme="dark"] .public-feature-card,
html[data-theme="dark"] .module-public-card,
html[data-theme="dark"] .jasc-card,
html[data-theme="dark"] .cta-card,
html[data-theme="dark"] .about-logo-stage,
html[data-theme="dark"] .about-purpose-primary,
html[data-theme="dark"] .about-small-card,
html[data-theme="dark"] .about-architecture,
html[data-theme="dark"] .about-architecture-modules article,
html[data-theme="dark"] .identity-symbol-card,
html[data-theme="dark"] .identity-explanation,
html[data-theme="dark"] .identity-version-light,
html[data-theme="dark"] .identity-color-card,
html[data-theme="dark"] .jasc-about-card,
html[data-theme="dark"] .solution-signature,
html[data-theme="dark"] .security-layer-card,
html[data-theme="dark"] .security-control-card,
html[data-theme="dark"] .security-authorization-main,
html[data-theme="dark"] .security-status-panel,
html[data-theme="dark"] .security-practice,
html[data-theme="dark"] .help-hero-card,
html[data-theme="dark"] .help-quick-item,
html[data-theme="dark"] .help-category-card,
html[data-theme="dark"] .help-faq-intro,
html[data-theme="dark"] .help-faq-item,
html[data-theme="dark"] .help-support-main,
html[data-theme="dark"] .help-support-status {
    background: var(--theme-dark-surface);
    border-color: var(--theme-dark-border);
    box-shadow: 0 16px 42px rgba(0,0,0,.12);
}

html[data-theme="dark"] .architecture-module,
html[data-theme="dark"] .security-permission-step,
html[data-theme="dark"] .help-report-checklist div {
    background: var(--theme-dark-surface-soft);
    border-color: var(--theme-dark-border);
}

html[data-theme="dark"] .public-feature-card:hover,
html[data-theme="dark"] .module-public-card:hover,
html[data-theme="dark"] .about-small-card:hover,
html[data-theme="dark"] .identity-color-card:hover,
html[data-theme="dark"] .security-control-card:hover,
html[data-theme="dark"] .help-category-card:hover {
    border-color: rgba(39,198,187,.27);
    box-shadow: var(--theme-dark-shadow);
}

html[data-theme="dark"] .section-heading h2,
html[data-theme="dark"] .cta-card h2,
html[data-theme="dark"] .public-feature-card h3,
html[data-theme="dark"] .module-public-card h3,
html[data-theme="dark"] .about-main h3,
html[data-theme="dark"] .about-identity strong,
html[data-theme="dark"] .about-purpose-primary h3,
html[data-theme="dark"] .about-small-card h3,
html[data-theme="dark"] .about-architecture-modules h3,
html[data-theme="dark"] .identity-explanation h3,
html[data-theme="dark"] .identity-color-card strong,
html[data-theme="dark"] .jasc-about-name,
html[data-theme="dark"] .solution-signature span,
html[data-theme="dark"] .security-control-card h3,
html[data-theme="dark"] .security-authorization-main h3,
html[data-theme="dark"] .security-status-panel h3,
html[data-theme="dark"] .security-practice h3,
html[data-theme="dark"] .help-category-card h3,
html[data-theme="dark"] .help-faq-intro h3,
html[data-theme="dark"] .help-support-main h3,
html[data-theme="dark"] .help-support-status h3,
html[data-theme="dark"] .help-quick-item strong {
    color: var(--theme-dark-blue-text);
}

html[data-theme="dark"] .public-access-button,
html[data-theme="dark"] .button-primary,
html[data-theme="dark"] .architecture-node,
html[data-theme="dark"] .about-architecture-core {
    background: linear-gradient(135deg,#0c3b80,#006f78);
    color: #fff;
}

html[data-theme="dark"] .button-secondary {
    background: rgba(16,29,47,.74);
    border-color: var(--theme-dark-border);
    color: #dce8ff;
}

html[data-theme="dark"] .hero-logo,
html[data-theme="dark"] .public-brand img {
    filter: brightness(1.35) saturate(.90);
}

html[data-theme="dark"] .public-security,
html[data-theme="dark"] .security-data-section,
html[data-theme="dark"] .public-footer,
html[data-theme="dark"] .identity-version-dark {
    background: linear-gradient(135deg,#04102a,#020b1d);
}

html[data-theme="dark"] .help-faq-item[open] {
    border-color: rgba(39,198,187,.24);
    box-shadow: 0 14px 34px rgba(0,0,0,.14);
}

/* Ajustes responsive */
@media (max-width: 1120px) {
    .public-nav {
        gap: 14px;
    }

    .public-nav > a {
        font-size: 11px;
    }
}

@media (max-width: 820px) {
    .public-nav .theme-toggle {
        align-self: center;
        margin: 7px 0;
    }
}

@media (max-width: 600px) {
    .auth-theme-control {
        top: 14px;
        right: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: .01ms !important;
    }

    .theme-toggle,
    .theme-toggle::before,
    .theme-icon {
        transition-duration: .01ms !important;
    }
}

/*
|--------------------------------------------------------------------------
| Menú público móvil - Modo oscuro
|--------------------------------------------------------------------------
*/

@media (max-width: 820px) {

    html[data-theme="dark"]
    .public-nav {
        background:
            rgba(11, 23, 40, .97);

        border-color:
            rgba(255, 255, 255, .09);

        box-shadow:
            0 24px 60px
            rgba(0, 0, 0, .32);

        backdrop-filter:
            blur(24px);

        -webkit-backdrop-filter:
            blur(24px);
    }

    html[data-theme="dark"]
    .public-nav > a:not(.public-access-button) {
        color:
            #b5bfcd;

        border-radius:
            10px;

        transition:
            color var(--transition),
            background var(--transition);
    }

    html[data-theme="dark"]
    .public-nav > a:not(.public-access-button):hover,
    html[data-theme="dark"]
    .public-nav > a:not(.public-access-button).active {
        color:
            #ffffff;

        background:
            rgba(39, 198, 187, .08);
    }

}

/*
|--------------------------------------------------------------------------
| Accesibilidad - Modo oscuro
|--------------------------------------------------------------------------
*/

html[data-theme="dark"]
.accessibility-hero {
    background:
        linear-gradient(
            135deg,
            #07111f 0%,
            #0a1626 52%,
            #0d1a2c 100%
        );
}

html[data-theme="dark"]
.accessibility-hero-note,
html[data-theme="dark"]
.accessibility-visual,
html[data-theme="dark"]
.accessibility-preview,
html[data-theme="dark"]
.accessibility-principle,
html[data-theme="dark"]
.accessibility-preferences-main,
html[data-theme="dark"]
.accessibility-status-panel,
html[data-theme="dark"]
.accessibility-scope-card {
    background:
        var(--theme-dark-surface);

    border-color:
        var(--theme-dark-border);

    box-shadow:
        0 16px 42px
        rgba(0, 0, 0, .12);
}

html[data-theme="dark"]
.accessibility-preview-control,
html[data-theme="dark"]
.accessibility-preference-item {
    background:
        var(--theme-dark-surface-soft);

    border-color:
        var(--theme-dark-border);
}

html[data-theme="dark"]
.accessibility-preview-line {
    background:
        rgba(255, 255, 255, .08);
}

html[data-theme="dark"]
.accessibility-preview-focus {
    background:
        rgba(39, 198, 187, .07);

    border-color:
        rgba(39, 198, 187, .68);

    color:
        var(--theme-dark-blue-text);
}

html[data-theme="dark"]
.accessibility-visual-header strong,
html[data-theme="dark"]
.accessibility-preview-aa,
html[data-theme="dark"]
.accessibility-principle h3,
html[data-theme="dark"]
.accessibility-preferences-main h3,
html[data-theme="dark"]
.accessibility-status-panel h3,
html[data-theme="dark"]
.accessibility-scope-card h3 {
    color:
        var(--theme-dark-blue-text);
}

html[data-theme="dark"]
.accessibility-principle:hover {
    border-color:
        rgba(39, 198, 187, .27);

    box-shadow:
        var(--theme-dark-shadow);
}

html[data-theme="dark"]
.accessibility-disclaimer {
    background:
        rgba(39, 198, 187, .055);

    border-color:
        rgba(39, 198, 187, .15);
}

html[data-theme="dark"]
.accessibility-status-ready {
    color:
        #5ad8ce;

    background:
        rgba(39, 198, 187, .10);
}

html[data-theme="dark"]
.accessibility-status-progress {
    color:
        #ead178;

    background:
        rgba(216, 178, 40, .10);
}


/*
|--------------------------------------------------------------------------
| Legal - Privacidad - Modo oscuro
|--------------------------------------------------------------------------
*/

html[data-theme="dark"]
.legal-hero {
    background:
        linear-gradient(
            135deg,
            #07111f 0%,
            #0a1626 52%,
            #0d1a2c 100%
        );
}

html[data-theme="dark"]
.legal-project-notice,
html[data-theme="dark"]
.legal-index,
html[data-theme="dark"]
.legal-document,
html[data-theme="dark"]
.legal-data-card,
html[data-theme="dark"]
.legal-list-item,
html[data-theme="dark"]
.legal-pending {
    background:
        var(--theme-dark-surface);

    border-color:
        var(--theme-dark-border);

    box-shadow:
        0 16px 42px
        rgba(0, 0, 0, .10);
}

html[data-theme="dark"]
.legal-data-card,
html[data-theme="dark"]
.legal-list-item {
    background:
        var(--theme-dark-surface-soft);
}

html[data-theme="dark"]
.legal-index h2,
html[data-theme="dark"]
.legal-document-header h2,
html[data-theme="dark"]
.legal-section h3,
html[data-theme="dark"]
.legal-data-card h4,
html[data-theme="dark"]
.legal-pending h4 {
    color:
        var(--theme-dark-blue-text);
}

html[data-theme="dark"]
.legal-index a:hover {
    color: #ffffff;

    background:
        rgba(39, 198, 187, .07);
}

html[data-theme="dark"]
.legal-callout {
    background:
        rgba(39, 198, 187, .055);

    border-color:
        rgba(39, 198, 187, .15);
}

html[data-theme="dark"]
.legal-pending {
    border-style: dashed;
}

html[data-theme="dark"]
.legal-pending-label {
    color:
        #ead178;

    background:
        rgba(216, 178, 40, .10);
}


/*
|--------------------------------------------------------------------------
| Legal - Términos de uso - Modo oscuro
|--------------------------------------------------------------------------
*/

html[data-theme="dark"]
.terms-hero {
    background:
        linear-gradient(
            135deg,
            #07111f 0%,
            #0a1626 52%,
            #0d1a2c 100%
        );
}

html[data-theme="dark"]
.terms-hero-note,
html[data-theme="dark"]
.terms-highlight-card {
    background:
        var(--theme-dark-surface);

    border-color:
        var(--theme-dark-border);

    box-shadow:
        0 16px 42px
        rgba(0, 0, 0, .10);
}

html[data-theme="dark"]
.terms-highlight-card h4 {
    color:
        var(--theme-dark-blue-text);
}

html[data-theme="dark"]
.terms-warning {
    background:
        rgba(180, 35, 24, .08);

    border-color:
        rgba(255, 111, 97, .16);

    color:
        #f0a49c;
}

html[data-theme="dark"]
.terms-warning strong {
    color:
        #ffc0b9;
}


/*
|--------------------------------------------------------------------------
| Legal - Política de cookies - Modo oscuro
|--------------------------------------------------------------------------
*/

html[data-theme="dark"]
.cookies-hero {
    background:
        linear-gradient(
            135deg,
            #07111f 0%,
            #0a1626 52%,
            #0d1a2c 100%
        );
}

html[data-theme="dark"]
.cookies-hero-note,
html[data-theme="dark"]
.cookies-status-card {
    background:
        var(--theme-dark-surface);

    border-color:
        var(--theme-dark-border);

    box-shadow:
        0 16px 42px
        rgba(0, 0, 0, .10);
}

html[data-theme="dark"]
.cookies-status-card h4,
html[data-theme="dark"]
.cookies-table th {
    color:
        var(--theme-dark-blue-text);
}

html[data-theme="dark"]
.cookies-table {
    border-color:
        var(--theme-dark-border);
}

html[data-theme="dark"]
.cookies-table th,
html[data-theme="dark"]
.cookies-table td {
    border-color:
        var(--theme-dark-border);
}

html[data-theme="dark"]
.cookies-table th {
    background:
        var(--theme-dark-surface-soft);
}

html[data-theme="dark"]
.cookies-table td {
    background:
        var(--theme-dark-surface);

    color:
        var(--theme-dark-text-soft);
}

html[data-theme="dark"]
.cookies-chip-required {
    color:
        #5ad8ce;

    background:
        rgba(39, 198, 187, .10);
}

html[data-theme="dark"]
.cookies-chip-not-used {
    color:
        #b8c1cd;

    background:
        rgba(255, 255, 255, .07);
}

html[data-theme="dark"]
.cookies-browser-note {
    background:
        rgba(255, 255, 255, .025);

    border-color:
        rgba(255, 255, 255, .11);
}

/*
|--------------------------------------------------------------------------
| Legal - Aviso legal - Modo oscuro
|--------------------------------------------------------------------------
*/

html[data-theme="dark"]
.notice-hero {
    background:
        linear-gradient(
            135deg,
            #07111f 0%,
            #0a1626 52%,
            #0d1a2c 100%
        );
}

html[data-theme="dark"]
.notice-hero-note,
html[data-theme="dark"]
.notice-identity-card,
html[data-theme="dark"]
.notice-attribution {
    background:
        var(--theme-dark-surface);

    border-color:
        var(--theme-dark-border);

    box-shadow:
        0 16px 42px
        rgba(0, 0, 0, .10);
}

html[data-theme="dark"]
.notice-identity-card h4 {
    color:
        var(--theme-dark-blue-text);
}

html[data-theme="dark"]
.notice-attribution {
    background:
        rgba(39, 198, 187, .055);

    border-color:
        rgba(39, 198, 187, .15);
}
