/* ========================================
   PlayNexus Auth — Login & Account Styles
   Neon-Blue → Violet | Futuristic
   ======================================== */

:root {
    --bg-primary: #06060d;
    --bg-secondary: #0c0c18;
    --bg-card: rgba(15, 15, 30, 0.7);
    --bg-card-hover: rgba(20, 20, 40, 0.8);
    --text-primary: #f0f0ff;
    --text-secondary: #8888aa;
    --text-muted: #5a5a7a;
    --blue: #00b4ff;
    --violet: #8b5cf6;
    --cyan: #00e5ff;
    --purple: #a855f7;
    --red: #ef4444;
    --gradient-primary: linear-gradient(135deg, var(--blue), var(--violet));
    --gradient-glow: linear-gradient(135deg, rgba(0, 180, 255, 0.15), rgba(139, 92, 246, 0.15));
    --glow-blue: rgba(0, 180, 255, 0.3);
    --glow-violet: rgba(139, 92, 246, 0.3);
    --font-heading: 'Sora', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-full: 999px;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(0, 180, 255, 0.15);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

/* Canvas */
#networkCanvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: auto;
}

/* Layout */
.page-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: center;
}

.nav-logo { display: flex; align-items: center; }

.logo-img {
    height: 120px;
    width: auto;
    display: block;
}

/* Auth Container */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 460px;
    padding-top: 5rem;
}

/* Auth Card */
.auth-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 0 40px rgba(0, 180, 255, 0.05), 0 0 80px rgba(139, 92, 246, 0.03);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Error */
.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #86efac;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* OAuth Buttons */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 2rem;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-subtle);
    text-decoration: none;
}

.oauth-btn:hover {
    transform: translateY(-2px);
}

/* Discord */
.oauth-discord {
    background: rgba(88, 101, 242, 0.15);
    border-color: rgba(88, 101, 242, 0.3);
    color: #fff;
}
.oauth-discord:hover {
    background: rgba(88, 101, 242, 0.25);
    box-shadow: 0 0 24px rgba(88, 101, 242, 0.2);
}

/* Google */
.oauth-google {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.oauth-google:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

/* GitHub */
.oauth-github {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.oauth-github:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

/* Footer Text */
.auth-footer-text {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.auth-footer-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ========================================
   Account Page
   ======================================== */

.account-card {
    max-width: 520px;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.account-avatar img,
.avatar-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

/* Avatar Upload */
.avatar-upload-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    cursor: pointer;
}

.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    color: #fff;
}

.avatar-upload-wrap:hover .avatar-upload-overlay {
    opacity: 1;
}

.avatar-upload-wrap.uploading .avatar-upload-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.avatar-remove-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    background: var(--red);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.15s;
}

.avatar-upload-wrap:hover .avatar-remove-btn {
    opacity: 1;
}

.avatar-remove-btn:hover {
    transform: scale(1.15);
}

.avatar-upload-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: avatar-spin 0.6s linear infinite;
}

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

.account-info h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    background: none;
    -webkit-text-fill-color: var(--text-primary);
    margin-bottom: 2px;
}

.account-email {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-user { background: rgba(0, 180, 255, 0.1); color: var(--cyan); border: 1px solid rgba(0, 180, 255, 0.2); }
.role-creator { background: rgba(139, 92, 246, 0.1); color: var(--violet); border: 1px solid rgba(139, 92, 246, 0.2); }
.role-moderator { background: rgba(168, 85, 247, 0.1); color: var(--purple); border: 1px solid rgba(168, 85, 247, 0.2); }
.role-admin { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Sections */
.account-section {
    margin-bottom: 1.5rem;
}

.account-section h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Linked Accounts */
.linked-accounts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.linked-account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.linked-account:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-glow);
}

.linked-add {
    cursor: pointer;
    border-style: dashed;
    opacity: 0.6;
}

.linked-add:hover {
    opacity: 1;
}

.linked-provider {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.linked-discord { background: rgba(88, 101, 242, 0.15); color: #5865F2; }
.linked-google { background: rgba(255, 255, 255, 0.06); color: #fff; }
.linked-github { background: rgba(255, 255, 255, 0.06); color: #fff; }

.linked-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.linked-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.linked-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Quick Links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.quick-link:hover {
    background: rgba(0, 180, 255, 0.05);
    border-color: var(--border-glow);
    color: var(--text-primary);
}

.quick-link svg {
    color: var(--cyan);
}

/* Account Actions */
.account-actions {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

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

.btn-outline:hover {
    transform: translateY(-2px);
}

.btn-danger {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    text-align: center;
    padding: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

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

    .auth-card {
        padding: 1.8rem;
        border-radius: 16px;
    }

    .account-header {
        flex-direction: column;
        text-align: center;
    }

    .quick-links {
        grid-template-columns: 1fr;
    }

    .footer {
        position: relative;
        margin-top: 2rem;
    }
}

/* Login Locked State */
.auth-locked {
    text-align: center;
    padding: 2rem 1.5rem;
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius);
    margin-top: 0.5rem;
}
.auth-locked-icon {
    width: 56px; height: 56px;
    margin: 0 auto 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
}
.auth-locked p {
    color: #c4a35a;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* Security Status */
.security-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
}
.security-ok { background: rgba(34,197,94,0.08); color: #22c55e; }
.security-warn { background: rgba(245,158,11,0.08); color: #f59e0b; }
.security-off { background: rgba(255,255,255,0.03); color: #6b6b8a; }

/* TOTP Setup */
.totp-qr-wrap { text-align: center; margin: 16px 0; }
.totp-qr { border-radius: 12px; border: 2px solid rgba(255,255,255,0.06); }
.totp-secret-display {
    text-align: center;
    margin-bottom: 16px;
}
.totp-secret-display code {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #00e5ff;
    background: rgba(0,229,255,0.06);
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}
.totp-input {
    width: 120px;
    padding: 8px 14px;
    background: #06060d;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #e0e0f0;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-align: center;
    font-family: monospace;
}
.totp-input:focus { outline: none; border-color: #00e5ff; }

/* Backup Codes */
.backup-codes-box {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 16px;
}
.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.backup-code {
    background: rgba(0,229,255,0.06);
    color: #00e5ff;
    padding: 6px 8px;
    border-radius: 6px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 1px;
}
@media (max-width: 480px) {
    .backup-codes-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 2FA Login Challenge */
.totp-challenge {
    text-align: center;
}
.totp-challenge h2 { margin-bottom: 8px; }
.totp-challenge p { color: #a0a0c0; font-size: 0.88rem; margin-bottom: 20px; }
.totp-challenge-form { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.totp-challenge-form .totp-input { width: 160px; font-size: 1.3rem; padding: 12px; }
.totp-backup-link { font-size: 0.78rem; color: #6b6b8a; text-decoration: none; margin-top: 8px; }
.totp-backup-link:hover { color: #00e5ff; }
