/* ===== CSS Variables ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --plab1: #7c3aed;
    --plab1-light: #ede9fe;
    --plab2: #059669;
    --plab2-light: #d1fae5;
    --english: #d97706;
    --english-light: #fef3c7;
    --differences: #dc2626;
    --differences-light: #fee2e2;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== Navigation ===== */
#navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
    background: #eff6ff;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.5rem;
}

/* ===== Pages ===== */
.page {
    display: none;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.page.active {
    display: block;
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    border-radius: var(--radius);
    color: white;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ===== Progress Overview ===== */
.progress-overview {
    margin-bottom: 3rem;
}

.progress-overview h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.progress-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.progress-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.progress-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.progress-card:nth-child(1) { border-top: 3px solid var(--plab1); }
.progress-card:nth-child(2) { border-top: 3px solid var(--plab2); }
.progress-card:nth-child(3) { border-top: 3px solid var(--english); }
.progress-card:nth-child(4) { border-top: 3px solid var(--differences); }

.progress-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.progress-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-card:nth-child(1) .progress-fill { background: var(--plab1); }
.progress-card:nth-child(2) .progress-fill { background: var(--plab2); }
.progress-card:nth-child(3) .progress-fill { background: var(--english); }
.progress-card:nth-child(4) .progress-fill { background: var(--differences); }

.progress-text {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===== Route Timeline ===== */
.route-overview {
    margin-bottom: 2rem;
}

.route-overview h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.timeline {
    position: relative;
    padding-left: 3rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1.1rem;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary), var(--plab1), var(--plab2), #059669);
    border-radius: 2px;
}

.timeline-step {
    position: relative;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.step-number {
    position: absolute;
    left: -2.75rem;
    top: 1.25rem;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.timeline-step:nth-child(2) .step-number { background: var(--plab1); }
.timeline-step:nth-child(3) .step-number { background: var(--plab2); }
.timeline-step:nth-child(4) .step-number { background: #059669; }

.step-content h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.step-content p {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ===== Section Headers ===== */
.section-header {
    text-align: center;
    padding: 2.5rem 1rem;
    border-radius: var(--radius);
    color: white;
    margin-bottom: 1.5rem;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.section-header p {
    opacity: 0.9;
    font-size: 1rem;
}

.plab1-theme { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.plab2-theme { background: linear-gradient(135deg, #059669, #047857); }
.english-theme { background: linear-gradient(135deg, #d97706, #b45309); }
.differences-theme { background: linear-gradient(135deg, #dc2626, #b91c1c); }

/* ===== Tabs ===== */
.section-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--bg);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

.tab-content.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Quiz ===== */
.quiz-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.quiz-question {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.quiz-option {
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.quiz-option:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.quiz-option.selected {
    border-color: var(--primary);
    background: #eff6ff;
}

.quiz-option.correct {
    border-color: #059669;
    background: #d1fae5;
    color: #065f46;
}

.quiz-option.incorrect {
    border-color: #dc2626;
    background: #fee2e2;
    color: #991b1b;
}

.quiz-option.disabled {
    pointer-events: none;
}

.quiz-explanation {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #166534;
}

.quiz-explanation.incorrect-explanation {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.quiz-actions {
    display: flex;
    gap: 0.75rem;
}

/* ===== Buttons ===== */
.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

/* ===== Flashcards ===== */
.flashcard-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.flashcard {
    width: 100%;
    max-width: 500px;
    height: 300px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.5;
}

.flashcard-front {
    background: var(--card-bg);
    border: 2px solid var(--border);
    font-weight: 600;
}

.flashcard-back {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    transform: rotateY(180deg);
}

.flashcard-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.flashcard-nav span {
    font-weight: 500;
    color: var(--text-light);
}

/* ===== Tips ===== */
.tips-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.tip-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tip-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    color: var(--primary-dark);
}

.tip-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.tip-card ul {
    list-style: none;
    padding: 0;
}

.tip-card li {
    padding: 0.35rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text);
}

.tip-card li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* ===== Topics Grid ===== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.topic-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid var(--plab1);
}

.topic-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.topic-card h4 {
    margin-bottom: 0.5rem;
}

.topic-card p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.topic-card .topic-status {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.topic-card .topic-status.reviewed {
    color: #059669;
}

.topic-card .topic-status.not-reviewed {
    color: var(--text-light);
}

/* ===== Scenarios ===== */
.scenarios-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scenario-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--plab2);
    cursor: pointer;
    transition: all 0.2s;
}

.scenario-card:hover {
    box-shadow: var(--shadow-md);
}

.scenario-card h4 {
    margin-bottom: 0.25rem;
}

.scenario-card .scenario-type {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--plab2);
    margin-bottom: 0.5rem;
}

.scenario-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.scenario-card .scenario-details {
    display: none;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.scenario-card.expanded .scenario-details {
    display: block;
}

.scenario-card .scenario-details h5 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.scenario-card .scenario-details ul {
    list-style: none;
    padding: 0;
    margin-bottom: 0.75rem;
}

.scenario-card .scenario-details li {
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
    font-size: 0.85rem;
}

.scenario-card .scenario-details li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--plab2);
}

/* ===== Checklist ===== */
.checklist-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.checklist-group {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.checklist-group h3 {
    margin-bottom: 1rem;
    color: var(--plab2);
    font-size: 1rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

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

.checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--plab2);
    cursor: pointer;
}

.checklist-item label {
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
}

.checklist-item.checked label {
    text-decoration: line-through;
    color: var(--text-light);
}

/* ===== Comparison Table ===== */
.comparison-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.comparison-table th {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
    padding: 1rem;
    text-align: left;
    font-size: 0.9rem;
}

.comparison-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: top;
}

.comparison-table tr:hover {
    background: #fef2f2;
}

.comparison-table td:first-child {
    min-width: 140px;
}

/* ===== Hidden Utility ===== */
.hidden {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    #navbar {
        padding: 0 1rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }

    .nav-links.open {
        display: flex;
    }

    .nav-toggle {
        display: block;
    }

    .page {
        padding: 1rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .progress-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-header h1 {
        font-size: 1.5rem;
    }

    .section-tabs {
        overflow-x: auto;
    }

    .tab-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }

    .quiz-container {
        padding: 1.25rem;
    }

    .flashcard {
        height: 250px;
    }

    .tips-container {
        grid-template-columns: 1fr;
    }

    .quiz-actions {
        flex-direction: column;
    }

    .comparison-table td,
    .comparison-table th {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .progress-cards {
        grid-template-columns: 1fr;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }
}
