/* Core styling for EGE Web Platform */

:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    
    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-hover: rgba(51, 65, 85, 0.9);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
}

.mt-4 { margin-top: 1.5rem; }

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Glassmorphism utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Sidebar */
.sidebar {
    width: 400px;
    height: 100vh;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
}

.logo {
    margin-bottom: 3rem;
}

.logo h2 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0;
    background: linear-gradient(to right, #fff, var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    color: var(--accent-color);
    -webkit-text-fill-color: var(--accent-color);
}

nav {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-link {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateX(5px);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem;
    height: 100vh;
    overflow-y: auto;
}

.topbar {
    margin-bottom: 2rem;
}

.topbar h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.content-wrapper {
    flex: 1;
    border-radius: 16px;
    padding: 2.5rem;
    overflow-y: auto;
}

/* Grid Layout for Home */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: block;
    color: var(--text-primary);
}

.card:hover {
    transform: translateY(-5px) scale(1.02);
    background: var(--card-hover);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.2);
}

.card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.card:hover h3 {
    color: var(--text-primary);
}

.card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.theory-card {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.1) 0%, rgba(14, 165, 233, 0.2) 100%);
    border-color: rgba(56, 189, 248, 0.3);
}

/* Lists */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 1.2rem;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.list-item:hover {
    background: var(--card-hover);
    transform: translateX(10px);
    border-color: rgba(255, 255, 255, 0.2);
}

.item-icon {
    font-size: 1.5rem;
    margin-right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.item-info h4 {
    font-weight: 600;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.5s ease forwards;
    opacity: 0;
}

.list-item:nth-child(1) { animation-delay: 0.1s; }
.list-item:nth-child(2) { animation-delay: 0.15s; }
.list-item:nth-child(3) { animation-delay: 0.2s; }
.list-item:nth-child(4) { animation-delay: 0.25s; }
.list-item:nth-child(5) { animation-delay: 0.3s; }

/* Markdown Content Styling */
.markdown-content {
    line-height: 1.7;
    font-size: 1.05rem;
    color: #e2e8f0;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    color: #fff;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.markdown-content h1 { font-size: 2rem; }
.markdown-content h2 { font-size: 1.5rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.5rem; }

.markdown-content p {
    margin-bottom: 1.2rem;
}

.markdown-content ul, .markdown-content ol {
    margin-bottom: 1.2rem;
    padding-left: 2rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    color: #f87171;
}

.markdown-content pre {
    background: #0f172a;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--glass-border);
}

.markdown-content pre code {
    background: transparent;
    color: #e2e8f0;
    padding: 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.markdown-content th, .markdown-content td {
    border: 1px solid var(--glass-border);
    padding: 0.8rem;
    text-align: left;
}

.markdown-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

.markdown-content blockquote {
    border-left: 4px solid #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    margin: 1rem 0;
    padding: 0.8rem 1.2rem;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary, #94a3b8);
}

.markdown-content blockquote strong:first-child {
    color: #38bdf8;
}

/* Forms and Buttons */
.answer-section {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.answer-section h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.answer-form {
    display: flex;
    gap: 1rem;
}

.input-glass {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s;
}

.input-glass:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    outline: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--accent-color);
    color: #0f172a;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Breadcrumbs */
.breadcrumbs {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumbs a {
    color: var(--text-secondary);
}

.breadcrumbs a:hover {
    color: var(--accent-color);
}

.breadcrumbs .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Sidebar additions */
.sidebar-search {
    margin-bottom: 1.5rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.6rem 1rem;
}

.nav-divider {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-left: 0.5rem;
}

.topic-link {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    gap: 10px;
}

.topic-num {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    min-width: 30px;
    text-align: center;
}

.topic-title {
    word-wrap: break-word;
    white-space: normal;
}

.sidebar-nav {
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    padding-right: 5px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

/* Hero Section */
.hero-section {
    padding: 3rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
    border-left: 4px solid var(--accent-color);
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
}

.mb-4 { margin-bottom: 2rem; }

.section-title {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: #e2e8f0;
}

/* Updated Cards */
.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.card-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: rgba(56, 189, 248, 0.45);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.card:hover .card-number {
    color: var(--accent-color);
}

.light-theme .card-number {
    color: rgba(2, 132, 199, 0.4);
}

.light-theme .card:hover .card-number {
    color: var(--accent-color);
}

.card h3 {
    line-height: 1.3;
    word-break: break-word;
}

/* Tasks Grid (for tasks list) */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.task-grid-item {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    padding: 1.2rem;
    border-radius: 12px;
    text-align: left;
    color: var(--text-primary);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.task-id {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent-color);
}

.task-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: normal;
}

.task-grid-item:hover {
    background: var(--accent-color);
    color: #0f172a;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.task-grid-item.solved {
    background: rgba(74, 222, 128, 0.2);
    border-color: #4ade80;
    color: #4ade80;
}

.task-grid-item.solved:hover {
    background: #4ade80;
    color: #0f172a;
}

.task-grid-item.wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.task-grid-item.wrong:hover {
    background: #ef4444;
    color: #0f172a;
}

/* Progress Bar */
.progress-bar-container {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.progress-text {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4ade80;
    border-radius: 4px;
    transition: width 0.5s ease-in-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.25);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(56, 189, 248, 0.25) transparent;
}

/* ===== Search Results Dropdown ===== */
.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 300;
    max-height: 340px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(56,189,248,0.12);
}

.sr-id {
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
}

.sr-topic {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sr-preview {
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Mobile/Responsive ===== */

.mobile-topbar {
    display: none;
}

.burger-btn {
    display: none;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        top: 3rem;
        left: 0;
        right: 0;
        z-index: 150;
        width: 100%;
        height: auto;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 0 1.5rem;
    }

    .sidebar.open {
        max-height: 80vh;
        overflow-y: auto;
        padding: 1.5rem;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 200;
        height: 3rem;
        background: var(--card-bg);
        border-bottom: 1px solid var(--glass-border);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        padding: 0 1rem;
        gap: 0.75rem;
    }

    .mobile-topbar-title {
        font-size: 1.2rem;
        font-weight: 800;
        letter-spacing: -0.5px;
        background: linear-gradient(to right, #fff, var(--accent-color));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .mobile-topbar-title span {
        color: var(--accent-color);
        -webkit-text-fill-color: var(--accent-color);
    }

    .burger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 1.3rem;
        cursor: pointer;
        padding: 0.2rem 0.4rem;
        flex-shrink: 0;
    }

    .main-content {
        padding: 1rem;
        padding-top: 4rem;
        height: auto;
        overflow-y: visible;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .topbar h1 {
        font-size: 1.4rem;
    }

    .hero-section {
        padding: 1.5rem;
    }

    .hero-section h2 {
        font-size: 1.6rem;
    }

    .tasks-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .grid-container {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }

    .answer-form {
        flex-direction: column;
    }

    .actions {
        flex-wrap: wrap;
    }

    .modal-content {
        width: 95%;
        margin: 4% auto;
        padding: 1rem;
    }

    .logo h2 {
        margin-bottom: 1.5rem;
    }
}

/* ── Auth sidebar ─────────────────────────────────────────────────────── */
.sidebar-auth {
    margin-top: auto;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--glass-border);
}
.auth-links { display: flex; gap: 0.5rem; }
.btn-auth, .btn-auth-reg, .btn-auth-out {
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-auth { background: var(--accent-color); color: #0f172a; }
.btn-auth:hover { background: var(--accent-hover); color: #0f172a; }
.btn-auth-reg { background: rgba(255,255,255,0.1); border: 1px solid var(--glass-border); color: var(--text-primary); }
.btn-auth-reg:hover { background: rgba(255,255,255,0.2); }
.auth-user { display: flex; flex-direction: column; gap: 0.5rem; }
.auth-username { font-size: 0.9rem; color: var(--text-secondary); }
.btn-auth-out { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.btn-auth-out:hover { background: rgba(239,68,68,0.3); color: #ef4444; }

/* ── Auth pages ───────────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.auth-card { padding: 2.5rem; border-radius: 16px; width: 100%; max-width: 440px; }
.auth-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.auth-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; color: var(--text-secondary); }
.btn-full { width: 100%; padding: 0.75rem; font-size: 1rem; margin-top: 0.5rem; }
.auth-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.4); color: #ef9999; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.auth-switch { text-align: center; margin-top: 1.5rem; color: var(--text-secondary); font-size: 0.9rem; }

/* ── Profile page ─────────────────────────────────────────────────────── */
.profile-overview { padding: 1.5rem; }
.profile-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.profile-stat { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--accent-color); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); }
.profile-overall-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.profile-bar-fill { height: 100%; background: linear-gradient(90deg, #38bdf8, #4ade80); border-radius: 4px; transition: width 0.8s ease; }

.topic-progress-row { display: grid; grid-template-columns: 32px 1fr 120px 60px; gap: 0.75rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.topic-progress-num { font-weight: 700; color: var(--accent-color); text-align: center; }
.topic-progress-name { font-size: 0.9rem; }
.topic-progress-bar-wrap { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.topic-progress-bar { height: 100%; background: var(--accent-color); border-radius: 3px; transition: width 0.6s ease; }
.topic-progress-count { font-size: 0.8rem; color: var(--text-secondary); text-align: right; }

.weak-topic-row { display: grid; grid-template-columns: 1fr 120px 50px auto; gap: 0.75rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.weak-topic-name { font-size: 0.9rem; }
.weak-topic-bar-wrap { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.weak-topic-bar { height: 100%; background: #ef4444; border-radius: 3px; }
.weak-topic-pct { font-size: 0.85rem; color: #ef4444; font-weight: 600; }

.history-header, .history-row { display: grid; grid-template-columns: 1fr 80px 60px 80px; gap: 0.5rem; padding: 0.5rem 0; font-size: 0.85rem; }
.history-header { color: var(--text-secondary); font-weight: 600; border-bottom: 1px solid var(--glass-border); margin-bottom: 0.5rem; }
.history-row { border-bottom: 1px solid rgba(255,255,255,0.04); }

/* ── Exam timer ───────────────────────────────────────────────────────── */
.exam-timer {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.4rem 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #4ade80;
    letter-spacing: 1px;
    align-items: center;
    gap: 0.5rem;
}

/* ── Variant progress dots ────────────────────────────────────────────── */
.variant-dots-container { display: flex; flex-wrap: wrap; gap: 8px; }
.variant-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 600;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
    user-select: none;
}
.variant-dot:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.variant-dot-answered { background: rgba(251,191,36,0.25); border-color: #fbbf24; color: #fbbf24; }
.variant-dot-correct { background: rgba(74,222,128,0.25); border-color: #4ade80; color: #4ade80; }
.variant-dot-wrong { background: rgba(239,68,68,0.25); border-color: #ef4444; color: #ef4444; }

/* ── Weak badge in variant ────────────────────────────────────────────── */
.weak-badge { display: inline-block; background: rgba(239,68,68,0.2); color: #ef4444; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; margin-left: 4px; }

/* ── Review section ───────────────────────────────────────────────────── */
.review-item summary { list-style: none; }
.review-item summary::-webkit-details-marker { display: none; }

/* ── Favorites ────────────────────────────────────────────────────────── */
.fav-card { display: flex; flex-direction: column; }
.fav-remove-btn {
    background: none; border: none; color: var(--text-secondary);
    font-size: 1rem; cursor: pointer; padding: 2px 6px;
    border-radius: 4px; transition: color 0.2s;
}
.fav-remove-btn:hover { color: #ef4444; }

/* ── mb-4 ─────────────────────────────────────────────────────────────── */
.mb-4 { margin-bottom: 1.5rem; }

@media (max-width: 768px) {
    .profile-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .topic-progress-row { grid-template-columns: 28px 1fr 80px 50px; }
    .weak-topic-row { grid-template-columns: 1fr 80px 40px; }
    .weak-topic-row .btn-secondary { display: none; }
    .history-header, .history-row { grid-template-columns: 1fr 70px 50px; }
    .history-dur { display: none; }
}

/* ── Light theme ──────────────────────────────────────────────────────── */
.light-theme {
    --bg-gradient: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    --glass-bg: rgba(255,255,255, 0.7);
    --glass-border: rgba(0,0,0,0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0,0,0,0.1);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --card-bg: rgba(255,255,255, 0.8);
    --card-hover: rgba(241,245,249, 0.95);
    --accent-color: #0284c7;
    --accent-hover: #0369a1;
}
.light-theme body { background: var(--bg-gradient); color: var(--text-primary); }
.light-theme .glass-panel { background: var(--glass-bg); border-color: var(--glass-border); }
.light-theme .sidebar { background: rgba(255,255,255,0.85); border-right: 1px solid var(--glass-border); }
.light-theme .nav-link { color: var(--text-primary); }
.light-theme .nav-link:hover { background: rgba(0,0,0,0.06); }
.light-theme .input-glass { background: rgba(255,255,255,0.9); color: var(--text-primary); border-color: var(--glass-border); }
.light-theme .btn-secondary { border-color: var(--glass-border); color: var(--text-primary); }
.light-theme .btn-secondary:hover { background: rgba(0,0,0,0.07); }
.light-theme .card { background: var(--card-bg); border-color: var(--glass-border); color: var(--text-primary); }
.light-theme .card:hover { background: var(--card-hover); color: var(--text-primary); }
.light-theme .card h3 { color: var(--text-primary); }
.light-theme .card p { color: var(--text-secondary); }
.light-theme .card-task-count { color: var(--text-secondary); }
.light-theme .logo h2 { background: linear-gradient(to right, #0f172a, var(--accent-color)); -webkit-background-clip: text; }
.light-theme .topic-num { background: rgba(2,132,199,0.15); color: var(--accent-color); }
.light-theme .modal-content { background: #f8fafc; border-color: var(--glass-border); }
.light-theme .search-results { background: #fff; border-color: var(--glass-border); }
.light-theme .search-result-item:hover { background: #f1f5f9; }
.light-theme .mobile-topbar { background: rgba(255,255,255,0.9); border-bottom: 1px solid var(--glass-border); }
.light-theme .markdown-content table td,
.light-theme .markdown-content table th { border-color: var(--glass-border); }
.light-theme .markdown-content pre { background: #1e293b; }
.light-theme ::-webkit-scrollbar-thumb { background: rgba(2,132,199,0.3); }

/* Theme toggle button */
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    line-height: 1;
}
.theme-toggle-btn:hover { background: rgba(255,255,255,0.1); }
.light-theme .theme-toggle-btn:hover { background: rgba(0,0,0,0.07); }

/* ── Readiness banner ─────────────────────────────────────────────────── */
.readiness-banner {
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}
.readiness-score-circle {
    flex-shrink: 0;
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 3px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.readiness-num { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.readiness-emoji { font-size: 1.2rem; }
.readiness-label { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.25rem; }
.readiness-sub { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.readiness-weak { font-size: 0.85rem; color: var(--text-secondary); display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.readiness-topic-chip {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 600;
}
@media (max-width: 600px) {
    .readiness-banner { flex-direction: column; text-align: center; }
    .readiness-weak { justify-content: center; }
}

/* ── Share card ───────────────────────────────────────────────────────── */
.share-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    border-radius: 12px;
    padding: 1.5rem;
    color: #f8fafc;
    text-align: center;
}
.share-card-logo { font-size: 1rem; font-weight: 800; color: #94a3b8; margin-bottom: 0.75rem; }
.share-card-logo span { color: #38bdf8; }
.share-card-score { font-size: 2rem; font-weight: 800; margin-bottom: 0.25rem; }
.share-card-pct { font-size: 1rem; color: #94a3b8; margin-bottom: 1rem; }
.share-card-bars { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.share-bar { width: 18px; height: 18px; border-radius: 4px; }
.share-bar-ok { background: #4ade80; }
.share-bar-err { background: #ef4444; }
.share-card-date { font-size: 0.8rem; color: #64748b; }

/* ── Card mini progress bar ───────────────────────────────────────────── */
.card-mini-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-top: 0.75rem;
    overflow: hidden;
}
.card-mini-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}
.light-theme .card-mini-bar { background: rgba(0,0,0,0.1); }

/* ── Floating theory button ───────────────────────────────────────────── */
.float-theory-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 54px; height: 54px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #fff;
    font-size: 1.4rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(56,189,248,0.4);
    z-index: 500;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.float-theory-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(56,189,248,0.6);
}
@media (max-width: 768px) {
    .float-theory-btn { bottom: 5rem; right: 1rem; width: 46px; height: 46px; font-size: 1.2rem; }
}
