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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --dark: #0f172a;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
}

body {
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a; /* Dashboard Sidebar Color */
    position: relative;
    overflow: hidden;
}

/* Clean side accent */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #3b82f6, #10b981);
}

/* Auth Container */
.auth-container {
    width: 100%;
    max-width: 420px;
    margin: 2rem 1rem;
}

.auth-card {
    background: var(--white);
    border-top: 4px solid var(--primary);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    animation: cardIn 0.35s ease-out;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.logo-icon svg { width: 24px; height: 24px; fill: white; }

.auth-logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.auth-logo p {
    color: var(--secondary);
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

/* Form */
.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    color: var(--dark);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-group input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--gray-100);
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    color: var(--dark);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-group input::placeholder { color: #94a3b8; }

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--white);
}

/* Submit Button */
.auth-btn {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 0.5rem;
    position: relative;
}

.auth-btn:hover { background: var(--primary-hover); }
.auth-btn:active { transform: scale(0.99); }

/* Loading */
.auth-btn.loading { pointer-events: none; opacity: 0.7; }
.auth-btn.loading .btn-text { visibility: hidden; }

.auth-btn.loading::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.5s linear infinite;
    top: 50%; left: 50%;
    margin: -9px 0 0 -9px;
}

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

/* Auth Switch Link */
.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--gray-200);
    color: var(--secondary);
    font-size: 0.85rem;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover { text-decoration: underline; }

/* Success Overlay */
.success-overlay {
    position: fixed; inset: 0;
    background: rgba(248, 250, 252, 0.97);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.success-overlay.active { display: flex; }

.success-check {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: popIn 0.4s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    70% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success-check svg {
    width: 32px; height: 32px;
    stroke: white; stroke-width: 3;
    fill: none;
}

.success-text {
    color: var(--dark);
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 1rem;
    animation: fadeUp 0.3s 0.2s ease backwards;
}

.success-subtext {
    color: var(--secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    animation: fadeUp 0.3s 0.35s ease backwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Error */
.error-msg {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    font-size: 0.82rem;
    margin-bottom: 1rem;
    display: none;
}

.error-msg.visible { display: block; }

.shake { animation: shake 0.35s ease; }

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

/* Responsive */
@media (max-width: 480px) {
    .auth-container { margin: 1rem 0.75rem; }
    .auth-card { padding: 1.5rem 1.25rem; border-radius: 10px; }
    .auth-logo h1 { font-size: 1.2rem; }
    .auth-logo { margin-bottom: 1.5rem; }
    .form-group input { font-size: 0.85rem; }
    .auth-btn { font-size: 0.85rem; }
}

@media (max-width: 360px) {
    .auth-container { margin: 0.5rem; }
    .auth-card { padding: 1.25rem 1rem; }
}
