/* Modern, clean and sophisticated styles for NTU Distributed System Review */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --text-muted: #6c757d;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 0;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.header p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.loading,
.error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 20px;
}

.error-content {
    text-align: center;
    padding: 50px;
    color: #dc3545;
}

.error-content h2 {
    color: #dc3545;
    margin-bottom: 20px;
}

.error-content ul {
    list-style: none;
    padding: 0;
}

.error-content li {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px;
    margin: 5px 0;
    border-radius: var(--border-radius);
}

.stats-container {
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: var(--surface-color);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

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

.timeline-container {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.timeline-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.timeline-description {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-style: italic;
}

.custom-timeline {
    position: relative;
    padding: 20px 0;
}

.timeline-vertical-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.chapter-section-vertical {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.chapter-content {
    text-align: center;
    margin-top: 15px;
    width: 100%;
}

.chapter-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.knowledge-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    justify-items: center;
}

.footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    border-top: 1px solid #e9ecef;
    margin-top: 40px;
}

.question-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--surface-color);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.close-btn {
    background: var(--surface-color);
    border: 1px solid #e9ecef;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: #f8f9fa;
    color: var(--text-color);
    transform: scale(1.1);
}

#modal-body {
    padding: 20px;
}

/* Timeline specific styles */
.knowledge-bubble {
    border: 2px solid;
    border-radius: 20px;
    width: 140px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
    padding: 8px;
    text-align: center;
}

.knowledge-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.8));
}

.bubble-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    font-size: 0.75rem;
    z-index: 10;
    margin-bottom: 5px;
}

.knowledge-bubble:hover .bubble-tooltip {
    opacity: 1;
    visibility: visible;
}

.chapter-node {
    min-width: 80px;
    height: 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    padding: 0 12px;
}

/* Question Modal Styles */
.question-card {
    background-color: var(--surface-color);
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.question-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.question-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.question-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    line-height: 1.4;
}

.question-meta {
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-left: 3px solid var(--primary-color);
}

.question-meta strong {
    color: var(--primary-color);
    font-weight: 600;
}

.knowledge-points {
    background-color: #e7f3ff;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #0066cc;
    border-left: 3px solid #0066cc;
}

.knowledge-points strong {
    color: #004499;
    font-weight: 600;
}

/* Question type specific colors */
.type-Essay {
    background-color: #e3f2fd;
    color: #1976d2;
}

.type-Calculation {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.type-FillinBlank {
    background-color: #e8f5e8;
    color: #388e3c;
}

.type-ShortAnswer {
    background-color: #fff3e0;
    color: #f57c00;
}

.type-Programming {
    background-color: #fce4ec;
    color: #c2185b;
}

/* Visualization specific styles */
.visualization-container {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.visualization-title {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.visualization-description {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-style: italic;
}

.visualization-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.visualization-card {
    background-color: var(--surface-color);
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.visualization-card:hover {
    transform: translateY(-2px);
}

.visualization-card h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chapter-distribution {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chapter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.chapter-item span:first-child {
    font-weight: 500;
}

.chapter-item span:last-child {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.knowledge-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.knowledge-item {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.knowledge-item:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    transform: scale(1.02);
}

.knowledge-item .chapter-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.knowledge-item .content-text {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.3;
}

.progress-overview {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.progress-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar .chapter-num {
    min-width: 60px;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-bar .bar-container {
    flex: 1;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar .count {
    min-width: 30px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Importance Analysis styles */
.importance-analysis {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.importance-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.point-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.point-text {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
    line-height: 1.3;
}

.chapter-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
    align-self: flex-start;
}

.importance-bar {
    flex: 1;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.importance-bar .bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #28a745);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.count-label {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Difficulty Distribution styles */
.difficulty-distribution {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.difficulty-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-title-compact {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

.chapter-metrics {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.metric {
    background-color: #f8f9fa;
    padding: 4px 8px;
    border-radius: 12px;
}

.difficulty-bar {
    height: 12px;
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

.difficulty-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

/* Question Type Matrix styles */
.question-type-matrix {
    display: table;
    border-collapse: collapse;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.matrix-header,
.matrix-row {
    display: table-row;
}

.matrix-cell {
    display: table-cell;
    padding: 8px 12px;
    text-align: center;
    font-size: 0.8rem;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    min-width: 60px;
    width: 60px;
}

.matrix-cell:last-child {
    border-right: none;
}

.matrix-corner {
    background-color: #f8f9fa;
    font-weight: 600;
}

.matrix-chapter {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--primary-color);
}

.matrix-type {
    background-color: #f8f9fa;
    font-weight: 600;
    justify-content: flex-start;
    text-align: left;
}

.matrix-data {
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.matrix-data.has-data {
    background-color: #e3f2fd;
    color: #1976d2;
}

.matrix-data.has-data:hover {
    background-color: #bbdefb;
}

.matrix-data.no-data {
    background-color: #fafafa;
    color: #9e9e9e;
}

/* Compact Heatmap styles */
.compact-heatmap {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.compact-chapter {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compact-chapter-header {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
}

.compact-points-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.compact-point {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    background-color: #f8f9fa;
    color: var(--text-color);
    line-height: 1.2;
}

.compact-point:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.compact-point.no-questions {
    background-color: #f5f5f5;
    border-color: #d0d0d0;
    color: #999;
    opacity: 0.7;
}

.compact-point.no-questions:hover {
    background-color: #f0f0f0;
    transform: none;
    box-shadow: none;
}

.intensity-1 {
    background-color: #f3e5f5;
    border-color: #ce93d8;
}

.intensity-2 {
    background-color: #e1f5fe;
    border-color: #81d4fa;
}

.intensity-3 {
    background-color: #e8f5e8;
    border-color: #81c784;
}

.intensity-4 {
    background-color: #fff3e0;
    border-color: #ffb74d;
}

.intensity-5 {
    background-color: #ffebee;
    border-color: #e57373;
}

/* Responsive design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .container {
        padding: 15px;
    }

    .timeline-container {
        padding: 20px;
    }

    .visualization-grid {
        gap: 15px;
    }

    .matrix-cell {
        min-width: 45px;
        width: 45px;
        padding: 6px 8px;
        font-size: 0.7rem;
    }
}