/* =============================================
   Top Line Performance — Login Page v3
   "Slate & Sky" — Clean, Modern, Professional
   ============================================= */

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: #020617;
    color: #f1f5f9;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Preloader */
.auth-preloader {
    position: fixed;
    inset: 0;
    background: #020617;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.auth-preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.auth-preloader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(14, 165, 233, 0.15);
    border-top-color: #0ea5e9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Background — subtle radial accents */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(14, 165, 233, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 90%, rgba(59, 130, 246, 0.05), transparent),
        #020617;
}

/* Login Card */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 14px;
    padding: 2.5rem 2rem;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    animation: cardEnter 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    position: relative;
    overflow: hidden;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8, #0ea5e9);
    background-size: 200% 100%;
    animation: topLineShimmer 3s ease-in-out infinite;
}
@keyframes topLineShimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}
.auth-logo img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(14, 165, 233, 0.15));
}

/* Typography */
.auth-title {
    font-size: 1.375rem;
    font-weight: 700;
    text-align: center;
    color: #f8fafc;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}
.auth-subtitle {
    font-size: 0.875rem;
    text-align: center;
    color: #64748b;
    margin-bottom: 1.75rem;
    font-weight: 500;
}

/* Alert */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    animation: shake 0.5s ease-in-out;
}
.auth-alert.error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}
.auth-alert i { font-size: 1.125rem; flex-shrink: 0; }

/* Form */
.auth-form { margin-bottom: 0; }
.auth-form .form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 0.375rem;
}
.auth-form .form-control {
    width: 100%;
    background: #020617;
    border: 1.5px solid #1e293b;
    border-radius: 10px;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    color: #f1f5f9;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    min-height: 48px;
    box-sizing: border-box;
}
.auth-form .form-control::placeholder { color: #475569; }
.auth-form .form-control:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
    transform: translateY(-1px);
}
.auth-form .mb-3 { margin-bottom: 1rem; }
.auth-form .position-relative { position: relative; }

/* Password toggle */
#pwToggle {
    position: absolute;
    right: 0.5rem;
    top: 32px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    min-height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#pwToggle:hover { color: #0ea5e9; background: rgba(14, 165, 233, 0.08); }

/* Remember me */
.auth-form .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.auth-form .form-check-input {
    width: 18px;
    height: 18px;
    border: 1.5px solid #334155;
    border-radius: 4px;
    background: #020617;
    accent-color: #0ea5e9;
    cursor: pointer;
}
.auth-form .form-check-label {
    font-size: 0.8125rem;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

/* Login Button */
.auth-btn {
    width: 100%;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.875rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    min-height: 48px;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}
.auth-btn:hover {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
}
.auth-btn:active {
    transform: translateY(0) scale(0.99);
}
.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #475569;
    font-weight: 500;
}

/* Shake animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .auth-preloader-spinner,
    .auth-card::before,
    .auth-alert {
        animation: none !important;
    }
    .auth-card {
        animation: none !important;
        opacity: 1;
        transform: none;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .auth-page { padding: 1rem; }
    .auth-card { padding: 2rem 1.5rem; border-radius: 12px; }
    .auth-title { font-size: 1.25rem; }
    .auth-form .form-control { font-size: 1rem; min-height: 52px; }
    .auth-btn { font-size: 1rem; min-height: 52px; }
}
