/* Reset y Variables CSS */
:root {
    --primary-blue: #1a2a44;
    --secondary-blue: #2c3e50;
    --accent-blue: #007bff;
    --light-blue: #e3f2fd;
    --gold: #d4af37;
    --white: #ffffff;
    --gray-light: #f8f9fa;
    --gray-medium: #6c757d;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-heavy: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

/* === ESTILOS DEL LOADING MEJORADO === */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
}

.loading-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="80" cy="40" r="0.5" fill="rgba(255,255,255,0.03)"/><circle cx="40" cy="80" r="1.5" fill="rgba(255,255,255,0.04)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>');
    animation: grain 20s linear infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-5px, -5px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(-5px, 5px); }
}

.loading-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.logo-container {
    position: relative;
    margin-bottom: 40px;
}

.loading-logo {
    width: 280px;
    height: auto;
    filter: drop-shadow(0 15px 40px rgba(0, 0, 0, 0.4));
    animation: logoFloat 3s ease-in-out infinite;
    z-index: 3;
    position: relative;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.4) 0%, rgba(0, 123, 255, 0.2) 50%, transparent 80%);
    border-radius: 50%;
    animation: glow 2s ease-in-out infinite alternate;
    z-index: 1;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes glow {
    0% { opacity: 0.5; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.2); }
}

.brand-container {
    margin-bottom: 50px;
}

.brand-name {
    font-size: 4rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 15px;
    letter-spacing: 4px;
    text-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    animation: titleReveal 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    position: relative;
    z-index: 3;
}

.brand-tagline {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 300;
    letter-spacing: 1px;
    animation: subtitleReveal 1.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes subtitleReveal {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.loading-elements {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, var(--accent-blue) 100%);
    border-radius: 2px;
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; transform: translateX(-100%); }
    50% { width: 100%; transform: translateX(0); }
    100% { width: 100%; transform: translateX(100%); }
}

.loading-dots {
    display: flex;
    gap: 15px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--white);
    border-radius: 50%;
    animation: dots 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dots {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* === ESTILOS DEL LOGIN MEJORADO === */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.login-wrapper.visible {
    opacity: 1;
}

.login-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 50%, var(--accent-blue) 100%);
    overflow: hidden;
}

/* Eliminar los logos de fondo problemáticos en desktop */
.login-background::before,
.login-background::after {
    display: none;
}

.geometric-shapes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    animation: float 15s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -150px;
    right: -150px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: -100px;
    left: -100px;
    animation-delay: 5s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    top: 50%;
    left: -75px;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(120deg); }
    66% { transform: translateY(20px) rotate(240deg); }
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
    z-index: 10;
}

/* Eliminar el diseño de dos columnas problemático */

.login-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 25px 50px var(--shadow-heavy);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 20;
}

.login-wrapper.visible .login-card {
    transform: translateY(0);
}

.login-header {
    background: linear-gradient(135deg, rgba(26, 42, 68, 0.85) 0%, rgba(44, 62, 80, 0.9) 50%, rgba(0, 123, 255, 0.8) 100%);
    padding: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

/* Eliminar el círculo */
.login-header::after {
    display: none;
}

.login-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.logo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 30px 40px;
}

/* Eliminar el halo */
.logo-section::before {
    display: none;
}

.logo-login {
    width: 130px;
    height: auto;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4)) brightness(1.2) contrast(1.25);
    position: relative;
    z-index: 3;
}

.brand-info {
    text-align: center;
}

.app-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 0;
    letter-spacing: 2px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    width: 100%;
    text-align: center;
    white-space: nowrap;
    padding: 0 10px;
}

.app-subtitle {
    display: none;
}

.login-body {
    padding: 35px 30px 40px 30px;
}

.welcome-text {
    text-align: center;
    margin-bottom: 30px;
}

.welcome-text h3 {
    font-size: 1.5rem;
    color: var(--primary-blue);
    margin-bottom: 8px;
    font-weight: 600;
}

.welcome-text p {
    color: var(--gray-medium);
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    position: relative;
}

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

.input-icon {
    position: absolute;
    left: 15px;
    color: var(--gray-medium);
    font-size: 1.1rem;
    z-index: 2;
    transition: color 0.3s ease;
}

.input-container input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    background: var(--white);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.input-container input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    transform: translateY(-2px);
}

.input-container input:focus + .floating-label,
.input-container input:not(:placeholder-shown) + .floating-label {
    transform: translateY(-30px) scale(0.85);
    color: var(--accent-blue);
}

.input-container input:focus ~ .input-icon {
    color: var(--accent-blue);
}

.floating-label {
    position: absolute;
    left: 45px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-medium);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--white);
    padding: 0 5px;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: var(--white);
    padding: 15px;
    border-radius: 12px;
    font-size: 0.9rem;
    animation: errorSlide 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes errorSlide {
    0% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.btn-login {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0056b3 100%);
    color: var(--white);
    border: none;
    padding: 16px 35px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    margin-top: 15px;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3 0%, var(--primary-blue) 100%);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-icon {
    transition: transform 0.3s ease;
}

.btn-login:hover .btn-icon {
    transform: translateX(5px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .loading-logo {
        width: 200px;
    }
    
    .brand-name {
        font-size: 3rem;
    }
    
    .login-card {
        margin: 10px;
        border-radius: 15px;
        max-width: 450px;
    }
    
    .login-header {
        min-height: 190px;
    }
    
    .logo-section {
        gap: 15px;
        padding: 25px 30px;
    }
    
    .brand-info {
        text-align: center;
    }
    
    .login-body {
        padding: 25px 20px 30px 20px;
    }
    
    .login-container {
        padding: 20px;
    }
    
    .logo-login {
        width: 110px;
    }
    
    .app-title {
        font-size: 1.6rem;
        letter-spacing: 1.5px;
        padding: 0 8px;
    }
    
    .btn-login {
        padding: 15px 30px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .loading-bar {
        width: 250px;
    }
    
    .brand-name {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }
    
    .loading-logo {
        width: 160px;
    }
    
    .login-card {
        max-width: 350px;
        margin: 5px;
    }
    
    .login-container {
        padding: 20px 10px;
    }
    
    .login-header {
        min-height: 170px;
    }
    
    .logo-section {
        gap: 12px;
        padding: 20px 25px;
    }
    
    .login-body {
        padding: 20px 15px 25px 15px;
    }
    
    .logo-login {
        width: 90px;
    }
    
    .app-title {
        font-size: 1.3rem;
        letter-spacing: 1.2px;
        padding: 0 5px;
    }
    
    .btn-login {
        padding: 14px 25px;
        font-size: 0.95rem;
    }
}
