/* ============================================
   SYNAPSE PORTAL – CLEAN PROFESSIONAL STYLE
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

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

:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --border-color: #334155;
    --success: #10b981;
    --danger: #ef4444;
    --nav-bg: rgba(15, 23, 42, 0.9);
    --nav-blur: blur(16px);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 80px;
    -webkit-font-smoothing: antialiased;
}

/* Subtle animated background circles */
.bg-animation {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: -1;
}
.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.08;
    animation: float 25s infinite ease-in-out;
}
.bg-circle-1 { width: 500px; height: 500px; background: #6366f1; top: -10%; left: -5%; }
.bg-circle-2 { width: 400px; height: 400px; background: #8b5cf6; bottom: 5%; right: -5%; animation-delay: -10s; }
.bg-circle-3 { width: 350px; height: 350px; background: #3b82f6; top: 50%; left: 50%; transform: translate(-50%, -50%); animation-delay: -20s; }
@keyframes float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.03); }
}

/* ---------- NAVBAR ---------- */
.premium-navbar {
    background: var(--nav-bg);
    backdrop-filter: var(--nav-blur);
    -webkit-backdrop-filter: var(--nav-blur);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
}
.navbar-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 2rem; width: 100%;
}
.navbar-brand {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 1.4rem; font-weight: 800; color: white; cursor: pointer;
    transition: color 0.3s;
}
.navbar-brand:hover { color: var(--accent); }
.brand-icon { font-size: 1.5rem; }
.brand-divider { color: #64748b; font-weight: 300; margin: 0 0.2rem; }
.brand-sub { font-weight: 500; font-size: 1rem; color: var(--accent); }

.navbar-actions { display: flex; align-items: center; gap: 1rem; }

.nav-menu { display: flex; gap: 1.5rem; align-items: center; }
.nav-link {
    color: rgba(255,255,255,0.75); border-radius: 8px; padding: 0.5rem 1rem;
    text-decoration: none; font-weight: 600; transition: all 0.2s;
}
.nav-link:hover { color: white; background: rgba(255,255,255,0.05); }

.btn-theme {
    width: 42px; height: 42px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%; color: white; font-size: 1.2rem; cursor: pointer;
    transition: all 0.2s; display: flex; align-items: center; justify-content: center;
}
.btn-theme:hover { background: rgba(255,255,255,0.15); transform: rotate(15deg); }

/* Sidebar toggle */
.sidebar-toggle-checkbox { display: none; }
.sidebar-toggle-label {
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; padding: 8px 12px; transition: 0.2s;
}
.sidebar-toggle-label:hover { background: rgba(255,255,255,0.12); }
.toggle-icon { font-size: 1.3rem; }

/* Hamburger (mobile) */
.hamburger-btn {
    display: none; background: transparent; border: none;
    font-size: 1.8rem; color: white; cursor: pointer;
    transition: transform 0.2s, color 0.2s;
}
.hamburger-btn:hover { transform: scale(1.1); color: var(--accent); }

/* ---------- SIDEBAR DRAWER ---------- */
.sidebar-panel {
    position: fixed; top: 80px; left: -320px;
    width: 300px; height: calc(100vh - 80px);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    box-shadow: 8px 0 30px rgba(0,0,0,0.4);
    padding: 2rem 1.5rem; transition: left 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 1020; overflow-y: auto;
}
.sidebar-toggle-checkbox:checked ~ .sidebar-panel { left: 0; }

.profile-header {
    display: flex; align-items: center; gap: 1rem;
    padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); margin-bottom: 2rem;
}
.avatar {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white; font-weight: 700; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace; font-size: 1.1rem;
}
.analytics-section h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
.chart-wrapper {
    background: rgba(0,0,0,0.4); border-radius: 16px; padding: 16px;
    position: relative; margin-top: 10px; width: 100%; min-height: 150px; overflow: hidden;
}
.chart-grid-line { stroke: #475569; stroke-dasharray: 4; }
.chart-empty-msg {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: var(--text-muted); font-size: 0.8rem; text-align: center; pointer-events: none;
}
.stats-counter { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.stat-item {
    background: rgba(255,255,255,0.04); padding: 0.9rem; border-radius: 12px;
    border: 1px solid var(--border-color);
}
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; display: block; }
.stat-val { font-size: 1.2rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: white; margin-top: 4px; }

/* ---------- MAIN CONTENT ---------- */
.portal-container {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 80px); padding: 2rem; width: 100%;
}
.main-content { max-width: 640px; width: 100%; text-align: center; }

.app-header { margin-bottom: 2rem; }
.tech-logo {
    font-size: 2rem; font-weight: 800;
    background: linear-gradient(to right, #a5b4fc, #c7d2fe);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}
.subtitle { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }

/* Quiz cards (start, quiz, result) */
.quiz-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px -15px rgba(0,0,0,0.4);
    transition: box-shadow 0.3s;
    animation: cardPop 0.4s ease-out;
}
@keyframes cardPop {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Start screen specific */
#assignment-title {
    font-size: 1.7rem; font-weight: 800; color: white;
    margin-bottom: 0.75rem; letter-spacing: -0.5px;
}
.description {
    color: var(--text-muted); font-size: 1rem;
    max-width: 450px; margin: 0 auto 2rem auto; line-height: 1.6;
}

.rules-box {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 1.8rem; margin-bottom: 2rem;
    text-align: left; transition: border-color 0.2s;
}
.rules-box h3 {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--accent); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem;
    font-weight: 700;
}
.rules-box h3::before { content: '⚙️'; font-size: 1rem; }
.rules-box ul { list-style: none; }
.rules-box ul li {
    padding: 0.6rem 0; border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-muted); font-size: 0.9rem;
}
.rules-box ul li:last-child { border-bottom: none; }
.rules-box ul li strong { color: white; font-weight: 600; }

/* Buttons */
.btn {
    padding: 0.95rem 2rem; border: none; border-radius: 12px;
    font-weight: 700; font-size: 0.95rem; cursor: pointer;
    transition: all 0.2s; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; letter-spacing: 0.3px;
}
.btn-primary {
    background: var(--accent); color: white;
    box-shadow: 0 6px 15px rgba(99,102,241,0.3);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover); transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99,102,241,0.4);
}
.btn-primary:disabled {
    background: #475569; color: #94a3b8; box-shadow: none; cursor: not-allowed;
}
.btn-secondary {
    background: rgba(255,255,255,0.08); color: white;
    border: 1px solid var(--border-color); width: auto;
}
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-outline {
    background: transparent; border: 2px solid var(--border-color); color: white;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* Timer & progress */
.timer-badge {
    background: rgba(239,68,68,0.15); color: #fca5a5;
    padding: 0.5rem 1rem; border-radius: 20px;
    font-weight: 800; font-family: 'JetBrains Mono', monospace; font-size: 0.95rem;
}
.progress-bar-container {
    height: 6px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-bottom: 2rem;
}
.progress-bar {
    height: 100%; width: 100%; background: var(--accent);
    transition: width 0.2s linear;
}

/* Options */
.options-grid { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 2rem; }
.option-btn {
    background: rgba(255,255,255,0.04); border: 1px solid var(--border-color);
    padding: 1rem 1.2rem; border-radius: var(--radius-sm); font-size: 0.95rem;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    transition: all 0.2s; font-family: inherit; font-weight: 600; color: white;
}
.option-btn:hover { border-color: var(--accent); background: rgba(99,102,241,0.1); transform: translateX(4px); }
.option-btn.selected {
    background: rgba(99,102,241,0.25); border-color: var(--accent);
    box-shadow: 0 0 10px rgba(99,102,241,0.2);
}
.indicator {
    background: rgba(255,255,255,0.08); border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem; border-radius: 6px; font-size: 0.7rem;
    font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--text-muted);
}
.option-btn.selected .indicator { background: var(--accent); color: white; border-color: var(--accent); }

/* Result screen */
.result-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.score-grid { display: flex; gap: 1rem; margin-bottom: 2rem; }
.score-box {
    flex: 1; background: rgba(255,255,255,0.03); border: 1px solid var(--border-color);
    padding: 1.2rem; border-radius: 16px;
}
.score-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; margin-bottom: 0.4rem; display: block; }
.score-box h3 { font-size: 1.8rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: white; }
.feedback-text { color: var(--text-muted); margin-bottom: 2rem; font-weight: 600; }
.action-button-group { display: flex; flex-direction: column; gap: 0.8rem; }

/* ---------- MODALS ---------- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(10px);
    display: flex; justify-content: center; align-items: center; z-index: 9999;
}
.modal-card {
    background: #ffffff;  /* light background for auth */
    border: 1px solid #e2e8f0;
    border-radius: 20px; padding: 2.5rem 2rem;
    width: 100%; max-width: 440px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
    animation: modalPop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    color: #0f172a; /* dark text inside */
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header-branding h2 {
    font-size: 1.4rem; font-weight: 800; color: #0f172a; margin-bottom: 0.5rem;
}
.modal-header-branding p {
    font-size: 0.9rem; color: #64748b; margin-bottom: 2rem;
}

/* Auth form inputs */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block; font-size: 0.8rem; font-weight: 700;
    color: #334155; margin-bottom: 0.4rem;
}
.form-group input {
    width: 100%; padding: 0.85rem 1rem;
    border: 2px solid #cbd5e1; border-radius: 12px;
    background: #ffffff; color: #0f172a;
    font-size: 0.95rem; font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* Register button inside modal */
#register-btn {
    background: var(--accent); color: white;
    padding: 0.95rem; border-radius: 12px;
    font-weight: 700; font-size: 1rem; border: none;
    cursor: pointer; transition: background 0.2s;
}
#register-btn:hover { background: var(--accent-hover); }

/* About / Documentation modals – dark cards */
.about-card, .doc-card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    color: var(--text-main); max-width: 600px;
}
.about-dev { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border-color); }
.dev-avatar { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--accent); object-fit: cover; }
.dev-role { color: var(--accent); font-weight: 600; font-size: 0.85rem; }
.dev-bio { color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-top: 0.5rem; }
.social-links { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.social-link {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.5rem 1rem; border-radius: 20px; font-size: 0.85rem; font-weight: 600;
    text-decoration: none; background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color); color: white; transition: 0.2s;
}
.social-link:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem; }
.doc-item {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 1.2rem; transition: all 0.2s;
}
.doc-item:hover { transform: translateY(-4px); border-color: var(--accent); }
.modal-close {
    position: absolute; top: 1rem; right: 1.2rem;
    font-size: 1.8rem; cursor: pointer; color: #94a3b8; transition: color 0.2s;
}
.modal-close:hover { color: var(--accent); }

/* Dark mode override for auth modal (if dark mode toggled) */
body.dark-mode .modal-card:not(.about-card):not(.doc-card) {
    background: #1e293b; border-color: #334155;
    color: #f1f5f9;
}
body.dark-mode .modal-header-branding h2 { color: #f1f5f9; }
body.dark-mode .modal-header-branding p { color: #94a3b8; }
body.dark-mode .form-group label { color: #cbd5e1; }
body.dark-mode .form-group input {
    background: #0f172a; border-color: #475569; color: #f1f5f9;
}
body.dark-mode .form-group input:focus {
    border-color: #818cf8; box-shadow: 0 0 0 3px rgba(129,140,248,0.2);
}

/* Utilities */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-muted); }
.mb-2 { margin-bottom: 0.5rem; }
.mt-3 { margin-top: 1rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .navbar-inner { padding: 0.75rem 1rem; }
    .portal-container { padding: 1.5rem; }
    .quiz-card { padding: 2rem 1.5rem; }
}

@media (max-width: 768px) {
    .doc-grid { grid-template-columns: 1fr; }
    .about-dev { flex-direction: column; text-align: center; }
    .social-links { justify-content: center; }
}

@media (max-width: 600px) {
    .hamburger-btn { display: block; }
    .nav-menu {
        position: absolute; top: 100%; left: 0; width: 100%;
        background: rgba(15,23,42,0.95); backdrop-filter: blur(16px);
        flex-direction: column; max-height: 0; overflow: hidden;
        transition: max-height 0.35s ease, padding 0.35s;
        padding: 0 1.5rem; border-bottom: 1px solid transparent;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    .nav-menu.active { max-height: 250px; padding: 1rem 1.5rem; border-bottom-color: var(--border-color); }
    .nav-link { width: 100%; text-align: center; padding: 0.8rem; margin-bottom: 0.5rem; background: rgba(255,255,255,0.05); border-radius: 12px; }
    
    .sidebar-panel { width: 280px; left: -300px; }
    .sidebar-toggle-checkbox:checked ~ .sidebar-panel { left: 0; }

    .quiz-card { padding: 1.5rem 1.2rem; border-radius: 20px; }
    .tech-logo { font-size: 1.5rem; }
    .subtitle { font-size: 0.85rem; }
    .question-text { font-size: 1.05rem; margin-bottom: 1.5rem; }
    .option-btn { padding: 0.9rem 1rem; font-size: 0.9rem; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
    .score-grid { flex-direction: column; gap: 0.8rem; }
    .result-icon { font-size: 3rem; }
}

@media (max-width: 380px) {
    .navbar-brand { font-size: 1.2rem; }
    .brand-sub, .brand-divider { display: none; }
    .stats-counter { grid-template-columns: 1fr; }
}