/* ============================================================
   dashboard-login.css — OLED Monochromatic Login
   Matches dashboard.css theme tokens
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
    --bg-primary:    #000000;
    --bg-secondary:  #0a0a0a;
    --bg-tertiary:   #111111;
    --bg-hover:      #161616;
    --bg-card:       #0a0a0a;
    --bg-elevated:   #141414;

    --accent-primary: #8b5cf6;
    --accent-hover:   #a78bfa;
    --accent-dark:    #7c3aed;
    --accent-glow:    rgba(139, 92, 246, 0.12);

    --text-primary:   #f0f0f0;
    --text-secondary: #737373;
    --text-muted:     #535353;

    --border-color:   rgba(255, 255, 255, 0.06);
    --border-hover:   rgba(255, 255, 255, 0.12);
    --border-subtle:  rgba(255, 255, 255, 0.03);

    --success: #22c55e;
    --warning: #eab308;
    --danger:  #ef4444;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
    --shadow-md: 0 4px 12px rgba(0,0,0,.6);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.7);

    --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
*::-webkit-scrollbar { display: none; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

/* ── Background ───────────────────────────────────────────── */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-bg-grid {
    position: absolute;
    inset: -50%;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridDrift 25s linear infinite;
}

@keyframes gridDrift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.login-bg-glow {
    position: absolute;
    top: 30%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(139,92,246,.08) 0%, transparent 70%);
    filter: blur(60px);
    animation: glowPulse 6s ease-in-out infinite alternate;
}

@keyframes glowPulse {
    0%   { opacity: .5; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 1;  transform: translate(-50%, -50%) scale(1.15); }
}

/* ── Container ────────────────────────────────────────────── */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
}

/* ── Brand ────────────────────────────────────────────────── */
.login-brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

.login-logo-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    margin-bottom: .5rem;
}

.login-logo {
    position: relative;
    z-index: 1;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139, 92, 246, 0.3);
}

.login-logo-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent-primary);
    animation: ringRotate 3s linear infinite;
}

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

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.02em;
}

.login-subtitle {
    font-size: .875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ── Card ─────────────────────────────────────────────────── */
.login-card {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    transition: border-color var(--transition);
}

.login-card:hover {
    border-color: var(--border-hover);
}

/* ── Form ─────────────────────────────────────────────────── */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.form-group label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: .375rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-group label .material-icons {
    font-size: 1rem;
    color: var(--accent-primary);
}

.form-group input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: .9375rem;
    transition: all var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* ── Password toggle ──────────────────────────────────────── */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: .625rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: .375rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.password-toggle:hover {
    color: var(--accent-primary);
    background: var(--accent-glow);
}

.password-toggle .material-icons {
    font-size: 1.25rem;
}

/* ── Button ───────────────────────────────────────────────── */
.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .8125rem 1rem;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: .01em;
    transition: all var(--transition);
    margin-top: .25rem;
}

.btn-login:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.25);
    transform: translateY(-1px);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
    background: var(--accent-dark);
}

.btn-login:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-login .material-icons {
    font-size: 1.25rem;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

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

/* ── Footer ───────────────────────────────────────────────── */
.login-footer {
    text-align: center;
}

.login-footer-text {
    font-size: .75rem;
    color: var(--text-muted);
}

/* ── 2FA Styles ───────────────────────────────────────────── */
.two-factor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.two-factor-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

.user-avatar-2fa {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.user-avatar-2fa img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.two-factor-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.two-factor-subtitle {
    font-size: .8125rem;
    color: var(--text-secondary);
}

.code-input-container {
    display: flex;
    justify-content: center;
}

.code-input {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    padding: .875rem 1rem !important;
    color: var(--text-primary) !important;
    font-family: 'Inter', monospace !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    text-align: center;
    letter-spacing: .5em;
    width: 100%;
    transition: all var(--transition);
}

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-hint {
    font-size: .75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: .25rem;
}

/* 2FA buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    transition: all var(--transition);
    width: 100%;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.25);
}

.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.btn-block { width: 100%; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .login-container {
        padding: 1.5rem;
    }

    .login-card {
        padding: 1.5rem;
    }

    .login-logo-wrapper,
    .login-logo {
        width: 60px;
        height: 60px;
    }

    .login-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 380px) {
    .login-container {
        padding: 1rem;
    }

    .login-card {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .login-form {
        gap: 1rem;
    }
}
