/* Ingreso360 · css/auth.css — diseño de acceso (login + modal) */
/* =========================================================
   Ingreso360 · LOGIN
========================================================= */

/* ============== TOKENS (mismos que index.html) ============== */
:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #10B981;
    --primary-soft: #D1FAE5;
    --primary-bg: #ECFDF5;

    --secondary: #D97706;
    --secondary-dark: #B45309;
    --secondary-light: #F59E0B;
    --secondary-soft: #FEF3C7;
    --secondary-bg: #FFFBEB;

    --success: #10B981;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --info: #3B82F6;
    --info-bg: #EFF6FF;

    --bg: #F8FAFC;
    --bg-alt: #F1F5F9;
    --surface: #FFFFFF;
    --surface-alt: #F8FAFC;
    --border: #E2E8F0;
    --border-soft: #F1F5F9;

    --text: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.16);

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    --font-heading: 'Manrope', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
    --bg: #0F172A;
    --bg-alt: #1E293B;
    --surface: #1E293B;
    --surface-alt: #334155;
    --border: #334155;
    --border-soft: #1E293B;

    --text: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;

    --primary-soft: #064E3B;
    --primary-bg: #064E3B;
    --secondary-soft: #78350F;
    --secondary-bg: #78350F;

    --success-bg: #064E3B;
    --warning-bg: #78350F;
    --danger-bg: #7F1D1D;
    --info-bg: #1E3A8A;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.7);
}

/* ============== RESET ============== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }

:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; border-radius: var(--radius-xs); }

/* ============== LAYOUT LOGIN ============== */
.login-page {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ============== COLUMNA IZQUIERDA (BRANDING) ============== */
.login-brand {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 45%, #065F46 100%);
    padding: 4rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    min-height: 100vh;
}

/* Fondo decorativo */
.login-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(5,150,105,0.18) 0%, transparent 50%);
    pointer-events: none;
}

.login-brand::after {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.25), transparent 70%);
    filter: blur(40px);
}

.login-brand .content {
    position: relative;
    z-index: 2;
    max-width: 520px;
}

.login-brand .brand-mark {
    display: inline-grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.login-brand .badge-top {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.login-brand .badge-top .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--secondary-light);
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.login-brand h1 {
    color: #FFFFFF;
    font-size: clamp(2rem, 3vw, 2.75rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.login-brand h1 .highlight {
    background: linear-gradient(135deg, #FCD34D 0%, #059669 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-brand .subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
    line-height: 1.65;
    margin-bottom: 2.5rem;
    max-width: 440px;
}

.login-brand .features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.login-brand .feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
}

.login-brand .feature-item .icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #FCD34D;
    font-size: 1rem;
}

.login-brand .feature-item .text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    line-height: 1.55;
}

.login-brand .feature-item .text strong {
    color: #FFFFFF;
    display: block;
    font-weight: 700;
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
}

.login-brand .login-areas{display:flex;flex-wrap:wrap;gap:.45rem;margin:0 0 .8rem}
.login-brand .login-areas span{font-size:.75rem;font-weight:800;letter-spacing:.04em;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.25);color:#fff;border-radius:999px;padding:.32rem .8rem}
.login-brand .login-more{font-size:.85rem;opacity:.92;margin:0 0 1.5rem}
.login-brand .login-more a{color:#fff;font-weight:800;text-decoration:underline;text-underline-offset:2px}
.login-brand .stats-row {
    display: flex;
    gap: 2rem;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.login-brand .stats-row .stat .number {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: #FCD34D;
    line-height: 1.1;
}

.login-brand .stats-row .stat .label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    letter-spacing: 0.03em;
}

/* ============== COLUMNA DERECHA (FORMULARIO) ============== */
.login-form-col {
    flex: 0 0 500px;
    background: var(--surface);
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 10;
    min-height: 100vh;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.04);
}

/* Botón volver */
.btn-back {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-back:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
    transform: translateX(-3px);
}

/* Toggle tema */
.theme-toggle-login {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-alt);
    color: var(--text-secondary);
    font-size: 1rem;
    transition: var(--transition);
}

.theme-toggle-login:hover {
    background: var(--primary-bg);
    color: var(--primary);
    transform: rotate(15deg);
}

/* Header del form */
.form-header {
    margin-bottom: 2rem;
}

.form-header .form-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.form-header .form-brand .brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #FFFFFF;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.form-header .form-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.form-header .form-brand .brand-text strong {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    color: var(--text);
    letter-spacing: 0.05em;
}

.form-header .form-brand .brand-text span {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--primary);
    letter-spacing: 0.15em;
}

.form-header h2 {
    font-size: 1.75rem;
    color: var(--text);
    margin-bottom: 0.4rem;
    font-weight: 800;
}

.form-header p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Alerta */
.alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    display: none;
    align-items: flex-start;
    gap: 0.7rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.alert i { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }

.alert.show { display: flex; }

.alert-error { background: var(--danger-bg); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); border-left: 4px solid var(--success); }
.alert-info { background: var(--info-bg); color: var(--info); border-left: 4px solid var(--info); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 4px solid var(--warning); }

/* Formulario */
.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.form-group label .required { color: var(--danger); margin-left: 2px; }

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap .input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: var(--transition);
    z-index: 1;
}

.input-wrap input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 2.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.input-wrap input::placeholder { color: var(--text-muted); }

.input-wrap input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--primary-bg);
}

.input-wrap input:focus ~ .input-icon {
    color: var(--primary);
}

.input-wrap input.error {
    border-color: var(--danger);
    background: var(--danger-bg);
}

.input-wrap .toggle-pass {
    position: absolute;
    right: 0.75rem;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: var(--transition);
    z-index: 2;
}

.input-wrap .toggle-pass:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.field-error {
    display: none;
    font-size: 0.78rem;
    color: var(--danger);
    margin-top: 0.35rem;
    padding-left: 0.2rem;
    font-weight: 500;
}

.field-error.show { display: block; }

/* Fila opciones */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-wrap input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 5px;
    background: var(--surface-alt);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    flex-shrink: 0;
}

.checkbox-wrap input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-wrap input[type="checkbox"]:checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #FFFFFF;
    font-size: 0.65rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.link-forgot {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    transition: var(--transition);
}

.link-forgot:hover { color: var(--primary-dark); text-decoration: underline; }

/* Botón principal */
.btn-submit {
    width: 100%;
    padding: 0.95rem 1.5rem;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #FFFFFF;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-submit:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.4);
}

.btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

.btn-submit .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Separador */
.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.75rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Registro */
.register-prompt {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.register-prompt a {
    color: var(--primary);
    font-weight: 700;
    transition: var(--transition);
}

.register-prompt a:hover { color: var(--primary-dark); text-decoration: underline; }

/* WhatsApp */
.btn-whatsapp {
    width: 100%;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #FFFFFF;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.3);
    margin-top: 0.5rem;
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.45);
    color: #FFFFFF;
}

.help-block {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1rem;
    line-height: 1.6;
}

.help-block a {
    color: var(--primary);
    font-weight: 600;
}

/* Info adicional (footer del form) */
.form-footer-info {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.form-footer-info i { color: var(--primary); margin-right: 0.3rem; }

/* ============== RESPONSIVE ============== */
@media (max-width: 1024px) {
    .login-form-col { flex: 0 0 440px; padding: 3rem 2rem; }
}

@media (max-width: 900px) {
    .login-page {
        flex-direction: column;
        min-height: 100vh;
    }

    .login-form-col {
        flex: 0 0 auto;
        order: 1;
        min-height: auto;
        padding: 5rem 1.5rem 2rem;
        border-radius: 0 0 var(--radius-xl) var(--radius-xl);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    }

    .login-brand {
        order: 2;
        min-height: auto;
        padding: 2.5rem 1.5rem;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin-top: -1px;
    }

    .login-brand h1 { font-size: 1.75rem; }
    .login-brand .subtitle { font-size: 0.95rem; margin-bottom: 1.75rem; }
    .login-brand .stats-row { gap: 1.5rem; padding-top: 1.25rem; }
    .login-brand .stats-row .stat .number { font-size: 1.35rem; }
    .login-brand .features { gap: 0.85rem; margin-bottom: 1.75rem; }
}

@media (max-width: 480px) {
    .login-form-col { padding: 4.5rem 1.1rem 1.75rem; }
    .login-brand { padding: 1.75rem 1.1rem; }

    .form-header h2 { font-size: 1.5rem; }
    .form-header p { font-size: 0.85rem; }

    .input-wrap input {
        padding: 0.8rem 1rem 0.8rem 2.6rem;
        font-size: 0.9rem;
    }

    .login-brand h1 { font-size: 1.5rem; }
    .login-brand .badge-top { font-size: 0.65rem; padding: 0.3rem 0.8rem; }
    .login-brand .stats-row { flex-wrap: wrap; gap: 1rem; }
    .login-brand .stats-row .stat .number { font-size: 1.2rem; }
    .login-brand .stats-row .stat .label { font-size: 0.68rem; }

    .btn-back span { display: none; }
    .btn-back { padding: 0.5rem 0.75rem; }

    .form-options { gap: 0.5rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-alt);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Logo libre, sin recuadro · columna izquierda */
.login-brand .brand-logo {
    height: 56px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    background: none;
    border: 0;
    box-shadow: none;
    margin-bottom: 1.5rem;
    padding: 0;
}
/* Logo libre, sin recuadro · form header */
.form-header .form-brand .brand-logo {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    background: none;
    border: 0;
    box-shadow: none;
    padding: 0;
    flex-shrink: 0;
}
