/**
 * SAM DESIGN SYSTEM 2026 — LOGIN INSTITUCIONAL
 * Modernización Visual del Portal de Autenticación
 * Sistema Administrativo Municipal (SAM)
 */

@import url('sam_design_system.css');

html, body.login_page {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--sam-slate-800, #1e293b);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fondo con degradado ambiental y soporte para imagen municipal */
body.login_page {
    position: relative;
    background-color: #0f172a !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-attachment: fixed !important;
    overflow-x: hidden;
}

/* Velo institucional de alto contraste */
body.login_page::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.40) 0%, rgba(15, 34, 56, 0.78) 100%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1;
    pointer-events: none;
}

/* Contenedor principal centrado con Flexbox */
#wrapper {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
}

/* Reset y adaptación de #login_box heredado */
.login_page > #wrapper > #login_box,
#login_box {
    position: static !important;
    top: auto !important;
    left: auto !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 440px !important;
    height: auto !important;
    box-sizing: border-box;
}

/* Tarjeta Glassmorphic SAM 2026 */
.sam-login-card {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    border-radius: 20px !important;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.38),
                0 0 0 1px rgba(255, 255, 255, 0.4) inset !important;
    padding: 40px 36px 32px 36px !important;
    box-sizing: border-box;
    animation: samLoginCardFade 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes samLoginCardFade {
    0% {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Contenedor del Emblema Municipal */
.sam-login-emblem-wrap {
    text-align: center;
    margin-bottom: 14px;
}

.sam-login-emblem-badge {
    width: 88px;
    height: 88px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.18),
                0 0 0 4px rgba(255, 255, 255, 0.95);
    transition: transform 0.3s ease;
}

.sam-login-emblem-badge:hover {
    transform: scale(1.04);
}

.sam-login-emblem-img {
    max-width: 66px;
    max-height: 66px;
    object-fit: contain;
    display: block;
}

/* Tipografía y Marca Institucional */
.sam-login-brand {
    text-align: center;
    margin-bottom: 24px;
}

.sam-login-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f2238;
    margin: 0 0 4px 0;
    line-height: 1.15;
}

.sam-login-subtitle {
    font-size: 13.5px;
    font-weight: 500;
    color: #475569;
    margin: 0 0 8px 0;
}

.sam-login-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 9999px;
}

.sam-login-badge .badge-dot {
    color: #0284c7;
    font-size: 10px;
    line-height: 1;
}

/* Grupos de Entradas de Formulario */
.sam-form-group {
    margin-bottom: 18px;
    position: relative;
    text-align: left;
}

.sam-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

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

.sam-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    z-index: 2;
}

.sam-form-input {
    width: 100% !important;
    height: 48px !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 10px !important;
    padding: 0 16px 0 44px !important;
    font-size: 14.5px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

.sam-form-input.has-toggle {
    padding-right: 46px !important;
}

.sam-form-input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400 !important;
    opacity: 1 !important;
}

.sam-form-input:focus {
    border-color: #2563eb !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14) !important;
}

.sam-form-input:focus + .sam-input-icon,
.sam-input-wrapper:focus-within .sam-input-icon {
    color: #2563eb;
}

/* Botón Ojo Mostrar/Ocultar Contraseña */
.sam-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.2s, background-color 0.2s;
    z-index: 2;
}

.sam-password-toggle:hover {
    color: #1e293b;
    background-color: #f1f5f9;
}

/* Alertas de Error del Formulario */
.sam-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 500;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Botón Institucional de Ingreso */
.sam-btn-login {
    width: 100% !important;
    height: 48px !important;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.36) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-top: 8px !important;
    text-shadow: none !important;
}

.sam-btn-login:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%) !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.46) !important;
    transform: translateY(-1px);
}

.sam-btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
}

/* Enlace Olvido de Contraseña */
.sam-login-footer-actions {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.sam-forgot-link {
    color: #2563eb !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: color 0.2s, transform 0.2s !important;
}

.sam-forgot-link:hover {
    color: #1d4ed8 !important;
    text-decoration: underline !important;
    transform: translateY(-1px);
}

/* Pie de Página Institucional Fuera de la Tarjeta */
.sam-login-page-footer {
    position: relative;
    z-index: 2;
    margin-top: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12.5px;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sam-login-page-footer .footer-sep {
    color: rgba(255, 255, 255, 0.5);
}

/* Adaptación Responsive */
@media (max-width: 480px) {
    .sam-login-card {
        padding: 30px 22px 24px 22px !important;
        border-radius: 16px !important;
    }
    .sam-login-emblem-badge {
        width: 76px;
        height: 76px;
    }
    .sam-login-emblem-img {
        max-width: 56px;
        max-height: 56px;
    }
    .sam-login-title {
        font-size: 22px;
    }
}
