/**
 * Track Component Styles
 *
 * Styles for learning tracks - structured learning paths with lessons.
 * Includes track listing, single track pages, and track navigation.
 */

/* ============================================
   TRACK LIST PAGE
   ============================================ */

/* Hero Header */
.tracks-header {
    margin-bottom: var(--space-10);
    padding-bottom: var(--space-8);
    border-bottom: 2px solid var(--color-border);
}

.tracks-header .badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem;
}

.tracks-title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
    line-height: 1.1;
    color: var(--color-text-primary);
}

.tracks-lead {
    font-size: var(--text-xl);
    line-height: 1.6;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.tracks-intro {
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--color-text-secondary);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Tracks Grid */
.tracks-grid {
    display: grid;
    /* Use min() to ensure grid doesn't overflow on very small screens */
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: var(--space-6);
    margin-top: var(--space-8);
}

/* Staggered fade-in animation for track cards */
.tracks-grid .track-card {
    opacity: 0;
    transform: translateY(20px);
    animation: track-card-fade-in 0.6s ease-out forwards;
}

.tracks-grid .track-card:nth-child(1) {
    animation-delay: 0ms;
}

.tracks-grid .track-card:nth-child(2) {
    animation-delay: 100ms;
}

.tracks-grid .track-card:nth-child(3) {
    animation-delay: 200ms;
}

.tracks-grid .track-card:nth-child(4) {
    animation-delay: 300ms;
}

.tracks-grid .track-card:nth-child(5) {
    animation-delay: 400ms;
}

.tracks-grid .track-card:nth-child(n+6) {
    animation-delay: 500ms;
}

@keyframes track-card-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .tracks-grid .track-card {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tracks-grid {
        grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
        gap: var(--space-5);
    }
}

@media (max-width: 768px) {
    .tracks-header {
        margin-bottom: var(--space-8);
        padding-bottom: var(--space-6);
    }

    .tracks-title {
        font-size: var(--text-3xl);
    }

    .tracks-lead {
        font-size: var(--text-lg);
    }

    .tracks-intro {
        font-size: var(--text-base);
    }

    .tracks-grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
        margin-top: var(--space-6);
    }

    .track-card-header {
        padding: var(--space-5);
        padding-bottom: var(--space-3);
    }

    .track-card-content {
        padding: 0 var(--space-5);
    }

    .track-card-footer {
        padding: var(--space-5);
        padding-top: var(--space-3);
    }
}

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

    .track-card-icon {
        width: 40px;
        height: 40px;
    }

    .track-card-title {
        font-size: var(--text-base);
    }
}

/* Track Card - Neumorphic style matching landing page */
.track-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg,
        var(--color-surface, var(--color-bg-elevated)),
        var(--color-bg-secondary));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--neumorphic-base);
    overflow: hidden;
    transition:
        transform var(--motion-medium) var(--ease-out),
        box-shadow var(--motion-medium) var(--ease-out),
        border-color var(--motion-fast);
    height: 100%;
    position: relative;
}

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

/* Card Header */
.track-card-header {
    padding: var(--space-6);
    padding-bottom: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
}

.track-card-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg,
        var(--color-surface, var(--color-bg-elevated)),
        var(--color-bg-tertiary));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--neumorphic-subtle);
    color: var(--color-primary);
    font-size: 1.5rem;
    transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.track-card:hover .track-card-icon {
    transform: scale(1.05);
    box-shadow: var(--neumorphic-hover);
}

.track-card-title {
    flex: 1;
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    line-height: 1.3;
}

.track-card-title a {
    color: var(--color-text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.track-card-title a:hover {
    color: var(--color-primary);
}

/* Card Content */
.track-card-content {
    flex: 1;
    padding: 0 var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.track-card-description {
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    line-height: 1.6;
    color: var(--color-text-secondary);
    margin: 0;
}

/* Track Meta */
.track-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.track-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(180deg,
        var(--color-surface, var(--color-bg-elevated)),
        var(--color-bg-tertiary));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--neumorphic-subtle);
}

.track-meta-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Track Preview */
.track-card-preview {
    margin-top: var(--space-2);
}

.track-preview-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-2);
}

.track-preview-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.track-preview-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.track-preview-number {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg,
        var(--color-surface, var(--color-bg-elevated)),
        var(--color-bg-tertiary));
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    border-radius: 50%;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    box-shadow: var(--neumorphic-subtle);
}

.track-preview-title {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

.track-preview-more {
    margin-top: var(--space-1);
    padding-left: calc(20px + var(--space-2));
}

.track-preview-more-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-style: italic;
}

/* Card Footer */
.track-card-footer {
    padding: var(--space-6);
    padding-top: var(--space-4);
    margin-top: auto;
    border-top: 1px solid var(--color-border);
}

.track-card-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    justify-content: center;
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(180deg,
        var(--color-primary),
        var(--color-primary-dark));
    color: var(--color-text-inverse);
    border: 1px solid var(--color-primary-dark);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: var(--weight-semibold);
    font-size: var(--text-base);
    cursor: pointer;

    /* Neumorphic shadow */
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1),
        0 2px 4px rgba(0, 0, 0, 0.1);

    transition:
        transform var(--motion-fast) var(--ease-out),
        box-shadow var(--motion-fast),
        background var(--motion-fast);
}

.track-card-button:hover {
    background: linear-gradient(180deg,
        var(--color-primary-hover),
        var(--color-primary));
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08),
        0 4px 8px rgba(0, 0, 0, 0.12);
}

.track-card-button:active {
    transform: translateY(0) scale(0.98);
    background: linear-gradient(180deg,
        var(--color-primary-dark),
        var(--color-primary-active));
    box-shadow:
        inset 2px 2px 4px rgba(0, 0, 0, 0.2),
        inset -1px -1px 2px rgba(255, 255, 255, 0.1);
}

.track-card-button svg {
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.track-card-button:hover svg {
    transform: translateX(2px);
}

.track-card-button-disabled {
    background: var(--color-surface-elevated);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.track-card-button-disabled:hover {
    background: var(--color-surface-elevated);
    transform: none;
    box-shadow: none;
}

/* Empty State */
.tracks-empty {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    margin-top: var(--space-8);
}

.tracks-empty-icon {
    margin: 0 auto var(--space-4);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-elevated);
    border-radius: 50%;
    color: var(--color-text-muted);
}

.tracks-empty-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
    color: var(--color-text-primary);
}

.tracks-empty-text {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.tracks-empty-text code {
    background: var(--color-surface-elevated);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
}


/* ============================================
   COMPACT TRACK CARDS (LMS Style)
   ============================================ */

/* Compact Card Modifier */
.track-card--compact {
    /* Reduce overall card height */
}

.track-card--compact .track-card-header {
    padding: var(--space-4);
    padding-bottom: var(--space-2);
    align-items: center;
}

.track-card--compact .track-card-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

.track-card--compact .track-card-title {
    font-size: var(--text-base);
    flex: 1;
    min-width: 0;
}

/* Lesson count badge inline with title */
.track-card-count {
    flex-shrink: 0;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-3);
    white-space: nowrap;
}

.track-card--compact .track-card-content {
    padding: 0 var(--space-4);
    gap: var(--space-3);
}

/* Description: 2-line clamp */
.track-card--compact .track-card-description {
    font-size: var(--text-sm);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

/* Horizontal preview chips */
.track-preview-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.track-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    background: linear-gradient(180deg,
        var(--color-surface, var(--color-bg-elevated)),
        var(--color-bg-tertiary));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: var(--space-1) var(--space-3);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-preview-chip-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-radius: 50%;
    font-size: 10px;
    font-weight: var(--weight-bold);
    flex-shrink: 0;
}

.track-preview-chip--more {
    color: var(--color-text-muted);
    font-style: italic;
    background: transparent;
    border-style: dashed;
}

.track-card--compact .track-card-footer {
    padding: var(--space-4);
    padding-top: var(--space-3);
}

.track-card--compact .track-card-button {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

/* Tighter grid for compact cards */

/* Compact header variant */
.tracks-header--compact {
    text-align: left;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.tracks-header--compact .tracks-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-2);
}

.tracks-header--compact .tracks-lead {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    margin: 0;
    max-width: none;
}

@media (max-width: 768px) {
    .tracks-header--compact .tracks-title {
        font-size: var(--text-xl);
    }
}
.tracks-grid:has(.track-card--compact) {
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--space-4);
}

/* Responsive adjustments for compact cards */
@media (max-width: 768px) {
    .track-card--compact .track-card-header {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .track-card-count {
        order: 3;
        margin-left: calc(32px + var(--space-3));
    }

    .track-preview-chip {
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .track-card--compact .track-card-icon {
        width: 28px;
        height: 28px;
    }

    .track-card-count {
        margin-left: calc(28px + var(--space-3));
    }

    .track-preview-chips {
        flex-direction: column;
        align-items: flex-start;
    }

    .track-preview-chip {
        max-width: 100%;
    }
}

/* ============================================
   TRACK NAVIGATION COMPONENT
   ============================================ */

.track-navigation {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.track-navigation .card-header {
    background: var(--color-surface-elevated);
    border-bottom: 1px solid var(--color-border);
}

/* ============================================
   TRACK PROGRESS INDICATOR (Step Dots)
   ============================================ */

/* Bootstrap-style progress bar (used in track_nav) */
.progress {
  display: flex;
  overflow: hidden;
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
}

.progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.track-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6) 0;
    margin-top: var(--space-6);
}

.track-progress__steps {
    display: flex;
    align-items: center;
    gap: 0;
}

.track-progress__step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-surface-elevated);
    border: 2px solid var(--color-border);
    transition: all 0.3s ease;
}

.track-progress__step--current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-muted, rgba(var(--color-primary-rgb, 99, 102, 241), 0.2));
    transform: scale(1.1);
}

.track-progress__step--complete {
    background: var(--color-success-bg, #10b981);
    border-color: var(--color-success-border, #059669);
}

.track-progress__number {
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    color: var(--color-text-muted);
    line-height: 1;
}

.track-progress__step--current .track-progress__number {
    color: var(--color-text-inverse, #fff);
}

.track-progress__step--complete .track-progress__number {
    color: var(--color-text-inverse, #fff);
    font-size: var(--text-base);
}

.track-progress__connector {
    width: 40px;
    height: 3px;
    background: var(--color-border);
    transition: background 0.3s ease;
}

.track-progress__connector--complete {
    background: var(--color-success-bg, #10b981);
}

.track-progress__label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive sizing for mobile */
@media (max-width: 575.98px) {
    .track-progress__step {
        width: 32px;
        height: 32px;
    }

    .track-progress__step--current {
        transform: scale(1.05);
    }

    .track-progress__connector {
        width: 24px;
    }

    .track-progress__number {
        font-size: var(--text-xs);
    }

    .track-progress__step--complete .track-progress__number {
        font-size: var(--text-sm);
    }
}

/* Animation for step transitions */
@keyframes track-step-pulse {
    0%, 100% {
        box-shadow: 0 0 0 4px var(--color-primary-muted, rgba(99, 102, 241, 0.2));
    }
    50% {
        box-shadow: 0 0 0 8px var(--color-primary-muted, rgba(99, 102, 241, 0.1));
    }
}

.track-progress__step--current {
    animation: track-step-pulse 2s ease-in-out infinite;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .track-progress__step--current {
        animation: none;
    }

    .track-progress__step,
    .track-progress__connector {
        transition: none;
    }
}

/* Responsive navigation buttons */
@media (max-width: 575.98px) {
    .track-navigation .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* ============================================
   TRACK SINGLE PAGE
   ============================================ */

.track-page {
    /* Container for entire track */
}

.track-header {
    padding-bottom: var(--space-6);
    border-bottom: 2px solid var(--color-border);
}

.track-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.track-intro {
    /* Introduction content styling */
    font-size: var(--text-base);
    line-height: 1.7;
}

/* ============================================
   TRACK SYLLABUS / TRACK CONTENTS
   ============================================ */

.track-syllabus {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.track-syllabus .card-header {
    background: var(--color-surface-elevated);
    border-bottom: 1px solid var(--color-border);
    font-weight: var(--weight-semibold);
}

/* Track Contents List (Bootstrap list-group in card) */
/* Override height: 100% from cards.css that causes excessive stretching */
.track-contents-card {
    height: auto !important;
}

/* Compact card header */
.track-contents-card .card-header {
    padding: 0.75rem 1rem !important;
}

.track-contents-card .card-header h2 {
    font-size: 0.875rem !important;
    font-weight: var(--weight-semibold) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.card .list-group-flush {
    display: flex;
    flex-direction: column;
}

.card .list-group-flush .list-group-item {
    min-height: auto !important;
    height: auto !important;
    flex-shrink: 0;
    flex-grow: 0;
    padding: 0.625rem 1rem !important;
    /* Even more compact padding */
}

.card .list-group-flush .list-group-item.d-flex {
    align-items: flex-start;
    /* Changed from center to start for better alignment */
    flex-wrap: nowrap;
}

.card .list-group-flush .list-group-item .flex-grow-1 {
    flex-grow: 1;
    min-width: 0;
    flex-basis: auto;
    flex-shrink: 1;
}

/* Compact title - now just a div with fw-semibold */
.card .list-group-flush .list-group-item .fw-semibold {
    font-size: 0.875rem !important;
    line-height: 1.4;
    margin-bottom: 0;
}

.card .list-group-flush .list-group-item p {
    margin-bottom: 0 !important;
    margin-top: 0.25rem !important;
    line-height: 1.4;
    font-size: 0.8125rem;
}

.track-syllabus-item {
    transition: background-color 0.2s ease, transform 0.1s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.track-syllabus-item:hover:not(.disabled) {
    background: var(--color-surface-elevated);
    border-left-color: var(--color-primary);
    transform: translateX(2px);
}

.track-syllabus-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.track-lesson-number {
    font-size: 0.875rem;
    font-weight: var(--weight-semibold);
    transition: all 0.2s ease;
}

.track-syllabus-item:hover:not(.disabled) .track-lesson-number {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

/* ============================================
   TRACK PILLAR PAGE LAYOUT
   ============================================ */

.track-layout {
    /* Uses docs-layout grid */
}

.track-main {
    /* Main content area */
}

.track-article {
    /* Pillar page article styling */
}

.track-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 2px solid var(--color-border);
}

.track-header .badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.375rem 0.75rem;
}

.track-header h1 {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    margin-top: var(--space-4);
    margin-bottom: var(--space-4);
    line-height: 1.2;
}

.track-intro {
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-8);
}

/* Track Contents Overview */
.track-contents-overview {
    margin-bottom: var(--space-8);
    padding: var(--space-5);
    background: var(--color-surface-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.track-contents-overview h2 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-4);
    color: var(--color-text-primary);
}

.track-contents-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.track-contents-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.track-contents-item:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    transform: translateX(2px);
}

.track-contents-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-radius: 50%;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
}

.track-contents-content {
    flex: 1;
    min-width: 0;
}

.track-contents-title {
    font-weight: var(--weight-semibold);
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
    color: var(--color-text-primary);
}

.track-contents-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* ============================================
   TRACK SIDEBAR
   ============================================ */

.track-sidebar-container {
    /* Uses docs-sidebar styling */
}

.track-sidebar {
    /* Track sidebar navigation */
}

/* ============================================
   TRACK NAVIGATION (Left Sidebar)
   Uses data-bengal="track-nav" for JS targeting
   ============================================ */

/* Section navigation (current track lessons) */
.track-nav-sections {
    margin-bottom: var(--space-6);
}

.track-nav-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}

.track-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    counter-reset: none; /* Using explicit numbers, not counter */
}

.track-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.track-nav-link:hover {
    background: var(--color-surface-elevated);
    color: var(--color-text-primary);
}

/* Active state via data attribute (JS sets this) */
.track-nav-link[data-track-active],
.track-nav-link.is-active {
    background: var(--color-primary-muted);
    color: var(--color-primary);
    font-weight: var(--weight-semibold);
}

.track-nav-number {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.track-nav-link[data-track-active] .track-nav-number,
.track-nav-link.is-active .track-nav-number {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
}

.track-nav-label {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
}

/* ============================================
   PROGRESS STATES (set by JS)
   ============================================ */

/* Visited state - section has been viewed (subtle indicator) */
.track-nav-link[data-track-visited]:not([data-track-active]) {
    color: var(--color-text-primary);
}

/* Completed state - section scrolled past (checkmark) */
.track-nav-link[data-track-completed]:not([data-track-active]) .track-nav-number {
    position: relative;
    background: var(--color-success-bg);
    border-color: var(--color-success-border);
    font-size: 0; /* Hide number text */
}

/* Checkmark icon for completed sections */
.track-nav-link[data-track-completed]:not([data-track-active]) .track-nav-number::before {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    /* Use success-text for contrast against success-bg */
    color: var(--color-success-text);
}

/* Active state overrides completed styling */
.track-nav-link[data-track-active] .track-nav-number,
.track-nav-link.is-active .track-nav-number {
    font-size: var(--text-xs);
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.track-nav-link[data-track-active] .track-nav-number::before,
.track-nav-link.is-active .track-nav-number::before {
    display: none;
}

/* ============================================
   RESUME BANNER
   ============================================ */

.track-resume-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-6);
    background: var(--color-primary-muted);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-lg);
    animation: track-resume-slide-in 0.3s ease-out;
}

@keyframes track-resume-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.track-resume-banner--dismissed {
    animation: track-resume-slide-out 0.3s ease-out forwards;
}

@keyframes track-resume-slide-out {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.track-resume-text {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.track-resume-button {
    padding: var(--space-2) var(--space-3);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.track-resume-button:hover {
    background: var(--color-primary-hover);
}

.track-resume-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: auto;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.track-resume-dismiss:hover {
    background: var(--color-surface-elevated);
    color: var(--color-text-primary);
}

/* Other tracks section */
.track-nav-other {
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.track-nav-tracks {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.track-nav-track-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.track-nav-track-link:hover {
    background: var(--color-surface-elevated);
    border-color: var(--color-primary);
}

.track-nav-track-title {
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
    line-height: 1.3;
}

.track-nav-track-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ============================================
   TRACK LESSONS / SECTIONS
   ============================================ */

.track-content {
    /* Container for all lessons */
}

.track-section {
    scroll-margin-top: var(--space-8);
    padding-top: var(--space-6);
    padding-bottom: var(--space-8);
    margin-bottom: var(--space-8);
    position: relative;
}

/* Gradient fade divider between sections */
.track-section::after {
    content: '';
    display: block;
    height: 2px;
    margin-top: var(--space-6);
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--color-primary) 30%,
        var(--color-primary) 70%,
        transparent 100%
    );
    opacity: 0.35;
}

/* ============================================
   TRACK TOC FILTERING
   When a section is active, only show its TOC items
   ============================================ */

/* ============================================
   TOC FILTERING FOR TRACKS
   JS sets data-track-filtering and data-toc-active
   Only affects section-level groups (data-toc-section), not nested groups
   ============================================ */

/* Hide all SECTION-LEVEL groups by default when filtering is active */
/* Nested groups within sections are unaffected and remain visible */
.track-layout .toc-sidebar[data-track-filtering="true"] .toc-group[data-toc-section] {
    display: none;
}

/* Show only the active section's TOC group (via data attribute) */
.track-layout .toc-sidebar[data-track-filtering="true"] .toc-group[data-toc-section][data-toc-active] {
    display: block;
}

/* Hide the count badge on section headers - not needed for tracks (always expanded) */
/* Keep count badges visible on nested groups within active section */
.track-layout .toc-sidebar[data-track-filtering="true"] > .toc-nav .toc-items > .toc-item > .toc-group > .toc-group-header > .toc-count-badge {
    display: none;
}

/* Style the active section header - cleaner without toggle */
.track-layout .toc-sidebar[data-track-filtering="true"] .toc-group[data-toc-section][data-toc-active] > .toc-group-header {
    margin-bottom: var(--space-2);
}

.track-layout .toc-sidebar[data-track-filtering="true"] .toc-group[data-toc-section][data-toc-active] .toc-link-h2 {
    font-weight: var(--weight-semibold);
    color: var(--color-primary);
}

/* Expand the active section group's children */
.track-layout .toc-sidebar[data-track-filtering="true"] .toc-group[data-toc-section][data-toc-active] > .toc-subitems {
    display: block !important;
}

.track-section:last-of-type {
    margin-bottom: 0;
}

.track-section:last-of-type::after {
    display: none;
}

.track-section-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}

.track-section-number {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-radius: var(--radius-lg);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
}

.track-section-title-group {
    flex: 1;
    min-width: 0;
    /* Small nudge to align title cap-height with number box */
    padding-top: 2px;
}

.track-section-title {
    font-family: var(--font-heading-section);
    font-size: var(--text-h2);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-tighter);
    line-height: 1.15;
    margin: 0 0 var(--space-1) 0;
    color: var(--color-text-primary);
}

.track-section-description {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

.track-section-content {
    /* Content styling handled by prose class */
    margin-top: var(--space-6);
}

.track-section-content .prose {
    max-width: 100%;
}

/* Hide the first heading (demoted page title) since it's already shown in track-section-header */
.track-section-content > h2:first-child,
.track-section-content > h3:first-child,
.track-section-content > .prose > h2:first-child,
.track-section-content > .prose > h3:first-child {
    display: none !important;
}

.track-complete {
    display: flex;
    justify-content: center;
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
}

.track-lesson {
    scroll-margin-top: var(--space-8);
    /* For smooth scroll to anchor */
    padding-top: var(--space-6);
    border-top: 2px solid var(--color-border);
}

.track-lesson:first-of-type {
    border-top: none;
    padding-top: 0;
}

.track-lesson-badge {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.lesson-header {
    margin-bottom: var(--space-6);
}

.lesson-body {
    /* Content styling handled by prose class */
}

.lesson-footer {
    padding-top: var(--space-5);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-6);
}

.lesson-footer .btn {
    min-width: 120px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 767.98px) {
    .track-header {
        text-align: left;
        padding-bottom: var(--space-4);
    }

    .track-meta {
        justify-content: flex-start;
    }

    .track-lesson {
        padding-top: var(--space-4);
    }

    .lesson-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .lesson-footer .btn {
        width: 100%;
    }

    .track-syllabus-item {
        padding: var(--space-3) !important;
    }
}

@media (max-width: 575.98px) {
    .track-card-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .track-syllabus-item {
        flex-wrap: wrap;
    }

    .track-lesson-number {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.75rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {

    .track-navigation,
    .track-syllabus,
    .lesson-footer {
        display: none;
    }

    .track-lesson {
        page-break-inside: avoid;
        border-top: 1px solid #000;
        padding-top: 1rem;
        margin-bottom: 1.5rem;
    }

    .track-lesson:first-of-type {
        border-top: none;
    }

    .track-header {
        border-bottom: 2px solid #000;
        margin-bottom: 1rem;
    }

    .lesson-header {
        margin-bottom: 0.5rem;
    }

    .track-lesson-badge {
        border: 1px solid #000;
        background: transparent !important;
        color: #000 !important;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .track-card:hover {
        box-shadow: 0 4px 12px rgba(255, 255, 255, 0.05);
    }

    .track-syllabus-item:hover:not(.disabled) {
        background: var(--color-surface-elevated);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus styles for keyboard navigation */
.track-syllabus-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-left-color: var(--color-primary);
}

.track-navigation .btn:focus-visible,
.lesson-footer .btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .track-card,
    .track-syllabus-item,
    .track-progress .progress-bar {
        transition: none;
    }

    .track-card:hover {
        transform: none;
    }

    .track-syllabus-item:hover:not(.disabled) {
        transform: none;
    }
}

/* ============================================
   SMOOTH SCROLL BEHAVIOR
   ============================================ */

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}
