/* ===== Edu Hub Shared Stylesheet ===== */

:root {
    --primary: #1a73e8;
    --primary-dark: #0d47a1;
    --accent: #ff6f00;
    --accent-light: #fff3e0;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #263238;
    --text-light: #546e7a;
    --border: #cfd8dc;
    --success: #2e7d32;
    --success-bg: #e8f5e9;
    --warning: #f57f17;
    --warning-bg: #fff8e1;
    --info: #0288d1;
    --info-bg: #e1f5fe;
    --formula-bg: #eceff1;
    --nav-height: 64px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
}

/* ===== Header / Navbar ===== */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--nav-height);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar .logo {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-decoration: none;
    color: white;
}

.navbar .logo span { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

/* ===== Main Content ===== */
.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

.card h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.card h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 0.3rem;
}

.card h3 {
    font-size: 1.2rem;
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.card p, .card li {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

/* ===== Formula Box ===== */
.formula-box {
    background: var(--formula-bg);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    overflow-x: auto;
}

.formula-box .formula {
    margin: 0.3rem 0;
}

/* ===== Blockquote ===== */
blockquote {
    background: var(--accent-light);
    border-left: 4px solid var(--accent);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

/* ===== Info / Tip / Example Boxes ===== */
.info-box {
    background: var(--info-bg);
    border-left: 4px solid var(--info);
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
}

.info-box.tip {
    background: var(--success-bg);
    border-left-color: var(--success);
}

.info-box.example {
    background: var(--warning-bg);
    border-left-color: var(--warning);
}

.info-box.worked {
    background: #fce4ec;
    border-left-color: #c2185b;
}

.info-box strong {
    display: block;
    margin-bottom: 0.3rem;
}

/* ===== Practice & Check Sections ===== */
.practice-section {
    background: #e8eaf6;
    border: 2px solid var(--primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.practice-section h2 {
    border-bottom-color: var(--primary);
    margin-top: 0;
}

.check-section {
    background: var(--success-bg);
    border: 2px solid var(--success);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.check-section h2 {
    border-bottom-color: var(--success);
    margin-top: 0;
}

/* ===== Interactive Quiz ===== */
.quiz-question {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.quiz-question p {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.quiz-options {
    list-style: none;
    padding: 0;
}

.quiz-options li {
    margin: 0.4rem 0;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.quiz-options li:hover {
    background: #e3f2fd;
    border-color: var(--primary);
}

.quiz-options li.correct {
    background: #c8e6c9;
    border-color: var(--success);
    font-weight: 600;
}

.quiz-options li.incorrect {
    background: #ffcdd2;
    border-color: #c62828;
}

.quiz-options li input[type="radio"] {
    margin-right: 0.5rem;
}

.btn-check {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
}

.btn-check:hover {
    background: var(--primary-dark);
}

/* ===== Answer Toggle ===== */
.answer-toggle {
    margin-top: 1rem;
}

.answer-toggle details {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
}

.answer-toggle summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--primary);
    color: white;
}

tr:nth-child(even) {
    background: #fafafa;
}

tr:hover {
    background: #e3f2fd;
}

/* ===== Syllabus Table ===== */
.syllabus-table {
    margin: 1.5rem 0;
}

/* ===== Navigation Buttons ===== */
.nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border);
}

.nav-buttons a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.nav-buttons a.prev {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.nav-buttons a.prev:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.nav-buttons a.next {
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
}

.nav-buttons a.next:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.nav-buttons a.home {
    background: var(--accent);
    color: white;
    border: 2px solid var(--accent);
}

.nav-buttons a.home:hover {
    background: #e65100;
    border-color: #e65100;
}

/* ===== Progress Bar ===== */
.progress-bar {
    background: #e0e0e0;
    border-radius: 12px;
    height: 8px;
    margin: 1rem 0 0.5rem;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--success);
    border-radius: 12px;
    transition: width 0.3s;
}

/* ===== Final Exam Styles ===== */
.exam-section {
    background: #fff3e0;
    border: 3px solid var(--accent);
    border-radius: 12px;
    padding: 2rem;
    margin: 1.5rem 0;
}

.exam-section h2 {
    border-bottom-color: var(--accent);
    margin-top: 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem;
        height: auto;
    }
    .nav-links {
        justify-content: center;
        margin-top: 0.5rem;
    }
    .card {
        padding: 1.5rem;
    }
    .container {
        padding: 0 1rem;
    }
}

/* ===== Print-friendly ===== */
@media print {
    .navbar, .nav-buttons, .quiz-question, .report-actions, .no-print { display: none !important; }
    .card { border: none; box-shadow: none; page-break-inside: avoid; }
}

/* ===== Dashboard & Auth Styles ===== */
.auth-section { margin: 2rem 0; }
.auth-section input { padding: 0.5rem; margin: 0.5rem 0; }
.auth-section button { background: var(--primary); color: white; padding: 0.5rem 1.5rem; border: none; border-radius: 6px; }

/* Dashboard Stats */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}
.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}
.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-light);
}
.overview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Grade Badge */
.grade-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
}
.grade-badge.A { background: #c8e6c9; color: #2e7d32; }
.grade-badge.B { background: #e3f2fd; color: #1565c0; }
.grade-badge.C { background: #fff8e1; color: #f57f17; }
.grade-badge.D { background: #fff3e0; color: #e65100; }
.grade-badge.F { background: #ffcdd2; color: #c62828; }
.grade-badge.N-A { background: #f5f5f5; color: #9e9e9e; }

/* Enrollment Card */
.enrollment-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ===== Module Header (Lesson Pages) ===== */
.module-header {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.module-header h1 {
    font-size: 2rem;
    color: var(--primary);
    border-bottom: 3px solid var(--accent);
    display: inline-block;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.module-header p {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* ===== Quiz Section ===== */
.quiz {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 12px;
}

.quiz h3 {
    margin-top: 0;
    color: var(--primary);
}

.quiz input[type="radio"] {
    margin-right: 0.5rem;
}

.quiz button[type="button"] {
    margin-top: 1rem;
}

/* ===== Code Block Shared Class ===== */
.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    margin: 0.75rem 0;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block pre code {
    font-family: inherit;
}

/* ===== Challenge Card Shared Class ===== */
.challenge-card {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--accent-light);
    border-left: 5px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

.challenge-card h2 {
    color: var(--accent);
    border-bottom: none;
    margin-top: 0;
    font-size: 1.3rem;
}

.challenge-card ul {
    margin-left: 1.5rem;
}

.challenge-card li {
    margin-bottom: 0.5rem;
}

/* ===== Congratulations Card ===== */
.congrats-card {
    background: linear-gradient(135deg, #f1f8e9, #dcedc8);
    border: 2px solid var(--success);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.congrats-card h2 {
    color: var(--success);
    border-bottom: none;
}

/* ===== Module Header Card ===== */
.module-card-header {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    text-align: center;
}

/* Toast Notification */
#edu-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}
