/* === AUTH LOGIN STYLES - DEMS CORPORATE v2.0 === */

:root {
    --primary: #1565C0;
    --primary-dark: #0D47A1;
    --primary-light: #42A5F5;
    --secondary: #1976D2;
    --accent: #2196F3;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #f0f4f8;
    --surface: #ffffff;
    --surface-light: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--background);
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════
   LAYOUT PRINCIPAL - DOS PANELES
═══════════════════════════════════════════ */

.login-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   PANEL IZQUIERDO - BRANDING CORPORATIVO
═══════════════════════════════════════════ */

.login-brand-panel {
    flex: 1;
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 45%, #0a3d7a 100%);
    background-size: 200% 200%;
    animation: gradientShift 20s ease infinite;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 3rem;
    overflow: hidden;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.brand-content {
    text-align: center;
    z-index: 10;
    max-width: 420px;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.brand-welcome {
    display: block;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    margin-bottom: 1.25rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.brand-logo {
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255,255,255,0.2), rgba(255,255,255,0.05));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    animation: logoFloat 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg, 
        transparent 30%, 
        rgba(255, 255, 255, 0.2) 50%, 
        transparent 70%
    );
    animation: logoShine 5s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}

@keyframes logoShine {
    0%, 100% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.logo-icon i {
    font-size: 2.75rem;
    color: white;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    z-index: 1;
    position: relative;
}

.brand-name {
    font-size: 3.25rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.75rem;
    letter-spacing: 4px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.brand-tagline {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

.brand-description {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    max-width: 340px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════
   NUBES DECORATIVAS ANIMADAS
═══════════════════════════════════════════ */

.clouds-decoration {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 220px;
    overflow: hidden;
    pointer-events: none;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 100px;
    filter: blur(1px);
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: inherit;
    border-radius: 50%;
    filter: inherit;
}

.cloud-1 {
    width: 220px;
    height: 65px;
    bottom: 70px;
    left: -40px;
    animation: cloudFloat1 25s ease-in-out infinite;
}

.cloud-1::before {
    width: 90px;
    height: 90px;
    bottom: 35px;
    left: 35px;
}

.cloud-1::after {
    width: 110px;
    height: 110px;
    bottom: 25px;
    left: 90px;
}

.cloud-2 {
    width: 200px;
    height: 55px;
    bottom: 40px;
    right: 5%;
    animation: cloudFloat2 22s ease-in-out infinite;
}

.cloud-2::before {
    width: 75px;
    height: 75px;
    bottom: 28px;
    left: 30px;
}

.cloud-2::after {
    width: 95px;
    height: 95px;
    bottom: 18px;
    left: 75px;
}

.cloud-3 {
    width: 170px;
    height: 50px;
    bottom: 100px;
    right: -25px;
    animation: cloudFloat3 28s ease-in-out infinite;
}

.cloud-3::before {
    width: 65px;
    height: 65px;
    bottom: 25px;
    left: 25px;
}

.cloud-3::after {
    width: 85px;
    height: 85px;
    bottom: 15px;
    left: 65px;
}

@keyframes cloudFloat1 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(30px); }
}

@keyframes cloudFloat2 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-25px); }
}

@keyframes cloudFloat3 {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(20px); }
}

/* ═══════════════════════════════════════════
   PANEL DERECHO - FORMULARIO LOGIN
═══════════════════════════════════════════ */

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    padding: 2rem;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 
        0 30px 60px -15px rgba(0, 0, 0, 0.12),
        0 15px 25px -10px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    animation: slideInRight 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light), var(--primary));
    background-size: 300% 100%;
    animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 300% 0; }
    100% { background-position: -300% 0; }
}

/* ═══════════════════════════════════════════
   HEADER DEL LOGIN
═══════════════════════════════════════════ */

.login-header {
    text-align: center;
    padding: 2.5rem 2rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(to bottom, white, var(--surface-light));
}

.login-title {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ═══════════════════════════════════════════
   CUERPO DEL FORMULARIO
═══════════════════════════════════════════ */

.login-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

.input-wrapper {
    position: relative;
    transition: transform 0.25s ease;
}

.input-wrapper:hover {
    transform: translateY(-2px);
}

.input-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.05rem;
    z-index: 2;
    transition: color 0.3s ease;
}

.form-control {
    width: 100%;
    padding: 0.95rem 1rem 0.95rem 2.9rem;
    background: var(--surface-light);
    border: 2px solid var(--border);
    border-radius: 0.85rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-control.has-toggle {
    padding-right: 3.25rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 
        0 0 0 4px rgba(21, 101, 192, 0.12),
        0 4px 12px rgba(21, 101, 192, 0.08);
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

.form-control::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* ═══════════════════════════════════════════
   PASSWORD TOGGLE
═══════════════════════════════════════════ */

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    z-index: 2;
    transition: all 0.25s ease;
    padding: 0.35rem;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary);
    background: rgba(21, 101, 192, 0.1);
}

/* ═══════════════════════════════════════════
   CHECKBOX REMEMBER ME
═══════════════════════════════════════════ */

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.remember-checkbox {
    width: 1.3rem;
    height: 1.3rem;
    border: 2px solid var(--border);
    border-radius: 0.4rem;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.25s ease;
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
}

.remember-checkbox:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

.remember-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.remember-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
}

.remember-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: color 0.25s ease;
}

.remember-label:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════
   BOTÓN LOGIN
═══════════════════════════════════════════ */

.btn-login {
    width: 100%;
    padding: 1.05rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 0.85rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.03em;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    box-shadow: 
        0 6px 20px rgba(21, 101, 192, 0.35),
        0 3px 8px rgba(21, 101, 192, 0.15);
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    transition: left 0.7s ease;
}

.btn-login:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 30px rgba(21, 101, 192, 0.4),
        0 6px 15px rgba(21, 101, 192, 0.2);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(-2px);
    transition-duration: 0.1s;
}

.btn-login i {
    transition: transform 0.35s ease;
    font-size: 0.95rem;
}

.btn-login:hover i {
    transform: translateX(6px);
}

/* ═══════════════════════════════════════════
   ALERTAS
═══════════════════════════════════════════ */

.alert {
    margin-bottom: 1.5rem;
    padding: 1rem 1.15rem;
    border-radius: 0.85rem;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    animation: alertSlide 0.4s ease-out;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-info {
    background: rgba(59, 130, 246, 0.12);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.alert-security {
    background: rgba(239, 68, 68, 0.15);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.alert-csrf {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
    border: 2px solid rgba(245, 158, 11, 0.4);
}

.security-details {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.85;
}

/* ═══════════════════════════════════════════
   FOOTER DEL LOGIN
═══════════════════════════════════════════ */

.login-card-footer {
    padding: 1.1rem 2rem;
    background: var(--surface-light);
    border-top: 1px solid var(--border);
    text-align: center;
}

.login-card-footer .copyright {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

/* ═══════════════════════════════════════════
   ESTADOS DE CARGA
═══════════════════════════════════════════ */

.btn-login.loading {
    pointer-events: none;
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.7), rgba(13, 71, 161, 0.7));
}

.btn-login.loading span,
.btn-login.loading i {
    opacity: 0;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-login:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.form-control:disabled {
    background: var(--surface-light);
    border-color: var(--border);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════
   RESPONSIVE - TABLET (< 900px)
═══════════════════════════════════════════ */

@media (max-width: 900px) {
    .login-wrapper {
        flex-direction: column;
    }
    
    .login-brand-panel {
        flex: 0 0 auto;
        min-height: 300px;
        padding: 2rem 1.5rem 4.5rem;
    }
    
    .brand-content {
        max-width: 100%;
    }
    
    .brand-name {
        font-size: 2.5rem;
        letter-spacing: 3px;
    }
    
    .brand-tagline {
        font-size: 1.05rem;
        margin-bottom: 1.25rem;
    }
    
    .brand-description {
        display: none;
    }
    
    .logo-icon {
        width: 90px;
        height: 90px;
    }
    
    .logo-icon i {
        font-size: 2.25rem;
    }
    
    .clouds-decoration {
        height: 140px;
    }
    
    .cloud-1 {
        width: 160px;
        height: 48px;
        bottom: 50px;
    }
    
    .cloud-1::before {
        width: 60px;
        height: 60px;
        bottom: 25px;
        left: 25px;
    }
    
    .cloud-1::after {
        width: 80px;
        height: 80px;
        bottom: 15px;
        left: 65px;
    }
    
    .cloud-2 {
        width: 140px;
        height: 42px;
        bottom: 25px;
    }
    
    .cloud-2::before {
        width: 55px;
        height: 55px;
        bottom: 22px;
        left: 20px;
    }
    
    .cloud-2::after {
        width: 70px;
        height: 70px;
        bottom: 12px;
        left: 55px;
    }
    
    .cloud-3 {
        display: none;
    }
    
    .login-form-panel {
        flex: 1;
        padding: 0;
        background: white;
    }
    
    .login-card {
        max-width: 100%;
        border-radius: 2.5rem 2.5rem 0 0;
        margin-top: -2.5rem;
        box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.12);
        min-height: calc(100vh - 280px);
    }
    
    .login-card::before {
        border-radius: 2.5rem 2.5rem 0 0;
    }
    
    .login-header {
        padding: 2.25rem 1.75rem 1.25rem;
        background: white;
    }
    
    .login-title {
        font-size: 1.6rem;
    }
    
    .login-body {
        padding: 1.75rem;
    }
    
    .form-group {
        margin-bottom: 1.35rem;
    }
}

/* ═══════════════════════════════════════════
   RESPONSIVE - MÓVIL (< 480px)
═══════════════════════════════════════════ */

@media (max-width: 480px) {
    .login-brand-panel {
        min-height: 250px;
        padding: 1.75rem 1.25rem 3.5rem;
    }
    
    .brand-welcome {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .brand-name {
        font-size: 2.1rem;
        letter-spacing: 2px;
    }
    
    .brand-tagline {
        font-size: 0.95rem;
    }
    
    .logo-icon {
        width: 75px;
        height: 75px;
    }
    
    .logo-icon i {
        font-size: 1.9rem;
    }
    
    .login-card {
        min-height: calc(100vh - 230px);
        border-radius: 2rem 2rem 0 0;
        margin-top: -2rem;
    }
    
    .login-header {
        padding: 1.75rem 1.5rem 1rem;
    }
    
    .login-title {
        font-size: 1.4rem;
    }
    
    .login-subtitle {
        font-size: 0.85rem;
    }
    
    .login-body {
        padding: 1.5rem;
    }
    
    .form-label {
        font-size: 0.82rem;
    }
    
    .form-control {
        padding: 0.85rem 0.95rem 0.85rem 2.6rem;
        font-size: 0.95rem;
        border-radius: 0.75rem;
    }
    
    .btn-login {
        padding: 0.95rem 1.25rem;
        font-size: 0.95rem;
        border-radius: 0.75rem;
    }
    
    .login-card-footer {
        padding: 0.85rem 1.5rem;
    }
    
    .login-card-footer .copyright {
        font-size: 0.75rem;
    }
    
    .clouds-decoration {
        height: 100px;
    }
    
    .cloud-1 {
        width: 120px;
        height: 36px;
        bottom: 35px;
    }
    
    .cloud-1::before {
        width: 45px;
        height: 45px;
        bottom: 18px;
        left: 18px;
    }
    
    .cloud-1::after {
        width: 58px;
        height: 58px;
        bottom: 10px;
        left: 48px;
    }
    
    .cloud-2 {
        width: 100px;
        height: 30px;
        bottom: 15px;
    }
    
    .cloud-2::before {
        width: 38px;
        height: 38px;
        bottom: 15px;
        left: 15px;
    }
    
    .cloud-2::after {
        width: 50px;
        height: 50px;
        bottom: 8px;
        left: 40px;
    }
}

/* ═══════════════════════════════════════════
   PANTALLAS GRANDES (> 1400px)
═══════════════════════════════════════════ */

@media (min-width: 1400px) {
    .login-brand-panel {
        flex: 1.3;
    }
    
    .login-form-panel {
        flex: 0.7;
        max-width: 580px;
    }
    
    .login-card {
        max-width: 480px;
    }
    
    .brand-name {
        font-size: 3.75rem;
    }
    
    .brand-tagline {
        font-size: 1.25rem;
    }
    
    .logo-icon {
        width: 130px;
        height: 130px;
    }
    
    .logo-icon i {
        font-size: 3.25rem;
    }
    
    .brand-description {
        font-size: 1rem;
        max-width: 380px;
    }
}

/* ═══════════════════════════════════════════
   PANTALLAS MUY GRANDES (> 1800px)
═══════════════════════════════════════════ */

@media (min-width: 1800px) {
    .login-card {
        max-width: 520px;
    }
    
    .login-header {
        padding: 3rem 2.5rem 2rem;
    }
    
    .login-title {
        font-size: 2rem;
    }
    
    .login-body {
        padding: 2.5rem;
    }
    
    .form-control {
        padding: 1.1rem 1.15rem 1.1rem 3.1rem;
        font-size: 1.05rem;
    }
    
    .btn-login {
        padding: 1.15rem 1.75rem;
        font-size: 1.05rem;
    }
}
