/* ============================
   LIZIU DSA - Dashboard
   Heatmap, progress rings, path cards, topic explorer
   ============================ */

/* ---- Hero Section ---- */
.hero {
    background: var(--primary-gradient);
    color: var(--white);
    padding: var(--sp-20) 0 var(--sp-16);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    color: var(--white);
    font-size: var(--text-4xl);
    margin-bottom: var(--sp-4);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hero .subtitle {
    font-size: var(--text-lg);
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto var(--sp-8);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.hero-cta {
    display: flex;
    gap: var(--sp-4);
    justify-content: center;
    margin-bottom: var(--sp-10);
}

.hero-cta .btn-primary {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.hero-cta .btn-primary:hover {
    background: var(--white);
    color: var(--primary-700);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.hero-cta .btn-outline {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--white);
}

.hero-cta .btn-outline:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--white);
    color: var(--white);
}

/* Hero Tree Animation */
.hero-tree-viz {
    margin: 0 auto var(--sp-8);
    max-width: 300px;
}

.hero-tree-viz .tree-node {
    fill: rgba(255, 255, 255, 0.9);
    animation: nodeAppear 0.5s ease-out both;
}

.hero-tree-viz .tree-edge {
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
    animation: edgeGrow 0.6s ease-out both;
}

.hero-tree-viz .tree-label {
    fill: var(--primary-700);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    text-anchor: middle;
    dominant-baseline: central;
}

@keyframes nodeAppear {
    from { r: 0; opacity: 0; }
    to { opacity: 1; }
}

@keyframes edgeGrow {
    from { stroke-dashoffset: 100; opacity: 0; }
    to { stroke-dashoffset: 0; opacity: 1; }
}

/* Stats Bar */
.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--sp-8);
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}

.hero-stat .number {
    display: block;
    font-size: var(--text-2xl);
    font-weight: 800;
}

.hero-stat .label {
    font-size: var(--text-sm);
    opacity: 0.8;
}

/* ---- Your Progress Section ---- */
.progress-section {
    padding: var(--sp-12) 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.progress-grid {
    display: grid;
    grid-template-columns: 1fr 200px 1fr;
    gap: var(--sp-8);
    align-items: start;
}

/* Heatmap */
.heatmap-container {
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.heatmap-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--sp-3);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: var(--gray-100);
    transition: background var(--transition);
}

.heatmap-cell[data-level="0"] { background: var(--gray-100); }
.heatmap-cell[data-level="1"] { background: var(--primary-200); }
.heatmap-cell[data-level="2"] { background: var(--primary-300); }
.heatmap-cell[data-level="3"] { background: var(--primary-500); }
.heatmap-cell[data-level="4"] { background: var(--primary-700); }

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    margin-top: var(--sp-3);
    justify-content: flex-end;
    font-size: var(--text-xs);
    color: var(--gray-500);
}

.heatmap-legend .cell {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

/* Progress Ring */
.progress-ring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
}

.progress-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: var(--sp-3);
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring .ring-bg {
    fill: none;
    stroke: var(--gray-200);
    stroke-width: 8;
}

.progress-ring .ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.progress-ring .ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-ring .percentage {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--primary);
}

.progress-ring .ring-label {
    font-size: var(--text-xs);
    color: var(--gray-500);
}

/* Continue Card */
.continue-card {
    padding: var(--sp-5);
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-xl);
    text-decoration: none;
    display: block;
    transition: all var(--transition);
}

.continue-card:hover {
    border-color: var(--primary-400);
    box-shadow: var(--shadow-md);
}

.continue-card .continue-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-600);
    font-weight: 600;
    margin-bottom: var(--sp-2);
}

.continue-card .continue-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--sp-2);
}

.continue-card .continue-progress {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* ---- Learning Paths ---- */
.paths-section {
    padding: var(--sp-12) 0;
}

.paths-section h2 {
    margin-bottom: var(--sp-8);
}

.path-cards {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
}

.path-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
    transition: box-shadow var(--transition);
}

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

.path-card-header {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}

.path-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.path-icon.foundations { background: #DBEAFE; }
.path-icon.trees-graphs { background: #D1FAE5; }
.path-icon.algorithms { background: #FEF3C7; }
.path-icon.advanced { background: #FCE7F3; }

.path-card-header h3 {
    margin-bottom: 0;
    font-size: var(--text-lg);
}

.path-card-header .path-count {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

/* Horizontally scrollable mini-cards */
.path-tutorials {
    display: flex;
    gap: var(--sp-3);
    overflow-x: auto;
    padding-bottom: var(--sp-2);
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.path-tutorials::-webkit-scrollbar {
    height: 4px;
}

.path-tutorials::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.mini-card {
    flex-shrink: 0;
    width: 180px;
    padding: var(--sp-3) var(--sp-4);
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--gray-700);
    scroll-snap-align: start;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.mini-card:hover {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary);
}

.mini-card .mini-name {
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.mini-card .check-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-card .check-icon.done {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
}

/* ---- Topic Explorer ---- */
.explorer-section {
    padding: var(--sp-12) 0;
    background: var(--gray-50);
}

.explorer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-6);
    flex-wrap: wrap;
    gap: var(--sp-4);
}

.explorer-filters {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

.filter-btn {
    padding: var(--sp-2) var(--sp-4);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    color: var(--gray-600);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}

.filter-btn:hover {
    border-color: var(--primary-300);
    color: var(--primary);
}

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

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
}

.topic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-5);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
}

.topic-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.topic-card-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-50);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: var(--sp-3);
}

.topic-card h3 {
    font-size: var(--text-base);
    margin-bottom: var(--sp-2);
    color: var(--gray-900);
}

.topic-card p {
    font-size: var(--text-sm);
    color: var(--gray-500);
    line-height: 1.5;
    flex: 1;
    margin-bottom: var(--sp-3);
}

.topic-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border-light);
}

.topic-card-footer .read-time {
    font-size: var(--text-xs);
    color: var(--gray-400);
}

.topic-card-footer .completion-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
}

.topic-card-footer .completion-icon.done {
    background: var(--success);
    border-color: var(--success);
}

/* ---- Big-O Reference ---- */
.bigo-section {
    padding: var(--sp-12) 0;
}

.bigo-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-3);
    height: 250px;
    padding: var(--sp-6);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    margin-top: var(--sp-6);
}

.bigo-bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-2);
    cursor: pointer;
    transition: opacity var(--transition);
}

.bigo-chart:hover .bigo-bar {
    opacity: 0.4;
}

.bigo-chart:hover .bigo-bar:hover {
    opacity: 1;
}

.bigo-bar .bar {
    width: 100%;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    transition: transform var(--transition);
    min-height: 4px;
}

.bigo-bar:hover .bar {
    transform: scaleY(1.05);
    transform-origin: bottom;
}

.bigo-bar .bar-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--gray-600);
    text-align: center;
    font-weight: 500;
}

.bigo-bar .bar-name {
    font-size: 0.65rem;
    color: var(--gray-400);
    text-align: center;
}

/* Bar color by complexity */
.bigo-bar[data-complexity="excellent"] .bar { background: var(--easy); }
.bigo-bar[data-complexity="good"] .bar { background: #34D399; }
.bigo-bar[data-complexity="fair"] .bar { background: var(--medium); }
.bigo-bar[data-complexity="poor"] .bar { background: #F97316; }
.bigo-bar[data-complexity="bad"] .bar { background: var(--hard); }
.bigo-bar[data-complexity="terrible"] .bar { background: #991B1B; }

/* ---- Track Cards (Landing Page) ---- */
.tracks-section {
    padding: var(--sp-12) 0;
}

.tracks-section h2 {
    margin-bottom: var(--sp-2);
}

.track-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-6);
    margin-top: var(--sp-6);
}

.track-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--sp-6);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.track-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-200);
}

.track-card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-4);
    margin-bottom: var(--sp-3);
}

.track-card-header .track-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.track-card-header h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.track-card-header .track-stat {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.track-card > p {
    font-size: var(--text-sm);
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: var(--sp-4);
    flex: 1;
}

.track-topics {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}

.track-tag {
    padding: 0.25rem 0.625rem;
    background: var(--primary-50);
    color: var(--primary-700);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
}

.track-cta {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
}

.track-card:hover .track-cta {
    color: var(--primary-700);
}

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

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .progress-grid {
        grid-template-columns: 1fr 1fr;
    }

    .progress-ring-container {
        grid-row: 1;
        grid-column: 2;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: var(--sp-12) 0 var(--sp-10);
    }

    .hero h1 {
        font-size: var(--text-3xl);
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .hero-stats {
        gap: var(--sp-4);
    }

    .progress-grid {
        grid-template-columns: 1fr;
    }

    .topic-grid {
        grid-template-columns: 1fr;
    }

    .bigo-chart {
        height: 200px;
        padding: var(--sp-4);
    }

    .bigo-bar .bar-label {
        font-size: 0.6rem;
    }

    .mini-card {
        width: 150px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: var(--text-2xl);
    }

    .hero-stats {
        flex-direction: column;
        gap: var(--sp-3);
    }

    .explorer-filters {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--sp-2);
    }

    .filter-btn {
        flex-shrink: 0;
    }
}
