/* ==========================================================================
   TP08 FACTURACIÓN - SISTEMA DE LOGIN CORPORATIVO RESPONSIVE
   ========================================================================== */

/* 1.0 Variables Globales y Paleta de Colores de Marca */
:root {
    --brand-primary: #f96332;
    --brand-primary-hover: #d4451a;
    --brand-primary-light: rgba(249, 99, 50, 0.15);
    --brand-primary-glow: rgba(249, 99, 50, 0.35);

    --bg-dark: #090d16;
    --bg-surface: #111827;
    --bg-surface-elevated: rgba(17, 24, 39, 0.75);
    --bg-input: rgba(15, 23, 42, 0.65);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(249, 99, 50, 0.4);
    --border-focus: #f96332;

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --status-success: #10b981;
    --status-success-bg: rgba(16, 185, 129, 0.12);
    --status-success-border: rgba(16, 185, 129, 0.3);

    --status-error: #ef4444;
    --status-error-bg: rgba(239, 68, 68, 0.12);
    --status-error-border: rgba(239, 68, 68, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.65);
    --transition-base: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2.0 Reseteo y Estilos Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    line-height: 1.5;
}

/* 3.0 Fondos Ambientales y Luces Dinámicas (Mesh Glow) */
.ambient-glow-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.45;
    animation: orbFloat 14s infinite alternate ease-in-out;
}

.ambient-orb-primary {
    top: -10%;
    left: -5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--brand-primary) 0%, transparent 70%);
}

.ambient-orb-secondary {
    bottom: -15%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #2563eb 0%, transparent 70%);
    animation-delay: -7s;
}

.ambient-orb-center {
    top: 35%;
    left: 40%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
    opacity: 0.2;
    animation-duration: 20s;
}

@keyframes orbFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(35px, 45px) scale(1.08);
    }
    100% {
        transform: translate(-25px, 20px) scale(0.95);
    }
}

/* 4.0 Contenedor Principal (Split Screen) */
.login-viewport {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1120px;
    margin: 24px auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
}

.login-layout {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    width: 100%;
    background: var(--bg-surface-elevated);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* 5.0 Sección Hero Corporativo (Izquierda en Desktop) */
.hero-panel {
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.95) 0%, rgba(9, 13, 22, 0.95) 100%);
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.hero-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-primary) 0%, #ff8a50 50%, #2563eb 100%);
}

.hero-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
}

.brand-icon-box {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px var(--brand-primary-glow);
    color: #ffffff;
    flex-shrink: 0;
}

.brand-icon-box svg {
    width: 26px;
    height: 26px;
}

.brand-info-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--brand-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero-body {
    margin: 20px 0 36px;
}

.hero-headline {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 32px;
}

/* 5.1 Lista de Capacidades del Sistema */
.features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.feature-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-primary-light);
    border: 1px solid rgba(249, 99, 50, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary);
    flex-shrink: 0;
}

.feature-icon-wrapper svg {
    width: 18px;
    height: 18px;
}

/* 5.2 Pie del Panel Hero */
.hero-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.status-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-success);
    position: relative;
}

.status-indicator-dot::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.4);
    animation: pulseRing 2s infinite ease-out;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.6);
        opacity: 1;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.system-version {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* 6.0 Sección de Formulario de Login (Derecha en Desktop) */
.form-panel {
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(17, 24, 39, 0.5);
    position: relative;
}

.form-header {
    margin-bottom: 32px;
}

.form-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 7.0 Alertas y Mensajes de Feedback */
.alert-box {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: alertSlideDown 0.3s ease-out;
}

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

.alert-error {
    background-color: var(--status-error-bg);
    border: 1px solid var(--status-error-border);
    color: #fca5a5;
}

.alert-success {
    background-color: var(--status-success-bg);
    border: 1px solid var(--status-success-border);
    color: #86efac;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-content {
    flex: 1;
}

.alert-error-list {
    list-style: disc;
    margin-left: 18px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 8.0 Campos de Formulario (Input Groups) */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.field-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.input-icon-left {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-base);
}

.form-input {
    width: 100%;
    height: 52px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0 48px 0 48px;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-base);
    font-family: inherit;
}

.form-input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.form-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(15, 23, 42, 0.9);
    box-shadow: 0 0 0 4px var(--brand-primary-light);
}

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

/* 8.1 Botón de Alternar Contraseña */
.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
}

.password-toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.password-toggle-btn:focus {
    outline: 2px solid var(--brand-primary);
}

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

/* 8.2 Opciones Adicionales del Formulario */
.form-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -4px;
    font-size: 0.85rem;
}

.remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
}

.custom-checkbox {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

.support-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-base);
}

.support-link:hover {
    color: #ff8a50;
    text-decoration: underline;
}

/* 9.0 Botón de Envío Principal */
.btn-submit {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: 0 4px 14px var(--brand-primary-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
}

.btn-submit::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transition: left 0.6s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 99, 50, 0.5);
}

.btn-submit:hover::after {
    left: 100%;
}

.btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--brand-primary-glow);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.btn-submit:hover .btn-icon {
    transform: translateX(3px);
}

.btn-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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

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

.btn-submit.is-loading .btn-text,
.btn-submit.is-loading .btn-icon {
    display: none;
}

/* 10.0 Pie de Formulario y Avisos de Seguridad */
.form-footer-notice {
    margin-top: 32px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.security-badge svg {
    width: 14px;
    height: 14px;
    color: var(--status-success);
}

/* ==========================================================================
   11.0 ADAPTABILIDAD RESPONSIVE (MEDIA QUERIES)
   ========================================================================== */

/* Tablets y Laptops Pequeñas (Pantallas intermedias < 992px) */
@media (max-width: 991px) {
    .login-layout {
        grid-template-columns: 1fr;
        max-width: 520px;
    }

    .hero-panel {
        padding: 36px 32px 28px;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }

    .hero-headline {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }

    .hero-description {
        display: none; /* Simplificado para pantallas compactas */
    }

    .features-list {
        display: none; /* Simplificado para evitar scroll excesivo */
    }

    .hero-footer {
        display: none;
    }

    .form-panel {
        padding: 40px 32px;
    }
}

/* Móviles (< 480px) */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
    }

    .login-viewport {
        margin: 12px 0;
        padding: 0;
    }

    .login-layout {
        border-radius: var(--radius-md);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .hero-panel {
        padding: 24px 20px 20px;
    }

    .brand-title {
        font-size: 1.1rem;
    }

    .hero-headline {
        font-size: 1.35rem;
    }

    .form-panel {
        padding: 28px 20px;
    }

    .form-title {
        font-size: 1.45rem;
    }

    .form-input {
        height: 48px;
        font-size: 0.92rem;
    }

    .btn-submit {
        height: 50px;
    }
}
