:root {
    --brand-green: #229761;
    --brand-green-hover: #1b7a4e;
    --brand-green-dark: #145a39;
    --brand-green-light: #4ade80;
    --brand-green-subtle: rgba(34, 151, 97, 0.14);
    --brand-gradient: linear-gradient(135deg, #1b7a4e 0%, #229761 50%, #2fba7b 100%);
    --hero-bg: radial-gradient(circle at 20% 15%, #0e3824 0%, #061a12 60%, #030f0a 100%);

    /* Theme Variables (Light Mode) */
    --bg-page: #f8fafc;
    --card-bg: #ffffff;
    --card-border: rgba(226, 232, 240, 0.85);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08), 0 0 1px 1px rgba(0, 0, 0, 0.03);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    --input-color: #0f172a;
    --input-focus-bg: #ffffff;
    --input-icon-color: #94a3b8;
    --divider-color: #f1f5f9;
    --toggle-theme-bg: #e2e8f0;
    --toggle-theme-color: #475569;
}

/* Dark Mode Theme Variables */
[data-bs-theme="dark"] {
    --bg-page: #090e17;
    --card-bg: rgba(15, 23, 42, 0.95);
    --card-border: rgba(255, 255, 255, 0.09);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.06);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --input-bg: #1e293b;
    --input-border: #334155;
    --input-color: #f8fafc;
    --input-focus-bg: #1e293b;
    --input-icon-color: #64748b;
    --divider-color: #1e293b;
    --toggle-theme-bg: #1e293b;
    --toggle-theme-color: #cbd5e1;
}

* {
    box-sizing: border-box;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.login-page-wrapper {
    min-height: 100vh;
    display: flex;
    width: 100%;
    flex: 1;
}

/* ========================================================
           PANEL IZQUIERDO: HERO CORPORATIVO DINÁMICO
        ======================================================== */
.hero-panel {
    position: relative;
    background: var(--hero-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3.5rem 4rem;
    overflow: hidden;
    z-index: 1;
}

/* Canvas interactivo de partículas / constelación */
#particlesCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.75;
}

/* Resplandores ambientales */
.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}

.ambient-orb-1 {
    top: -120px;
    left: -120px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(74, 222, 128, 0.24) 0%, transparent 70%);
    animation: pulseOrb1 12s ease-in-out infinite alternate;
}

.ambient-orb-2 {
    bottom: -100px;
    right: -100px;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(34, 151, 97, 0.32) 0%, transparent 70%);
    animation: pulseOrb2 14s ease-in-out infinite alternate;
}

@keyframes pulseOrb1 {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.18) translate(30px, 30px);
        opacity: 0.9;
    }
}

@keyframes pulseOrb2 {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.15) translate(-30px, -20px);
        opacity: 0.95;
    }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.45rem 1rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #d1fae5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.hero-badge .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--brand-green-light);
    box-shadow: 0 0 10px var(--brand-green-light);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
    }
}

/* Reloj en tiempo real del ERP */
.live-clock-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.45rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    color: #cbd5e1;
    font-weight: 500;
}

.hero-logo-box {
    background: rgba(255, 255, 255, 0.96);
    padding: 1.25rem 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hero-logo-box:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.4);
}

.hero-logo-box img {
    max-height: 52px;
    width: auto;
    object-fit: contain;
}

.hero-title {
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: #ffffff;
    margin-bottom: 1rem;
}

.hero-title .highlight-text {
    background: linear-gradient(120deg, #86efac, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: 1.05rem;
    color: #cbd5e1;
    line-height: 1.65;
    margin-bottom: 2.25rem;
    max-width: 530px;
}

/* Características clave con Micro-interacciones */
.feature-card {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    border-radius: 16px;
    padding: 1.05rem 1.25rem;
    margin-bottom: 0.95rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(8px);
    border-color: rgba(74, 222, 128, 0.35);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.feature-icon-wrapper {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.25) 0%, rgba(34, 151, 97, 0.45) 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86efac;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.feature-text-title {
    font-weight: 700;
    font-size: 0.975rem;
    color: #f8fafc;
    margin-bottom: 0.15rem;
}

.feature-text-desc {
    font-size: 0.825rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.45;
}

/* Métricas / Stats rápidos */
.hero-stats-row {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #86efac;
    letter-spacing: -0.01em;
}

.stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-footer {
    font-size: 0.85rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 2;
}

.server-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #d1fae5;
    font-size: 0.8rem;
    font-weight: 500;
}

.server-status-pill .status-bullet {
    width: 7px;
    height: 7px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
}

/* ========================================================
           PANEL DERECHO: FORMULARIO DE ACCESO Y CONTROLES
        ======================================================== */
.form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 1.5rem;
    background-color: var(--bg-page);
    position: relative;
}

/* Botón de cambio de tema Claro/Oscuro flotante */
.theme-switch-container {
    position: absolute;
    top: 1.5rem;
    right: 1.75rem;
    z-index: 10;
}

.btn-theme-toggle {
    background-color: var(--toggle-theme-bg);
    color: var(--toggle-theme-color);
    border: 1px solid var(--input-border);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-theme-toggle:hover {
    transform: scale(1.08);
    color: var(--brand-green);
    border-color: var(--brand-green);
}

/* Contenedor de la Tarjeta */
.form-container {
    width: 100%;
    max-width: 450px;
    padding: 2.75rem 2.5rem;
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
    position: relative;
    overflow: hidden;
    animation: fadeInCard 0.4s ease-out;
}

@keyframes fadeInCard {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Barra de progreso shimmer al enviar */
.shimmer-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #229761, #4ade80, #229761);
    background-size: 200% 100%;
    display: none;
    animation: shimmerSlide 1.2s infinite linear;
}

@keyframes shimmerSlide {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Logotipo móvil */
.mobile-logo-box {
    display: none;
    text-align: center;
    margin-bottom: 1.75rem;
}

.mobile-logo-box img {
    max-height: 46px;
    object-fit: contain;
}

.auth-header {
    margin-bottom: 2rem;
    text-align: left;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 0.925rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Grupos de campos */
.form-field-group {
    margin-bottom: 1.35rem;
    position: relative;
}

.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.45rem;
    letter-spacing: 0.01em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--input-icon-color);
    font-size: 1.2rem;
    pointer-events: none;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 4;
}

.custom-input {
    width: 100%;
    height: 52px;
    padding: 0.65rem 1rem 0.65rem 2.9rem;
    background-color: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 13px;
    font-size: 0.95rem;
    color: var(--input-color);
    font-weight: 500;
    transition: all 0.2s ease;
    outline: none;
}

.custom-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.custom-input:hover {
    border-color: #cbd5e1;
}

.custom-input:focus {
    background-color: var(--input-focus-bg);
    border-color: var(--brand-green);
    box-shadow: 0 0 0 4px var(--brand-green-subtle);
}

.input-wrapper:focus-within .input-icon {
    color: var(--brand-green);
    transform: scale(1.08);
}

.input-wrapper.has-clear .custom-input {
    padding-right: 2.75rem;
}

.input-wrapper.has-toggle .custom-input {
    padding-right: 3rem;
}

/* Botón de limpiar usuario rápido */
.btn-clear-input {
    position: absolute;
    right: 0.6rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
    font-size: 0.9rem;
}

.btn-clear-input:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.06);
}

/* Botón ver/ocultar contraseña */
.btn-toggle-pass {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--input-icon-color);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 5;
}

.btn-toggle-pass:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.06);
}

/* Notificación de Bloq Mayús */
.caps-warning {
    display: none;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.775rem;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fde68a;
    padding: 0.4rem 0.75rem;
    border-radius: 9px;
    margin-top: 0.5rem;
    animation: fadeInCaps 0.2s ease;
}

[data-bs-theme="dark"] .caps-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

@keyframes fadeInCaps {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fila de acciones (Recordar y Ayuda) */
.form-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    font-size: 0.85rem;
}

.form-check-input {
    cursor: pointer;
    width: 1.15em;
    height: 1.15em;
    border-radius: 4px;
    border-color: var(--input-border);
    background-color: var(--input-bg);
}

.form-check-input:checked {
    background-color: var(--brand-green);
    border-color: var(--brand-green);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--brand-green-subtle);
    border-color: var(--brand-green);
}

.form-check-label {
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 0.25rem;
    user-select: none;
}

.help-link {
    color: var(--brand-green);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.help-link:hover {
    color: var(--brand-green-hover);
    text-decoration: underline;
}

/* Botón Iniciar Sesión */
.btn-submit-login {
    width: 100%;
    height: 52px;
    background: var(--brand-gradient);
    border: none;
    border-radius: 13px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 10px 22px -3px rgba(34, 151, 97, 0.42);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.btn-submit-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.6s ease;
}

.btn-submit-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 28px -4px rgba(34, 151, 97, 0.52);
    filter: brightness(1.05);
}

.btn-submit-login:hover::before {
    left: 100%;
}

.btn-submit-login:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px -2px rgba(34, 151, 97, 0.4);
}

.btn-submit-login:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    transform: none;
}

/* Banner de Alerta / Error */
.alert-error-banner {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.85rem 1rem;
    border-radius: 13px;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: shakeAlert 0.4s ease;
}

[data-bs-theme="dark"] .alert-error-banner {
    background-color: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

@keyframes shakeAlert {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

.alert-error-banner .alert-icon {
    font-size: 1.25rem;
    line-height: 1;
    color: #dc2626;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-error-banner .btn-close-alert {
    background: transparent;
    border: none;
    color: inherit;
    margin-left: auto;
    cursor: pointer;
    padding: 0 0 0 0.5rem;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.alert-error-banner .btn-close-alert:hover {
    opacity: 1;
}

/* Alerta de conexión caída */
.network-offline-banner {
    display: none;
    background: #fff7ed;
    border: 1px solid #ffedd5;
    color: #c2410c;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.825rem;
    margin-bottom: 1.25rem;
    align-items: center;
    gap: 0.5rem;
}

[data-bs-theme="dark"] .network-offline-banner {
    background: rgba(234, 88, 12, 0.15);
    border-color: rgba(234, 88, 12, 0.3);
    color: #fdba74;
}

/* Pie del formulario / Sello de seguridad */
.auth-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--divider-color);
    text-align: center;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 500;
}

.security-badge i {
    color: var(--brand-green);
}

/* Modal Styles */
.modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.modal-header {
    border-bottom: 1px solid var(--divider-color);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.support-contact-box {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 14px;
    padding: 1.2rem;
    margin-top: 1rem;
}

.support-contact-box .contact-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.75rem;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.support-contact-box .contact-row:last-child {
    margin-bottom: 0;
}

.support-contact-box .contact-row i {
    color: var(--brand-green);
    font-size: 1.15rem;
}

.copy-email-btn {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.2s ease;
}

.copy-email-btn:hover {
    color: var(--brand-green);
    border-color: var(--brand-green);
}

/* Adaptación Móvil */
@media (max-width: 991.98px) {
    .hero-panel {
        display: none;
    }

    .form-panel {
        padding: 2.5rem 1.25rem;
        min-height: 100vh;
    }

    .mobile-logo-box {
        display: block;
    }

    .form-container {
        padding: 2.25rem 1.75rem;
        border-radius: 20px;
    }

    .auth-header {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .form-panel {
        padding: 1.25rem 0.85rem;
    }

    .form-container {
        padding: 1.75rem 1.25rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .form-actions-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}