.concept-map-page {
    background: #0f172a;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.page-header {
    text-align: center;
    margin-bottom: 20px;
}

.page-header h2 {
    color: #e2e8f0;
    font-size: 1.6em;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.page-header p {
    color: #94a3b8;
    font-size: 0.95em;
}

.map-stats {
    margin-bottom: 15px;
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-num {
    font-size: 1.8em;
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.2;
}

.stat-label {
    color: #94a3b8;
    font-size: 0.8em;
    font-weight: 500;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.total-stat { border-bottom: 3px solid #6366f1; }
.mastered-stat { border-bottom: 3px solid #10b981; }
.mastered-stat .stat-num { color: #34d399; }
.learning-stat { border-bottom: 3px solid #f59e0b; }
.learning-stat .stat-num { color: #fbbf24; }
.beginner-stat { border-bottom: 3px solid #6366f1; }
.beginner-stat .stat-num { color: #818cf8; }

.map-legend {
    display: flex;
    gap: 18px;
    justify-content: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82em;
    color: #94a3b8;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
    transform: rotate(45deg);
}

.legend-dot.mastered { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.legend-dot.learning { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
.legend-dot.beginner { background: #6366f1; box-shadow: 0 0 6px rgba(99, 102, 241, 0.5); }
.legend-dot.not-started { background: #64748b; }

.concept-map-container {
    position: relative;
    width: 100%;
    min-height: 520px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
}

#concept-canvas {
    display: block;
    cursor: default;
}

.node-detail-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 250px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 10;
    backdrop-filter: blur(15px);
}

.detail-header {
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-header h3 {
    font-size: 1em;
    color: #e2e8f0;
    margin: 0;
    font-weight: 600;
}

.detail-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 600;
    color: white;
    text-transform: capitalize;
}

.detail-body {
    padding: 14px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row span:first-child { color: #94a3b8; }
.detail-row span:last-child { color: #e2e8f0; font-weight: 600; }

.detail-mastery-bar {
    margin-top: 10px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.detail-mastery-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.loading-map {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 80px 20px;
    color: #94a3b8;
    font-size: 1em;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-map-message {
    text-align: center;
    padding: 70px 20px;
}

.empty-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    font-size: 0.75em;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}

.empty-map-message h3 {
    color: #e2e8f0;
    font-size: 1.3em;
    margin-bottom: 10px;
}

.empty-map-message p {
    color: #94a3b8;
    margin-bottom: 8px;
    line-height: 1.7;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-practice {
    display: inline-block;
    margin-top: 18px;
    padding: 10px 28px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-practice:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.error-message {
    text-align: center;
    padding: 50px 20px;
    color: #f87171;
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .node-detail-panel {
        width: calc(100% - 30px);
        top: auto; bottom: 15px; right: 15px; left: 15px;
    }
}
