:root {
    --bg: #0f172a;
    --card: rgba(30, 41, 59, 0.7);
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.4);
    --success: #10b981;
    --error: #ef4444;
    --text: #f8fafc;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    background-image: radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1.2rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.logo { font-size: 2rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.logo i { color: var(--accent); filter: drop-shadow(0 0 8px var(--accent-glow)); }

#main-nav ul { display: flex; gap: 2rem; list-style: none; align-items: center; }
.nav-link { color: var(--text-dim); text-decoration: none; font-weight: 600; transition: 0.3s; }
.nav-link:hover, .nav-link.active { color: white; }

.login-btn {
    background: var(--accent);
    padding: 0.6rem 1.5rem;
    border-radius: 12px;
    color: white !important;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Main UI */
.container { max-width: 800px; margin: 2rem auto; flex: 1; padding: 0 1rem; }

.user-greeting h2 { font-size: 2.2rem; text-align: center; margin-bottom: 2rem; font-weight: 800; }

.card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Inputs & Chips */
.input-group label { display: block; color: var(--text-dim); margin-bottom: 0.5rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper i { position: absolute; left: 1rem; color: var(--accent); }

input, textarea {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 16px;
    color: white;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: 0.3s;
}

textarea { padding-left: 1rem; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1); }

.difficulty-chips { display: flex; gap: 10px; }
.chip {
    flex: 1; padding: 0.8rem; border-radius: 12px; border: 1px solid var(--border);
    background: rgba(255,255,255,0.05); color: var(--text-dim); cursor: pointer; font-weight: 700; transition: 0.3s;
}

.chip.active {
    background: var(--accent) !important; color: white !important;
    box-shadow: 0 0 20px var(--accent-glow); transform: scale(1.02);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--success), #059669);
    width: 100%; padding: 1.2rem; border-radius: 16px; border: none;
    color: white; font-weight: 800; font-size: 1.1rem; cursor: pointer;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2); transition: 0.3s;
}

.primary-btn:hover { transform: translateY(-3px); box-shadow: 0 15px 30px rgba(16, 185, 129, 0.3); }

.submit-action-btn {
    background: var(--accent); width: 100%; padding: 1rem; border-radius: 12px;
    border: none; color: white; font-weight: 700; cursor: pointer; transition: 0.3s;
}

/* Question Selection */
.q-item {
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
    padding: 1.5rem; border-radius: 18px; margin-top: 1rem; cursor: pointer; transition: 0.3s;
}
.q-item:hover { border-color: var(--accent); transform: translateX(8px); background: rgba(139, 92, 246, 0.05); }

/* Feedback */
.feedback-box { margin-top: 2rem; padding: 1.5rem; border-radius: 18px; background: rgba(255,255,255,0.03); border-left: 5px solid var(--accent); }
.correct-answer-box { margin-top: 1rem; padding: 1rem; background: rgba(16, 185, 129, 0.08); border-radius: 12px; border: 1px solid rgba(16, 185, 129, 0.2); }

/* --- ScoreUp AI Loader --- */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-content { text-align: center; color: white; }
.brain-icon { position: relative; font-size: 4.5rem; color: var(--accent); margin-bottom: 2.5rem; }

.pulse-ring {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 90px; height: 90px; border: 4px solid var(--accent); border-radius: 50%;
    animation: ringPulse 1.5s infinite;
}

.progress-bar { width: 280px; height: 6px; background: rgba(255,255,255,0.1); border-radius: 10px; margin: 2rem auto; overflow: hidden; }
.progress-fill { width: 100%; height: 100%; background: var(--accent); animation: loadingFill 2s infinite ease-in-out; }

@keyframes ringPulse { 0% { width: 70px; height: 70px; opacity: 1; } 100% { width: 140px; height: 140px; opacity: 0; } }
@keyframes loadingFill { 0% { transform: translateX(-100%); } 50% { transform: translateX(0); } 100% { transform: translateX(100%); } }

/* Modals */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 2000; }
.modal-content { max-width: 400px; width: 90%; text-align: center; padding: 2rem; }

/* Utilities */
.hidden { display: none !important; }
.main-footer { text-align: center; padding: 4rem; border-top: 1px solid var(--border); color: var(--text-dim); }
.reset-link { background: none; border: none; color: var(--error); cursor: pointer; margin-top: 1rem; font-weight: 600; }

/* Responsive */
@media (max-width: 768px) {
    .header-container { flex-direction: column; gap: 1.5rem; }
    .difficulty-chips { flex-direction: column; }
    .user-greeting h2 { font-size: 1.6rem; }
}
/* --- ScoreUp 2.0 Block Layouts --- */

/* History Cards */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.8rem;
    position: relative;
    transition: var(--transition);
    animation: slideUp 0.5s ease-out;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-3px);
    border-color: var(--accent);
}

.history-item.correct { border-left: 6px solid var(--success); }
.history-item.incorrect { border-left: 6px solid var(--error); }

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.topic-tag {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.date-tag {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.history-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Stats Blocks */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: left !important;
    padding: 2rem !important;
}

.stat-item h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-item p {
    font-size: 2.5rem !important;
    margin: 0;
}

.weakest-topic-card {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(15, 23, 42, 0.5)) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.chart-block {
    margin-top: 2rem;
    min-height: 400px;
}
