/* --- AUTENTICACIÓN (LOGIN & PASSWORD RECOVERY) --- */

/* Normalización de scroll y canvas en vistas de autenticación:
   Evita riel forzado y barras de desplazamiento cuando el contenido cabe en la ventana */
html:has(.auth-page),
body:has(.auth-page),
html.auth-html,
body.auth-body {
    overflow-y: auto !important;
    scrollbar-gutter: auto !important;
    min-height: 100%;
}

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.25rem 1rem;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 40%, #e6f7ef 100%);
    position: relative;
    box-sizing: border-box;
}

/* Imagen de fondo del Palacio Municipal alterada con tonos de verde institucional */
.auth-page::before {
    content: '';
    position: fixed;
    inset: -10px;
    background-image: var(--bg-palacio, url('../../imagenes/bg1.jpg'));
    background-size: cover;
    background-position: center 35%;
    background-repeat: no-repeat;
    filter: grayscale(100%) contrast(1.1) brightness(1.04) blur(5px);
    mix-blend-mode: multiply;
    opacity: 0.22;
    pointer-events: none;
    z-index: 0;
}

/* Viñeta degradada verde esmeralda para armonizar la atmósfera institucional */
.auth-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, rgba(16, 185, 129, 0.14) 0%, rgba(4, 120, 87, 0.24) 100%);
    pointer-events: none;
    z-index: 0;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    margin: auto 0;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 35px -8px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(5, 150, 105, 0.05);
    padding: 1.85rem 1.75rem;
    animation: fadeIn 0.4s var(--ease-out);
    box-sizing: border-box;
    width: 100%;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.35rem;
}

.auth-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 0.75rem;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(5, 150, 105, 0.2));
}

.auth-logo.auth-logo-dark {
    display: none;
}

[data-theme="dark"] .auth-logo.auth-logo-light {
    display: none;
}

[data-theme="dark"] .auth-logo.auth-logo-dark {
    display: block;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-900);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    line-height: 1.25;
}

.auth-subtitle {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* Formularios de Autenticación */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.9rem;
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.btn-eye-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0.35rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.btn-eye-toggle:hover {
    color: var(--primary-600);
}

.btn-eye-toggle svg {
    width: 18px;
    height: 18px;
}

.form-control {
    width: 100%;
    padding: 0.68rem 0.95rem 0.68rem 2.65rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.form-control:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary-600);
}

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.84rem;
    margin-top: -0.15rem;
}

.auth-link {
    color: var(--primary-700);
    font-weight: 600;
    transition: color var(--transition-fast);
}

.auth-link:hover {
    color: var(--primary-900);
    text-decoration: underline;
}

/* Fila de botones de acción */
.auth-btn-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    width: 100%;
}

.auth-btn-row .btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    box-sizing: border-box;
}

/* Acceso al simulador en entorno de desarrollo */
.auth-dev-simulator {
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-subtle);
    text-align: center;
}

.auth-footer {
    text-align: center;
    margin-top: 1.15rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

@media (max-width: 480px) {
    .auth-page {
        padding: 0.75rem 0.75rem;
    }

    .auth-card {
        padding: 1.25rem 1.1rem;
        border-radius: var(--radius-lg);
    }

    .auth-header {
        margin-bottom: 0.95rem;
    }

    .auth-logo {
        width: 46px;
        height: 46px;
        margin-bottom: 0.45rem;
    }

    .auth-title {
        font-size: 1.12rem;
        margin-bottom: 0.15rem;
    }

    .auth-subtitle {
        font-size: 0.78rem;
    }

    .auth-form {
        gap: 0.8rem;
    }

    .form-group {
        gap: 0.25rem;
    }

    .form-label {
        font-size: 0.8rem;
    }

    .form-control {
        padding: 0.6rem 0.8rem 0.6rem 2.45rem;
        font-size: 0.9rem;
    }

    .input-icon {
        left: 0.8rem;
        width: 15px;
        height: 15px;
    }

    .auth-card .btn-lg {
        padding: 0.65rem 1rem;
        font-size: 0.92rem;
    }

    .auth-btn-row {
        flex-direction: column-reverse;
        gap: 0.65rem;
        margin-top: 0.25rem;
    }

    .auth-btn-row .btn {
        width: 100%;
        flex: none;
        padding: 0.7rem 1rem;
        font-size: 0.92rem;
    }

    .auth-dev-simulator {
        margin-top: 0.65rem;
        padding-top: 0.55rem;
    }

    .auth-footer {
        margin-top: 0.85rem;
        font-size: 0.74rem;
    }
}

/* --- ADAPTACIÓN A MODO OSCURO (AUTH) --- */
[data-theme="dark"] .auth-page {
    background: #064e3b;
}

[data-theme="dark"] .auth-page::before {
    background-image: var(--bg-palacio, url('../../imagenes/bg1.jpg'));
    filter: contrast(1.2) brightness(0.65) saturate(0.6) blur(5px);
    opacity: 0.35;
    mix-blend-mode: luminosity;
}

[data-theme="dark"] .auth-page::after {
    background: radial-gradient(circle at 50% 20%, rgba(16, 185, 129, 0.28) 0%, rgba(6, 78, 59, 0.75) 75%, rgba(2, 44, 34, 0.92) 100%);
}

[data-theme="dark"] .auth-card {
    background: rgba(30, 41, 59, 0.94);
    border-color: rgba(51, 65, 85, 0.85);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(16, 185, 129, 0.12);
}

[data-theme="dark"] .auth-title {
    color: #ffffff;
}

[data-theme="dark"] .auth-link {
    color: var(--primary-400);
}

[data-theme="dark"] .auth-link:hover {
    color: var(--primary-300);
}

[data-theme="dark"] .btn-eye-toggle {
    color: #e2e8f0;
}

[data-theme="dark"] .btn-eye-toggle:hover {
    color: #ffffff;
}
