/* ================================================================
   LOGIN.CSS — v3.0
   Paleta: Navy #152033 + Teal #00c896
   Sin dependencia de global.css — standalone completo
   ================================================================ */

/* ----------------------------------------------------------------
   1. VARIABLES DE TEMA
   El login siempre tiene fondo navy oscuro (no cambia con dark/light)
   Solo la card adapta sutilmente su contraste.
   ---------------------------------------------------------------- */
:root {
    /* Brand navy/teal */
    --bg:              #152033;
    --card-bg:         rgba(26, 42, 64, 0.82);
    --card-border:     rgba(0, 200, 150, 0.18);
    --card-shadow:     0 24px 64px -12px rgba(0,0,0,0.55),
                       0 0 0 1px rgba(0,200,150,0.08);

    --input-bg:        rgba(255,255,255,0.06);
    --input-bg-focus:  rgba(255,255,255,0.10);
    --input-border-focus: #00c896;

    --text-main:       #edf4ff;
    --text-dim:        #8aa0bc;
    --text-label:      #c8d8ea;

    --accent:          #00c896;
    --accent-hover:    #00b386;
    --accent-shadow:   rgba(0,200,150,0.28);

    --error-bg:        rgba(248,113,113,0.10);
    --error-border:    rgba(248,113,113,0.30);
    --error-text:      #fca5a5;

    --success-bg:      rgba(0,200,150,0.10);
    --success-border:  rgba(0,200,150,0.30);
    --success-text:    #00e5a0;

    --neon-glow:       rgba(0,200,150,0.45);

    /* Dimensiones */
    --card-radius:  28px;
    --input-radius: 14px;
    --btn-radius:   14px;
}

/* ----------------------------------------------------------------
   2. RESET Y BASE
   ---------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

/* ----------------------------------------------------------------
   3. FADE-IN DE PÁGINA
   ---------------------------------------------------------------- */
body {
    animation: pageIn 0.5s ease forwards;
}

@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------
   4. LOGO SUPERIOR
   ---------------------------------------------------------------- */
.logo-container {
    margin-bottom: 28px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.logo-link {
    display: inline-block;
    text-decoration: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                filter 0.3s ease;
    outline: none;
    cursor: default;
}

.logo-link:hover {
    transform: translateY(-3px) scale(1.02);
    filter: drop-shadow(0 8px 24px var(--neon-glow));
}

.header-logo {
    height: 96px;
    width: auto;
    display: block;
}

/* ----------------------------------------------------------------
   5. CARD DE LOGIN — glassmorphism sobre navy
   ---------------------------------------------------------------- */
.login-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--card-radius);
    padding: 44px 48px;
    width: 100%;
    max-width: 430px;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 10;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Línea de acento teal superior */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 0 0 4px 4px;
    opacity: 0.7;
}

/* ----------------------------------------------------------------
   6. BANNERS (ERROR / ÉXITO)
   ---------------------------------------------------------------- */
.error-banner,
.success-banner {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: none;
    text-align: center;
    line-height: 1.4;
    animation: bannerSlide 0.3s ease;
}

@keyframes bannerSlide {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.error-banner {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.success-banner {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

/* ----------------------------------------------------------------
   7. GRUPOS DE FORMULARIO
   ---------------------------------------------------------------- */
.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-label);
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ----------------------------------------------------------------
   8. INPUTS
   ---------------------------------------------------------------- */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .main-icon {
    position: absolute;
    left: 16px;
    color: var(--text-dim);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s ease;
}

.input-wrapper:focus-within .main-icon {
    color: var(--accent);
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    background: var(--input-bg);
    border: 1.5px solid rgba(0,200,150,0.12);
    border-radius: var(--input-radius);
    padding: 14px 48px 14px 46px;
    color: var(--text-main);
    font-size: 0.9375rem;
    font-family: inherit;
    outline: none;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    background: var(--input-bg-focus);
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.form-group input::placeholder {
    color: var(--text-dim);
    opacity: 0.7;
}

/* Autofill */
.form-group input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px rgba(26,42,64,0.95) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* ----------------------------------------------------------------
   9. TOGGLE CONTRASEÑA
   ---------------------------------------------------------------- */
.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease, background 0.2s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: var(--accent);
    background: var(--accent-shadow);
}

.toggle-password:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------
   10. FILA DE OPCIONES (recuérdame + link ayuda)
   ---------------------------------------------------------------- */
.options-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    gap: 10px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.forgot-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.forgot-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* ----------------------------------------------------------------
   11. BOTÓN DE ACCESO — teal
   ---------------------------------------------------------------- */
.btn-login {
    width: 100%;
    background: linear-gradient(135deg, #00c896 0%, #00b386 100%);
    color: #0d1b2a;
    border: none;
    border-radius: var(--btn-radius);
    padding: 15px 24px;
    font-size: 0.9375rem;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,200,150,0.30);
}

.btn-login::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn-login:hover:not(:disabled)::after {
    opacity: 1;
}

.btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,200,150,0.42);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 3px 12px rgba(0,200,150,0.25);
}

.btn-login:disabled {
    background: #2e4a6a;
    color: #5a7090;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-login:disabled::after {
    display: none;
}

/* Estado de carga */
.btn-spinner {
    display: none;
}

.btn-login.loading .btn-spinner {
    display: inline-block;
}

/* Estado de éxito */
.btn-login.success {
    background: linear-gradient(135deg, #00e5a0, #00c896);
}

/* Estado bloqueado */
.btn-login.locked {
    background: linear-gradient(135deg, #1e3250, #152033);
    color: #5a7090;
}

/* ----------------------------------------------------------------
   12. FOOTER DE LA CARD
   ---------------------------------------------------------------- */
.card-footer {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.footer-rights {
    font-size: 0.8rem;
    color: var(--text-dim);
    opacity: 0.6;
}

/* ----------------------------------------------------------------
   13. RESPONSIVE — TABLETS (≤1024px)
   ---------------------------------------------------------------- */
@media (max-width: 1024px) {
    .login-card {
        max-width: 400px;
        padding: 38px 40px;
    }
}

/* ----------------------------------------------------------------
   14. RESPONSIVE — TABLETS MEDIANAS (≤768px)
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
    body {
        padding: 20px 16px;
        justify-content: center;
        overflow-y: auto;
    }

    .login-card {
        width: 100%;
        max-width: 420px;
        padding: 32px 28px;
    }

    .header-logo {
        height: 78px;
    }
}

/* ----------------------------------------------------------------
   15. RESPONSIVE — SMARTPHONES (≤480px)
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
    body {
        justify-content: flex-start;
        padding-top: 32px;
        overflow-y: auto;
    }

    .logo-container {
        margin-bottom: 20px;
    }

    .header-logo {
        height: 70px;
    }

    .login-card {
        width: 100%;
        max-width: 100%;
        padding: 28px 20px;
        border-radius: 22px;
    }

    .login-card::before {
        left: 5%;
        right: 5%;
    }

    .btn-login {
        font-size: 0.875rem;
        padding: 14px 20px;
    }
}

/* ----------------------------------------------------------------
   16. RESPONSIVE — LANDSCAPE en móvil
   ---------------------------------------------------------------- */
@media (max-height: 600px) {
    body {
        overflow-y: auto;
        display: block;
        padding: 20px 16px;
    }

    .logo-container {
        margin-bottom: 16px;
    }

    .header-logo {
        height: 48px;
    }

    .login-card {
        margin: 0 auto;
        max-width: 400px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .options-row {
        margin-bottom: 20px;
    }
}

/* ----------------------------------------------------------------
   17. RESPONSIVE — ESCRITORIO GRANDE (≥1440px)
   ---------------------------------------------------------------- */
@media (min-width: 1440px) {
    .login-card {
        max-width: 440px;
        padding: 50px 52px;
    }
}

/* ----------------------------------------------------------------
   18. MONITORES 4K (≥2000px)
   ---------------------------------------------------------------- */
@media (min-width: 2000px) {
    .login-card {
        max-width: 460px;
    }

    .header-logo {
        height: 88px;
    }
}

/* ----------------------------------------------------------------
   19. REDUCIR MOVIMIENTO (accesibilidad)
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ----------------------------------------------------------------
   20. FOCUS VISIBLE (accesibilidad teclado)
   ---------------------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
