@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #09090b;
    --surface: rgba(20, 20, 23, 0.85); 
    --surface-solid: #141417;
    --border: rgba(255, 255, 255, 0.1);
    --text: #fafafa;
    --muted: #a1a1aa;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --radius: 16px;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: linear-gradient(to bottom, rgba(9, 9, 11, 0.8), rgba(9, 9, 11, 0.95)), url('https://images.unsplash.com/photo-1516280440502-6c36768ec5d1?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    padding: 20px;
}

/* --- LAYOUT UNIFICATO E SCROLL --- */
.auth-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    /* SCROLL MANAGEMENT: Evita che il form di registrazione buchi lo schermo in altezza */
    max-height: 90vh;
    overflow-y: auto;
    transition: max-width 0.3s ease; 
}

/* Scrollbar personalizzata per il Webkit (Chrome, Safari, Edge) */
.auth-card::-webkit-scrollbar { width: 6px; }
.auth-card::-webkit-scrollbar-track { background: transparent; }
.auth-card::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
.auth-card::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }

.brand-logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
    text-align: center;
    margin-bottom: 8px;
}
.brand-logo span { color: var(--primary); }

.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header p { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Forms */
.form-group { margin-bottom: 18px; position: relative; }
.form-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.6);
}

.forgot-password { position: absolute; right: 0; top: 0; font-size: 11px; color: var(--muted); text-decoration: none; transition: 0.2s; }
.forgot-password:hover { color: var(--primary); }

.btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* Links e Utility */
.footer-links { text-align: center; margin-top: 24px; font-size: 13px; color: var(--muted); }
.footer-links a { color: var(--primary); text-decoration: none; font-weight: 600; transition: color 0.2s; cursor: pointer; }
.footer-links a:hover { color: #60a5fa; text-decoration: underline; }

.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 24px 0; border: none; }

#errorMsg, .error-msg { 
    color: var(--danger); 
    font-size: 13px; 
    text-align: center; 
    margin-bottom: 16px; 
    display: none; 
    background: rgba(239, 68, 68, 0.1); 
    padding: 10px; 
    border-radius: 8px; 
    border: 1px solid rgba(239, 68, 68, 0.3); 
}

/* ==========================================
   SPLASH SCREEN (ANIMAZIONE BOOT)
========================================== */
.splash-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg); 
    display: none; 
    flex-direction: column; justify-content: center; align-items: center;
    z-index: 9999; opacity: 0; transition: opacity 0.4s ease;
}
.splash-screen.active { opacity: 1; }

.splash-logo { font-size: 36px; margin-bottom: 24px; animation: pulseLogo 2s infinite; }

.progress-container {
    width: 220px; height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px; overflow: hidden; margin-bottom: 12px;
}
.progress-bar {
    width: 0%; height: 100%;
    background: var(--primary);
    border-radius: 4px; transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.splash-text {
    color: var(--muted); font-size: 10px; text-transform: uppercase;
    letter-spacing: 1.5px; animation: pulseText 1.5s infinite;
}

@keyframes pulseText { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }
@keyframes pulseLogo { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }