/* ============================================
   Login - Glassmorphism Dark (Purple/Violet)
   ============================================ */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a1a;
    overflow: hidden;
    position: relative;
}

form#form1 {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
}

/* ============================================
   Animated background elements
   ============================================ */

.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(120,58,240,0.25) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(236,72,153,0.2) 0%, transparent 50%),
        radial-gradient(ellipse 70% 60% at 60% 80%, rgba(6,182,212,0.15) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 30% 90%, rgba(245,158,11,0.1) 0%, transparent 50%);
    animation: bgShift 15s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes bgShift {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(2deg); }
}

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

.orb-1 { width: 400px; height: 400px; background: rgba(139,92,246,0.5); top: -10%; left: -10%; animation-delay: 0s; }
.orb-2 { width: 350px; height: 350px; background: rgba(236,72,153,0.4); bottom: -10%; right: -10%; animation-delay: -7s; }
.orb-3 { width: 300px; height: 300px; background: rgba(6,182,212,0.3); top: 50%; left: 60%; animation-delay: -14s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.noise {
    position: fixed;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ============================================
   Login Card
   ============================================ */

.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    margin: 20px;
    padding: 48px 40px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    box-shadow:
        0 8px 32px rgba(0,0,0,0.3),
        0 0 0 1px rgba(255,255,255,0.05) inset,
        0 0 80px rgba(139,92,246,0.1) inset;
}

/* ============================================
   Brand Header
   ============================================ */

.brand-header {
    text-align: center;
    margin-bottom: 40px;
}

.brand-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #8b5cf6, #ec4899, #06b6d4);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(139,92,246,0.3), 0 0 0 1px rgba(255,255,255,0.1) inset;
}

.brand-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.brand-subtitle {
    font-size: 15px;
    color: rgba(255,255,255,0.35);
    font-weight: 400;
    line-height: 1.5;
}

/* ============================================
   User Display (Paso 2)
   ============================================ */

/* Selector dual para compatibilidad con JS antiguo + nuevo HTML */
.user-display,
.login-user-display {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    color: rgba(255,255,255,0.45);
}

.user-display i,
.login-user-display i {
    color: #8b5cf6;
    font-size: 20px;
}

.user-display span,
.login-user-display span {
    font-weight: 600;
    color: #f8fafc;
}

.user-display a,
.login-user-display a,
.login-change-user {
    margin-left: auto;
    color: #c4b5fd;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.user-display a:hover,
.login-user-display a:hover,
.login-change-user:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ============================================
   Formulario
   ============================================ */

.form-group,
.login-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-label,
.login-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}

.form-input,
.login-input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #f8fafc;
    outline: none;
    transition: all 0.2s ease;
}

.form-input::placeholder,
.login-input::placeholder {
    color: rgba(255,255,255,0.25);
}

.form-input:focus,
.login-input:focus {
    border-color: rgba(139,92,246,0.5);
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 0 4px rgba(139,92,246,0.15), 0 0 20px rgba(139,92,246,0.25);
}

/* Password wrapper */
.login-password-wrapper,
.form-group > div {
    position: relative;
    display: flex;
    align-items: center;
}

.toggle-eye,
.login-password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-eye:hover,
.login-password-toggle:hover {
    color: #c4b5fd;
}

/* ============================================
   Botones
   ============================================ */

.btn-primary,
.login-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #0a0a1a;
    background: linear-gradient(135deg, #8b5cf6, #c4b5fd);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover,
.login-btn:hover {
    box-shadow: 0 8px 24px rgba(139,92,246,0.35);
}

.btn-primary:hover::before,
.login-btn:hover::before {
    opacity: 1;
}

.btn-primary:disabled,
.login-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled::before,
.login-btn:disabled::before {
    display: none;
}

/* ============================================
   Mensajes de error
   ============================================ */

.error-msg,
.login-error {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px;
    margin-top: 16px;
    font-size: 13px;
    color: #fca5a5;
    text-align: left;
    animation: shake 0.3s ease;
}

.error-msg i,
.login-error i {
    color: rgba(239,68,68,0.9);
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
}

/* ============================================
   Loading spinner
   ============================================ */

.login-spinner {
    display: none;
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: rgba(139,92,246,0.8);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 16px auto 0;
}

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

/* ============================================
   Footer
   ============================================ */

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    color: rgba(255,255,255,0.25);
    letter-spacing: 0.05em;
}

.login-footer strong {
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px;
        margin: 16px;
        border-radius: 20px;
    }

    .brand-logo {
        width: 60px;
        height: 60px;
        font-size: 26px;
        border-radius: 16px;
    }

    .brand-title {
        font-size: 24px;
    }

    .brand-subtitle {
        font-size: 14px;
    }

    .form-input,
    .login-input {
        padding: 12px 14px;
        font-size: 16px;
    }

    .btn-primary,
    .login-btn {
        padding: 14px;
    }

    .form-label,
    .login-form-group label {
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 28px 20px;
    }

    .brand-title {
        font-size: 22px;
    }
}
