/* ─────────────────────────────────────────────────────────────────────────
   LOGIN - MESA DE SOPORTE TÉCNICO
   Responsive design optimizado para móviles, tablets y desktop
   ───────────────────────────────────────────────────────────────────────── */

:root {
    --color-primary: #1a1a1a;
    --color-primary-hover: #2d2d35;
    --color-primary-dark: #0f0f12;
    --color-accent: #b71c1c;
    --color-accent-light: #c82828;
    --color-accent-dark: #8b0000;
    --color-error: #dc2626;
    --color-success: #059669;
    --color-border: #d8e2db;
    --color-border-dark: #c1cfc7;
    --color-bg: #f8faf9;
    --color-text: #212529;
    --color-text-secondary: #495057;
    --color-text-muted: #6c757d;
    --color-white: #ffffff;
    --color-card: #ffffff;
    --color-primary-card: #581c1c;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 32px 80px rgba(0, 0, 0, 0.32), 0 8px 24px rgba(0, 0, 0, 0.14);
    
    --transition-fast: 0.15s ease;
    --transition-base: 0.22s ease;
    --transition-slow: 0.35s ease;
}

/* ─── RESET BASE ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* ────────────────────────────────────────────────────────────────────
   SECCIÓN HERO
   ──────────────────────────────────────────────────────────────────── */

.login-hero {
    position: relative;
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 0;
}

.login-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 25%;
    background-repeat: no-repeat;
    z-index: 0;
    will-change: transform;
}

.login-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg,
        rgba(15, 15, 18, 0.96) 0%,
        rgba(30, 30, 36, 0.92) 35%,
        rgba(30, 30, 36, 0.75) 65%,
        rgba(0, 0, 0, 0.45) 100%);
    z-index: 1;
}

.login-hero-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 40px 20px;
}

/* ────────────────────────────────────────────────────────────────────
   SECCIÓN DE TEXTO (IZQUIERDA)
   ──────────────────────────────────────────────────────────────────── */

.login-text-section {
    color: var(--color-white);
    margin-bottom: 40px;
}

.login-text-content {
    max-width: 500px;
}

.login-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 12px;
    display: block;
}

.login-h1 {
    font-size: clamp(1.75rem, 6vw, 3.2rem);
    font-weight: 900;
    color: var(--color-white);
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -0.025em;
}

.login-h1 em {
    font-style: italic;
    color: var(--color-accent-light);
    display: block;
}

.login-desc {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 24px;
}

.login-desc strong {
    color: var(--color-accent-light);
    display: block;
    margin-top: 8px;
}

/* ────────────────────────────────────────────────────────────────────
   CARACTERÍSTICAS (Features)
   ──────────────────────────────────────────────────────────────────── */

.login-features {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 32px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    opacity: 0;
    animation: slideInLeft 0.6s ease forwards;
    animation-delay: calc(var(--index, 0) * 0.1s);
}

.feature-icon {
    width: 20px;
    height: 20px;
    color: var(--color-accent-light);
    flex-shrink: 0;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ────────────────────────────────────────────────────────────────────
   TARJETA DE FORMULARIO (Actualizada a fondo blanco)
   ──────────────────────────────────────────────────────────────────── */

.login-form-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.login-card {
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
    
}

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

.login-card-header {
    background: var(--color-white); /* Fondo blanco en lugar de gradiente oscuro */
    color: var(--color-text);
    padding: 36px 32px 10px;
    border-bottom: none;
    text-align: center;
}

.login-card-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
    color: var(--color-text); /* Texto oscuro para contrastar con el blanco */
}

.login-card-header p {
    font-size: 0.8rem;
    color: var(--color-text-muted); /* Gris atenuado */
}

.login-card-body {
    padding: 20px 32px 36px;
}

/* ────────────────────────────────────────────────────────────────────
   FOOTER INSTITUCIONAL (NUEVO)
   ──────────────────────────────────────────────────────────────────── */

/* ────────────────────────────────────────────────────────────────────
   FOOTER INSTITUCIONAL MODERNO (Glassmorphism & Flexbox)
   ──────────────────────────────────────────────────────────────────── */

.login-footer-modern {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(15, 15, 18, 0.65); /* Transparencia más limpia */
    backdrop-filter: blur(12px); /* Efecto cristal / Glassmorphism */
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1px 0;
    z-index: 10;
}

.footer-modern-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

/* Identidad Izquierda */
.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-title {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
    letter-spacing: 0.06em;
}

.footer-divider {
    width: 4px;
    height: 4px;
    background-color: var(--color-accent);
    border-radius: 50%;
}

.footer-subtitle {
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Crédito Central */
.footer-info {
    text-align: center;
    letter-spacing: 0.01em;
    
}

/* Enlaces Derecha */
.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 20px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: color 0.25s ease;
    position: relative;
    padding-bottom: 2px;
}

.footer-links a:hover {
    color: var(--color-white);
}

/* Animación sutil de subrayado al pasar el cursor */
.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 0;
    background-color: var(--color-accent-light);
    transition: width 0.3s ease;
}

.footer-links a:hover::after {
    width: 100%;
}

/* Comportamiento en Monitores (Desktop) */
@media (min-width: 992px) {
    .footer-modern-inner {
        flex-direction: row;
        justify-content: space-between;
        gap: 0;
    }
    
    .footer-info {
        text-align: left;
    }
}

/* Comportamiento en Móviles */
@media (max-width: 767px) {
    .login-hero {
        padding-bottom: 140px; /* Ajuste para el contenido apilado */
    }
    .login-footer-modern {
        padding: 20px 0;
    }
    .footer-links {
        gap: 14px;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ────────────────────────────────────────────────────────────────────
   ALERTAS
   ──────────────────────────────────────────────────────────────────── */

.login-alert {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}

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

.login-alert-error {
    background-color: rgba(220, 38, 38, 0.1);
    border-left: 4px solid var(--color-error);
    color: var(--color-error);
}

.login-alert svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-content strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.alert-content p {
    margin: 0;
    opacity: 0.9;
}

/* ────────────────────────────────────────────────────────────────────
   FORMULARIO
   ──────────────────────────────────────────────────────────────────── */

.login-form {
    width: 100%;
}

.form-group {
    margin-bottom: 18px;
    transition: var(--transition-base);
}

.form-group.has-error .form-control {
    border-color: var(--color-error);
    background-color: rgba(220, 38, 38, 0.04);
}

.form-group.has-error .form-control:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    border-color: var(--color-error);
}

/* ── LABELS ── */

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 4px;
}

.form-label span:first-child {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.required {
    color: var(--color-error);
    font-weight: 700;
}

/* ── INPUT WRAPPER ── */

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

.input-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
    z-index: 1;
    flex-shrink: 0;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    background-color: var(--color-white);
    outline: none;
    transition: all var(--transition-base);
    font-family: inherit;
    letter-spacing: 0.3px;
}

.form-control::placeholder {
    color: #b8c2bc;
    font-weight: 400;
}

.form-control:hover {
    border-color: var(--color-border-dark);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.08);
    background-color: var(--color-white);
}

.form-control:focus ~ .input-icon {
    color: var(--color-primary);
}

/* ── TOGGLE PASSWORD ── */

.toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    z-index: 2;
}

.toggle-password:hover {
    color: var(--color-primary);
}

.toggle-password svg {
    width: 18px;
    height: 18px;
    transition: opacity var(--transition-fast);
}

.icon-eye-off {
    display: none;
}

.toggle-password.active .icon-eye {
    display: none;
}

.toggle-password.active .icon-eye-off {
    display: block;
}

/* ── HINT ── */

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 5px;
    line-height: 1.4;
    display: block;
}

/* ────────────────────────────────────────────────────────────────────
   BOTÓN SUBMIT
   ──────────────────────────────────────────────────────────────────── */

.btn-submit {
    width: 100%;
    padding: 14px 20px;
    margin-top: 8px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    color: var(--color-white);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.btn-submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-hover) 0%, var(--color-primary-dark) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-submit svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-base);
}

.btn-submit:hover:not(:disabled) svg {
    transform: translateX(3px);
}

.btn-submit.submitting {
    pointer-events: none;
}

.btn-submit.submitting span {
    opacity: 0;
    position: absolute;
}

.btn-submit.submitting::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ────────────────────────────────────────────────────────────────────
   FOOTER FORMULARIO
   ──────────────────────────────────────────────────────────────────── */

.form-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.link-recover {
    font-size: 0.8rem;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.link-recover:hover {
    color: var(--color-accent-light);
    text-decoration: underline;
}

.form-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

.form-security svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ════════════════════════════════════════════════════════════════════ */

/* ── TABLETS (768px+) ── */
@media (min-width: 768px) {
    .login-hero-inner {
        padding: 50px 30px;
    }

    .login-card-body {
        padding: 32px 28px;
    }

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

/* ── LARGE SCREENS (992px+) ── */
@media (min-width: 992px) {
    .login-hero {
        min-height: calc(100vh - 90px);
        padding: 0;
    }

    .login-hero-inner {
        padding: 70px 60px;
    }

    .login-form-section {
        justify-content: flex-end;
    }

    .login-text-section {
        margin-bottom: 0;
        padding-right: 40px;
    }

    .login-features {
        margin-top: 40px;
        gap: 16px;
    }

    .login-card {
        max-width: 480px;
        box-shadow: var(--shadow-xl);
    }
}

/* ── EXTRA LARGE SCREENS (1200px+) ── */
@media (min-width: 1200px) {
    .login-hero-inner {
        padding: 80px 80px;
    }

    .login-text-content {
        max-width: 520px;
    }

    .login-h1 {
        margin-bottom: 24px;
    }

    .login-card-body {
        padding: 36px 32px;
    }
}

/* ────────────────────────────────────────────────────────────────────
   OPTIMIZACIONES MÓVILES
   ──────────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    /* Hero container */
    .login-hero {
        min-height: auto;
        padding: 30px 0;
    }

    .login-hero-inner {
        padding: 30px 16px;
    }

    /* Formulario en móvil: centrado */
    .login-form-section {
        justify-content: center;
        margin-bottom: 30px;
    }

    /* Texto */
    .login-text-section {
        margin-bottom: 0;
        text-align: center;
    }

    .login-text-content {
        max-width: 100%;
    }

    .login-h1 {
        font-size: 1.5rem;
        margin-bottom: 16px;
    }

    .login-eyebrow {
        font-size: 0.65rem;
        margin-bottom: 10px;
    }

    .login-desc {
        font-size: 0.8rem;
        margin-bottom: 20px;
    }

    /* Features */
    .login-features {
        display: none;
    }

    /* Tarjeta */
    .login-card {
        max-width: 100%;
        border-radius: 12px;
    }

    .login-card-header {
        padding: 24px 20px 20px;
    }

    .login-card-header h2 {
        font-size: 1.2rem;
    }

    .login-card-body {
        padding: 24px 20px;
    }

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

    .form-control {
        font-size: 16px; /* Prevenir zoom automático */
        padding: 13px 14px 13px 40px;
        min-height: 48px; /* Touch target mínimo */
    }

    .input-icon {
        left: 14px;
    }

    .toggle-password {
        right: 14px;
        padding: 6px;
    }

    .toggle-password svg {
        width: 16px;
        height: 16px;
    }

    /* Botón */
    .btn-submit {
        padding: 13px 18px;
        font-size: 0.8rem;
        min-height: 48px;
        gap: 8px;
    }

    .btn-submit svg {
        width: 16px;
        height: 16px;
    }

    /* Alerta */
    .login-alert {
        font-size: 0.8rem;
        padding: 12px 14px;
        gap: 10px;
    }

    .login-alert svg {
        width: 16px;
        height: 16px;
    }
}

/* ── ORIENTACIÓN HORIZONTAL MÓVIL (568px) ── */
@media (max-width: 568px) and (orientation: landscape) {
    .login-hero {
        min-height: calc(100vh - 60px);
    }

    .login-h1 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }

    .login-features {
        display: none;
    }

    .login-card-body {
        padding: 20px;
    }
}

/* ────────────────────────────────────────────────────────────────────
   ACCESIBILIDAD
   ──────────────────────────────────────────────────────────────────── */

/* Focus visible para navegación por teclado */
.form-control:focus-visible,
.btn-submit:focus-visible,
.link-recover:focus-visible {
    outline: 2px solid var(--color-accent-light);
    outline-offset: 2px;
}

/* Reducir movimiento para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .login-feature {
        animation: none;
        opacity: 1;
    }

    .login-card {
        animation: none;
    }
}

/* Tema oscuro (si el dispositivo lo prefiere) */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0f0f12;
        --color-white: #f8faf9;
        --color-text: #e5e7eb;
        --color-text-secondary: #b8c2bc;
        --color-border: #374151;
    }

    .form-control {
        background-color: #1f2937;
        color: #e5e7eb;
    }

    .form-control::placeholder {
        color: #6b7280;
    }

    .form-control:focus {
        background-color: #1f2937;
    }

    .login-card {
        background: #1f2937;
        color: #e5e7eb;
    }

    .login-card-header {
        background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
    }
}

/* ────────────────────────────────────────────────────────────────────
   PRINT STYLES
   ──────────────────────────────────────────────────────────────────── */

@media print {
    .login-hero-bg,
    .btn-submit,
    .form-security {
        display: none;
    }
}

.btn-google-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 13px 20px;
    background-color: var(--color-white);
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none !important;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    cursor: pointer;
}

.btn-google-oauth:hover {
    background-color: #f1f3f2;
    border-color: var(--color-border-dark);
    color: var(--color-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-google-oauth svg {
    flex-shrink: 0;
}
