:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --dark: #0f172a;
    --light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-soft: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-strong: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f1f5f9;
    background-image:
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(124, 58, 237, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--dark);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Auth Container */
.auth-container {
    width: 100%;
    max-width: 440px;
    margin: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    perspective: 1000px;
}

.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    animation: slideUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.auth-header {
    padding: 3rem 2.5rem 2rem;
    text-align: center;
}

.auth-logo {
    width: auto;
    height: 38px;
    max-width: 180px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
    transition: transform 0.3s ease;
}

.auth-logo:hover {
    transform: scale(1.02);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--secondary);
    line-height: 1.5;
}

/* Body & Form */
.auth-body {
    padding: 0 2.5rem 2.5rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-control {
    padding: 0.875rem 1.25rem;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    color: #1e293b;
    transition: all 0.2s ease;
}

.form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: #cbd5e1;
}

/* Password Toggle */
.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--primary);
}

.password-toggle:focus {
    outline: 2px solid var(--primary-light);
}

/* Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    padding: 1rem;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 12px;
    width: 100%;
    margin-top: 1rem;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2), 0 2px 4px -1px rgba(79, 70, 229, 0.1);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3), 0 4px 6px -2px rgba(79, 70, 229, 0.15);
    background: linear-gradient(135deg, #5b54fa 0%, #4f46e5 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Alerts */
.alert {
    border-radius: 12px;
    border: none;
    font-size: 0.9rem;
    padding: 1rem;
    display: flex;
    align-items: start;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.alert i {
    font-size: 1.1rem;
    padding-top: 1px;
}

.alert-danger {
    background: #fff1f2;
    color: #be123c;
    border-left: 4px solid #f43f5e;
}

.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border-left: 4px solid #22c55e;
}

/* Footer */
.auth-footer {
    text-align: center;
    padding: 1.5rem;
    background: rgba(248, 250, 252, 0.5);
    border-top: 1px solid rgba(226, 232, 240, 0.6);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

.copyright {
    text-align: center;
    margin-top: 2rem;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Frosted accent Onboarding Style */
.onboarding-mode .auth-card.onboarding-glass {
    border-top: 5px solid #10b981;
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.1);
}

.btn-accent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    transition: all 0.3s ease;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
    color: white;
}

.avatar-title.bg-success {
    background-color: #10b981 !important;
}

.onboarding-mode .password-toggle {
    right: 12px;
    color: #6c757d;
}

/* Responsive Viewport Optimizations (100vh / 100dvh Lock) */
@media (max-height: 740px) {
    .auth-header {
        padding: 2rem 1.75rem 1rem;
    }
    .auth-logo {
        height: 32px;
        margin-bottom: 1rem;
    }
    .auth-title {
        font-size: 1.5rem;
    }
    .auth-body {
        padding: 0 1.75rem 1.5rem;
    }
    .auth-footer {
        padding: 1rem;
    }
    .copyright {
        margin-top: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.75rem;
    }
    .auth-card {
        border-radius: 20px;
    }
}