/* ============================================================
   Tema claro / oscuro del sitio público y de las pantallas de
   autenticación. La preferencia se guarda en la misma clave
   "darkMode" que utiliza el dashboard.
   ============================================================ */

/* Botón compacto de tema: un solo icono visible (luna o sol). */
.theme-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid #cfd6e2;
    border-radius: 50%;
    background-color: #ffffff;
    color: #122447;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease,
        border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    background-color: #eef3fb;
    color: #0d1a33;
    transform: translateY(-1px);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(18, 36, 71, 0.28);
    outline-offset: 2px;
}

/* Botón flotante de las pantallas de recuperación. */
.auth-theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1055;
}

/* Posición del botón dentro del nuevo login de dos columnas. */
.login-theme-toggle {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2;
}

/* ------------------------- Modo oscuro ------------------------- */
html.dark-mode {
    --primary-color: #4a7ab5;
    --dark-color: #15181d;
    --light-color: #e6e9ee;
    --accent-color: #2a3446;
    --text-color: #c9cdd4;
    --navy-blue: #0f1b30;

    --bs-body-bg: #171a1f;
    --bs-body-color: #c9cdd4;
    --bs-heading-color: #edf0f5;
    --bs-secondary-color: #9aa0ab;
    --bs-secondary-rgb: 154, 160, 171;
    --bs-tertiary-color: #8a8f99;
    --bs-tertiary-rgb: 138, 143, 153;
    --bs-border-color: #2a2e36;
    --bs-border-color-translucent: rgba(255, 255, 255, 0.1);
    --bs-link-color: #7fb2e8;
    --bs-link-hover-color: #a9c9ef;
}

html.dark-mode body {
    background-color: #171a1f;
    color: #c9cdd4;
}

html.dark-mode .theme-toggle {
    border-color: #3a404b;
    background-color: #20242b;
    color: #f2d15c;
}

html.dark-mode .theme-toggle:hover {
    background-color: #2a3039;
    color: #ffe58f;
}

html.dark-mode .theme-toggle:focus-visible {
    outline-color: rgba(242, 209, 92, 0.45);
}

/* Estructura general del sitio público. */
html.dark-mode .page-wrapper,
html.dark-mode .center-content {
    background-color: #171a1f !important;
}

html.dark-mode .sidebar-left,
html.dark-mode .sidebar-right {
    background-color: #14171a !important;
    border-color: #2a2e36 !important;
}

html.dark-mode .header-top {
    background-color: #20242b !important;
    border-bottom-color: #2a2e36;
}

/* El logo y el icono de login son PNG con fondo transparente. */
html.dark-mode .header-top img {
    filter: brightness(0) invert(1);
    opacity: 0.92;
}

html.dark-mode .header-top .btn-primary {
    color: #ffffff !important;
}

html.dark-mode .bg-navy {
    background-color: var(--navy-blue) !important;
}

html.dark-mode .bg-navy .nav-link {
    color: #e6e9ee !important;
}

html.dark-mode .bg-navy .nav-link:hover {
    background-color: #1b2b45 !important;
}

html.dark-mode .bg-navy .nav-link.is-active {
    color: #ffd84d !important;
}

html.dark-mode .bg-navy .form-control {
    border-color: #3a404b;
    background-color: #20242b;
    color: #e6e9ee;
}

html.dark-mode .bg-navy .form-control::placeholder {
    color: #9aa0ab;
}

html.dark-mode .search-btn {
    color: #111827 !important;
}

html.dark-mode .dropdown-menu {
    border-color: #2a2e36;
    background-color: #20242b !important;
}

html.dark-mode .dropdown-item {
    color: #e6e9ee !important;
}

html.dark-mode .dropdown-item:hover,
html.dark-mode .dropdown-item:focus {
    background-color: #2a3446 !important;
    color: #ffffff !important;
}

/* Portada, tarjetas y bloques de contenido. */
html.dark-mode .introduccion {
    background-color: #1c1f25;
}

html.dark-mode .hero-parte {
    background-color: #122447 !important;
}

html.dark-mode .hero-centro {
    background-color: #20242b !important;
}

html.dark-mode .card {
    border-color: #2a2e36;
    background-color: #20242b;
    color: #c9cdd4;
}

html.dark-mode .card-header {
    background-color: #15181d !important;
    color: #e6e9ee;
}

html.dark-mode .card-body {
    background-color: #20242b;
    color: #c9cdd4;
}

html.dark-mode .card-title {
    color: #edf0f5;
}

html.dark-mode .card-description,
html.dark-mode .text-black,
html.dark-mode .text-dark {
    color: #e6e9ee !important;
}

html.dark-mode .card-description.fade-text::after {
    background: linear-gradient(transparent, #20242b);
}

html.dark-mode .card_vista_previa:hover {
    box-shadow: 0 0 12px 1px #3a404b;
}

html.dark-mode .bg-light,
html.dark-mode .bg-white {
    background-color: #20242b !important;
}

html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3,
html.dark-mode h4,
html.dark-mode h5,
html.dark-mode h6 {
    color: #edf0f5;
}

html.dark-mode p {
    color: #c9cdd4;
}

html.dark-mode #seccion-grande {
    background-color: #171a1f !important;
}

html.dark-mode #seccion-publicacion .overlay {
    background-color: #20242b !important;
    color: #e6e9ee !important;
}

html.dark-mode .text-muted,
html.dark-mode .text-gray-600 {
    color: #9aa0ab !important;
}

html.dark-mode .form-control,
html.dark-mode .form-select {
    border-color: #3a404b;
    background-color: #171a1f;
    color: #e6e9ee;
}

html.dark-mode .form-control::placeholder {
    color: #9aa0ab;
}

html.dark-mode .form-control:focus,
html.dark-mode .form-select:focus {
    border-color: #7fb2e8;
    background-color: #171a1f;
    color: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(127, 178, 232, 0.2);
}

html.dark-mode footer {
    background-color: #15181d;
    color: #c9cdd4;
}

html.dark-mode footer a {
    color: #c9cdd4;
}

/* --------------------- Pantallas de autenticación --------------------- */
html.dark-mode .login-page {
    background-color: #171a1f;
}

html.dark-mode .login-form-side {
    background-color: #171a1f;
}

html.dark-mode .login_panel {
    border: 1px solid #2a2e36;
    background-color: #20242b;
    color: #e6e9ee;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

html.dark-mode .login_panel .form-control {
    border-color: #3a404b;
    background-color: #171a1f;
    color: #e6e9ee;
}

html.dark-mode .login_panel .form-control::placeholder {
    color: #9aa0ab;
}

html.dark-mode .login_panel .btn-terciario,
html.dark-mode .login_panel .btn-terciario:hover {
    color: #e6e9ee !important;
}

html.dark-mode .login_panel .btn-secundario {
    border-color: #4a7ab5 !important;
    background-color: #20242b !important;
    color: #e6e9ee !important;
}

html.dark-mode .login_panel .btn-secundario:hover {
    border-color: #7fb2e8 !important;
    background-color: #2a3446 !important;
    color: #ffffff !important;
}

html.dark-mode .login_panel hr.border-dark {
    border-color: #3a404b !important;
}

html.dark-mode .login_panel .form-text {
    color: #9aa0ab !important;
}
