/* auth.css - Dynamic Glassmorphism Auth UI */

:root {
    --bg-dark: #0a0a0f;
    --acc-primary: #6366f1;
    --acc-secondary: #a855f7;
    --acc-error: #ef4444;
    --acc-success: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.25);

    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    color-scheme: dark;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Ambient Background Orbs */
.background-elements {
    position: absolute;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: drift 20s infinite alternate ease-in-out;
}

.orb-1 {
    width: 40vw; height: 40vw;
    background: linear-gradient(135deg, var(--acc-primary), transparent);
    top: -10%; left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 50vw; height: 50vw;
    background: linear-gradient(135deg, var(--acc-secondary), transparent);
    bottom: -20%; right: -10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 30vw; height: 30vw;
    background: linear-gradient(135deg, #3b82f6, transparent);
    top: 40%; left: 60%;
    animation-delay: -10s;
    opacity: 0.3;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 10%) scale(1.1); }
    100% { transform: translate(-5%, 5%) scale(0.9); }
}

/* Glassmorphism Auth Panel */
.auth-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 840px;
    padding: 20px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 40px var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: visible;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 50px rgba(0,0,0,0.4);
}

.panel-header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

p { color: var(--text-muted); font-size: 0.95rem; font-weight: 300; }

/* Inputs */
.input-group {
    margin-bottom: 20px;
    position: relative;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: var(--acc-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* TOTP Boxes */
.totp-boxes {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-top: 10px;
}

.totp-box {
    width: 45px;
    height: 55px;
    font-size: 1.5rem;
    text-align: center;
    padding: 0;
    margin: 0;
}

/* Button */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.primary-btn {
    background: linear-gradient(135deg, var(--acc-primary), var(--acc-secondary));
    color: white;
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
    margin-top: 10px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, #818cf8, #c084fc);
}

.primary-btn:active { transform: translateY(1px); }

/* Switch Links */
.panel-footer {
    text-align: center;
    margin-top: 25px;
    border-top: 1px solid var(--glass-border);
    padding-top: 20px;
}

.btn-link {
    background: none; border: none;
    color: var(--acc-secondary);
    font-family: inherit; font-size: inherit; font-weight: 500;
    cursor: pointer;
    text-decoration: underline; text-underline-offset: 4px;
    transition: color 0.2s;
}

.btn-link:hover { color: #fff; }

/* Notifications */
.notification {
    padding: 12px; border-radius: 8px; font-size: 0.9rem;
    margin-bottom: 20px; border-left: 4px solid transparent;
    animation: fadeIn 0.3s ease;
}

.notification.error { background: rgba(239, 68, 68, 0.1); border-color: var(--acc-error); color: #fca5a5; }
.notification.success { background: rgba(16, 185, 129, 0.1); border-color: var(--acc-success); color: #6ee7b7; }

/* Utilities */
.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loader */
.loader {
    border: 2px solid rgba(255,255,255,0.2);
    border-top: 2px solid #fff;
    border-radius: 50%;
    width: 20px; height: 20px;
    animation: spin 1s linear infinite;
    position: absolute;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.btn.loading span { visibility: hidden; }
.btn.loading .loader { display: block !important; }

/* TOTP Setup */
.totp-setup-box { text-align: center; }
.totp-setup-box h3 { margin-bottom: 5px; }
.totp-setup-box > p { margin-bottom: 10px; }
.qrcode-container {
    background: white; padding: 10px; border-radius: 8px; display: inline-block; margin: 15px 0;
}
.qrcode-container img {
    width: 300px;
    height: 300px;
    display: block;
}
.totp-secret-text {
    font-family: monospace; letter-spacing: 2px; font-weight: bold; margin-bottom: 20px;
}

/* Active Session Styles */
.auth-session-box { text-align: center; color: var(--text-main); padding: 1rem; }
.auth-session-title { font-size: 1.1em; color: #fff; margin-bottom: 5px; }
.auth-session-email { font-weight: 600; color: var(--acc-secondary); margin-bottom: 15px; word-break: break-all; }
.auth-grants-box { margin-bottom: 20px; }
.auth-grants-table { width: 100%; border-collapse: collapse; margin-top: 10px; margin-bottom: 20px; text-align: left; }
.auth-grants-table th { border-bottom: 2px solid rgba(255,255,255,0.1); padding: 8px; font-size: 0.75em; color: var(--text-muted); font-weight: 500; }
.auth-grants-table td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.8em; }
.auth-grants-table .level-col { text-align: right; }
.auth-grants-table td.level-col { color: var(--acc-secondary); font-weight: 600; }
.auth-grants-empty { margin-bottom: 20px; font-size: 0.9em; color: var(--text-muted); }

/* Access Denied Styles */
.auth-denied-box { text-align: center; color: var(--text-muted); padding: 2rem; }
.auth-denied-btn-box { margin-top: 1rem; }

/* Auth Status Overview */
.auth-status-row { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; font-weight: 600; font-size: 1.1em; }
.auth-status-icon { font-size: 1.5em; margin-right: 10px; }
.auth-status-row.success-row .auth-status-text { color: var(--acc-success); word-break: break-all; }
.auth-status-row.error-row .auth-status-text { color: var(--acc-error); word-break: break-all; margin-top: 4px; }
.auth-status-spacer { margin-bottom: 20px; }

/* Auth Log Styles */
.auth-log-table { width: 100%; border-collapse: collapse; margin-top: 10px; margin-bottom: 20px; text-align: left; }
.auth-log-table td { padding: 6px; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 0.7em; color: var(--text-muted); }
.auth-log-table th { border-bottom: 2px solid rgba(255,255,255,0.1); padding: 6px; font-size: 0.75em; color: var(--text-muted); font-weight: 500; text-align: left; }
.auth-log-table th.ip-col { text-align: right; }
.auth-log-table .time-col { color: #a5b4fc; }
.auth-log-table .ip-col { text-align: right; font-family: monospace; }
.auth-log-title { margin-top: 20px; font-size: 0.9em; }

/* Strike Overlay */
.strike-overlay { position: absolute; bottom: -20px; left: -30px; z-index: 100; pointer-events: none; width: 120px; height: 134px; opacity: 0; transition: opacity 1s ease-in-out; }
.strike-overlay.show-strike { opacity: 1; }
.strike-overlay img { width: 100%; height: 100%; display: block; }
.strike-count { position: absolute; bottom: 10px; right: 0px; font-weight: bold; font-size: 20px; color: #ef4444; background-color: rgba(0, 0, 0, 0.7); padding: 4px 8px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1); }

/* Strict CSP Helpers */
.text-center { text-align: center; }
.js-req-title { color: #f8fafc; font-size: 1.1rem; margin-bottom: 10px; }
.forgot-btn-wrap { margin-top: 5px; }
.forgot-btn { font-size: 0.9em; opacity: 0.8; }
.qr-hint { font-size: 0.9em; margin-top: -10px; opacity: 0.8; }
.auth-divider { opacity: 0.2; margin: 20px 0; border: 0; border-top: 1px solid #fff; }

/* Backup codes container styles */
.backup-codes-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 20px 0; background: rgba(0,0,0,0.1); padding: 15px; border-radius: 8px; }
.backup-code { font-family: monospace; font-size: 1.2em; letter-spacing: 2px; text-align: center; background: rgba(255,255,255,0.05); padding: 5px; border-radius: 4px; }
.warning-text { color: #ff6b6b; font-size: 0.9em; margin-bottom: 20px; }

.redirect-whitelist-error {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 10px;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.auto-redirect-msg {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 15px;
}
