/* ============================================================
 * Catalog Views — Track List, Track Detail, Comparison, Courses
 * Uses CSS custom properties from themes/*.css
 * ============================================================ */

/* --- Teaching catalog cross-nav --- */

.catalog-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--theme-border);
}

.catalog-subnav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--theme-text-muted);
    text-decoration: none;
    border: 1px solid var(--theme-border);
    border-radius: 2rem;
    background: var(--theme-bg-card);
    transition: all var(--theme-transition);
    white-space: nowrap;
}

.catalog-subnav-link:hover {
    color: var(--theme-accent);
    border-color: var(--theme-accent);
    background: rgba(var(--theme-accent-rgb), 0.06);
}

/* --- Department filter chips --- */

.dept-filter-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.dept-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--theme-text-muted);
    border: 1px solid var(--theme-border);
    border-radius: 2rem;
    background: var(--theme-bg-card);
    cursor: pointer;
    transition: all var(--theme-transition);
    user-select: none;
}

.dept-filter-chip input[type="checkbox"] {
    display: none;
}

.dept-filter-chip-label {
    display: inline-block;
}

.dept-filter-chip:hover {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

.dept-filter-chip.active {
    background: rgba(var(--theme-accent-rgb), 0.1);
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    font-weight: 600;
}

/* JS-driven active class for dept chips */
.dept-filter-chip:has(input:checked) {
    background: rgba(var(--theme-accent-rgb), 0.1);
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    font-weight: 600;
}

/* --- Inline comparison links (inside name cell) --- */

.compare-inline-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.compare-inline-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 500;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-decoration: none;
    transition: all var(--theme-transition);
    border: 1px solid var(--theme-border);
    color: var(--theme-text-muted);
}

.compare-inline-link:hover { opacity: 0.8; }

.compare-website-link {
    color: #0369a1;
    border-color: #bae6fd;
    background: #f0f9ff;
}

.compare-website-link:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
    color: #0284c7;
}

.compare-syllabus-link {
    color: var(--theme-accent);
    border-color: rgba(var(--theme-accent-rgb), 0.3);
    background: rgba(var(--theme-accent-rgb), 0.06);
}

.compare-syllabus-link:hover {
    background: rgba(var(--theme-accent-rgb), 0.12);
}

/* prereq-chip in course list / compare (matching catalog.css style) */
.prereq-chip {
    font-family: var(--theme-font-mono, monospace);
    font-size: 0.68rem;
    color: var(--theme-text);
    text-decoration: none;
    background: var(--theme-bg-alt);
    border: 1px solid var(--theme-border);
    border-radius: 3px;
    padding: 0.03rem 0.28rem;
    white-space: nowrap;
    display: inline-block;
    margin: 0.1rem 0.1rem 0.1rem 0;
    transition: border-color 0.1s, color 0.1s;
}
.prereq-chip:hover {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

/* --- Track cards (track list) --- */

.track-card .card-body {
    padding: 1.25rem;
}

.track-card-title {
    font-family: var(--theme-font-heading);
    font-weight: 600;
    font-size: 1rem;
    color: var(--theme-text-heading);
    text-decoration: none;
    line-height: 1.3;
}

.track-card-title:hover {
    color: var(--theme-accent);
}

.track-card-name-he {
    font-size: 0.8rem;
    color: var(--theme-text-muted);
    margin-top: 0.15rem;
}

.track-card-group-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--theme-text-muted);
}

.track-card-desc {
    font-size: 0.85rem;
    color: var(--theme-text);
    line-height: 1.5;
    margin-bottom: 0;
    flex: 1;
}

.track-card-credits {
    font-size: 0.8rem;
    color: var(--theme-accent);
    font-weight: 600;
}

.track-card-credits i {
    font-size: 0.7rem;
    margin-right: 0.2rem;
}

/* --- Degree badges --- */

.badge-degree {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-degree-bsc {
    background: #dbeafe;
    color: #1e40af;
}

.badge-degree-msc {
    background: #f3e8ff;
    color: #6b21a8;
}

/* --- Category badge --- */

.badge-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 2rem;
    background: var(--theme-bg-alt);
    color: var(--theme-text-muted);
    border: 1px solid var(--theme-border);
}

/* --- Compare toolbar (sticky on track list) --- */

.compare-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--theme-bg-card);
    border: 1px solid var(--theme-accent);
    border-radius: var(--theme-radius);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--theme-shadow-md);
}

.compare-toolbar-count {
    font-size: 0.85rem;
    color: var(--theme-text);
}

/* Track checkbox styling */

.track-check {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--theme-accent);
}

/* --- Credit summary bar (track detail) --- */

.credit-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--theme-bg-alt);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    overflow: hidden;
}

.credit-summary-item {
    flex: 1 1 0;
    min-width: 100px;
    text-align: center;
    padding: 1rem 0.5rem;
    border-right: 1px solid var(--theme-border);
}

.credit-summary-item:last-child {
    border-right: none;
}

.credit-summary-total {
    background: rgba(var(--theme-accent-rgb), 0.08);
}

.credit-summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-accent);
    line-height: 1.2;
    font-family: var(--theme-font-heading);
}

.credit-summary-total .credit-summary-value {
    color: var(--theme-text-heading);
}

.credit-summary-label {
    display: block;
    font-size: 0.7rem;
    color: var(--theme-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

/* --- Course row elements (shared across views) --- */

.course-name-en {
    display: block;
    font-weight: 500;
    color: var(--theme-text-heading);
    font-size: 0.9rem;
}

.course-name-he {
    display: block;
    font-size: 0.78rem;
    color: var(--theme-text-muted);
    margin-top: 0.1rem;
}

.course-notes {
    display: block;
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    font-style: italic;
    margin-top: 0.1rem;
}

/* Course code chip style (matches catalog.css .course-code-chip) */
.course-code-link {
    font-family: var(--theme-font-mono, monospace);
    font-size: 0.72rem;
    color: var(--theme-text-link);
    text-decoration: none;
    background: var(--theme-bg-alt);
    border: 1px solid var(--theme-border);
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    white-space: nowrap;
    transition: border-color 0.1s, color 0.1s;
    display: inline-block;
}
.course-code-link:hover { border-color: var(--theme-accent); color: var(--theme-accent); }

.prereq-link {
    font-family: var(--theme-font-heading);
    font-size: 0.75rem;
    white-space: nowrap;
}

.prereq-link + .prereq-link::before {
    content: ", ";
    color: var(--theme-text-muted);
}

/* --- Status badges --- */

.status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-badge.required {
    background: #dcfce7;
    color: #166534;
}

.status-badge.elective {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.additional {
    background: #fef9c3;
    color: #854d0e;
}

/* --- Choice group rows --- */

.choice-group-row td {
    background: rgba(var(--theme-accent-rgb), 0.06);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: none;
}

.choice-group-row i {
    color: var(--theme-accent);
}

tr.choice-alt td {
    padding-left: 1.5rem;
    border-left: 3px solid var(--theme-accent);
}

/* --- Course action links --- */

.course-action-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    text-decoration: none;
    padding: 0.2rem 0.35rem;
    border-radius: var(--theme-radius-sm);
    transition: all var(--theme-transition);
}

.course-action-link:hover {
    color: var(--theme-accent);
    background: rgba(var(--theme-accent-rgb), 0.08);
}

.course-action-link + .course-action-link {
    margin-left: 0.15rem;
}

/* --- Comparison view --- */

.compare-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.compare-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.compare-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--theme-border);
}

.compare-swatch-common {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.compare-swatch-partial {
    background: var(--theme-bg-card);
}

/* Compare table specifics */

.compare-table .compare-col-name { min-width: 180px; }
.compare-table .compare-col-code { white-space: nowrap; }
.compare-table .compare-col-credits { white-space: nowrap; }
.compare-table .compare-col-links { white-space: nowrap; }
.compare-table .compare-col-track { min-width: 80px; }

.compare-track-header {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.compare-subheader td {
    background: var(--theme-bg-alt);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--theme-border);
}

.compare-subheader i {
    color: var(--theme-accent);
}

tr.compare-row-common td {
    background: rgba(22, 101, 52, 0.04);
}

tr.compare-row-common:hover td {
    background: rgba(22, 101, 52, 0.08);
}

.compare-semester {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    margin-right: 0.15rem;
}

.compare-cell {
    vertical-align: middle;
}

/* --- Form label small --- */

.form-label-sm {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--theme-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

/* --- Syllabus action link (more prominent) --- */

.syllabus-action-link {
    color: var(--theme-accent) !important;
    font-weight: 500;
    border: 1px solid rgba(var(--theme-accent-rgb), 0.25);
    border-radius: 3px;
}

.syllabus-action-link:hover {
    background: rgba(var(--theme-accent-rgb), 0.15) !important;
    border-color: var(--theme-accent);
}

/* --- Compare section total row --- */

.compare-table.prereqs-hidden .prereq-col {
    display: none !important;
}

.compare-section-total td {
    background: var(--theme-bg-alt);
    border-top: 2px solid var(--theme-border);
    font-size: 0.8rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* --- Collapsible toggle button (compare + detail) --- */

.compare-collapse-btn {
    background: none;
    border: none;
    color: var(--theme-text-heading);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--theme-font-heading);
    cursor: pointer;
    padding: 0;
}

.compare-collapse-btn:hover { color: var(--theme-accent); }

.compare-collapse-icon {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.compare-collapse-btn[aria-expanded="true"] .compare-collapse-icon {
    transform: rotate(180deg);
}

.track-detail-collapse-btn {
    background: var(--theme-bg-alt);
    border: none;
    color: var(--theme-text-heading);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1rem;
    border-radius: var(--theme-radius);
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.track-detail-collapse-btn:not(.collapsed) {
    background: rgba(var(--theme-accent-rgb), 0.08);
    color: var(--theme-accent);
}

/* --- Toolbar button (outline tool style) --- */

.btn-outline-tool {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border-radius: var(--theme-radius-sm);
    border: 1px solid var(--theme-border-strong);
    background: var(--theme-bg-card);
    color: var(--theme-text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--theme-transition);
    white-space: nowrap;
}

.btn-outline-tool:hover {
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    background: rgba(var(--theme-accent-rgb), 0.06);
}

/* --- Compact view entry (always shown in track detail) --- */

.course-entry-compact {
    display: flex;
    flex-direction: column;
    padding: 0.28rem 0.85rem;
    border-bottom: 1px solid #f1f5f9;
}

.course-entry-compact:last-child { border-bottom: none; }
.course-entry-compact:hover { background: var(--theme-bg-alt); }

/* .compact-alt background is handled by .choice-group-items .course-entry-compact */

/* Inner flex row (code + badge + name + nums) */
.compact-main {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.compact-code {
    font-family: var(--theme-font-mono, monospace);
    font-size: 0.65rem;
    color: var(--theme-text-muted);
    background: var(--theme-bg-alt);
    border: 1px solid var(--theme-border);
    border-radius: 3px;
    padding: 0.02rem 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.compact-badge {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.08rem 0.3rem;
    border-radius: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.compact-badge.required  { background: #dcfce7; color: #166534; }
.compact-badge.elective  { background: #dbeafe; color: #1e40af; }
.compact-badge.additional{ background: #fef9c3; color: #854d0e; }

/* Course name — both languages always rendered, toggled by data-lang */
.compact-name {
    flex: 1;
    font-size: 0.8rem;
    color: var(--theme-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    text-decoration: none;
}
.compact-name:hover { color: var(--theme-accent); text-decoration: underline; }

.compact-name-en { display: inline; }
.compact-name-he { display: none; direction: rtl; text-align: right; }

/* Show Hebrew name in Hebrew mode */
#track-detail-body[data-lang="he"] .compact-name-en { display: none; }
#track-detail-body[data-lang="he"] .compact-name-he { display: inline; }

/* Prereq sub-row (hidden until toggled) */
.compact-prereq-row {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem 0.3rem;
    padding: 0.18rem 0 0.1rem 4.2rem;
    font-size: 0.68rem;
}

#track-detail-body.prereqs-visible .compact-prereq-row {
    display: flex;
}

.compact-prereqs-label {
    color: var(--theme-text-muted);
    font-size: 0.62rem;
    font-weight: 600;
    margin-right: 0.1rem;
    flex-shrink: 0;
}

/* --- Track detail: cap grid at 2 columns --- */

#track-detail-body .sem-card-grid {
    grid-template-columns: repeat(2, 1fr);
}

.compact-nums {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
}

.compact-credits      { font-size: 0.8rem; font-weight: 700; color: var(--theme-text-heading); }
.compact-credits-label{ font-size: 0.62rem; color: var(--theme-text-muted); cursor: help; text-decoration: underline dotted; }
.compact-sep          { font-size: 0.7rem; color: var(--theme-border-strong); }
.compact-hours        { font-size: 0.72rem; color: var(--theme-text-muted); }

.semester-total-line  { padding: 0.22rem 0.85rem; }
.choice-group-header  { font-size: 0.65rem; padding: 0.15rem 0.85rem; }

/* --- Prereq hidden class (course directory) --- */

#course-directory-body.prereqs-hidden .ce-meta { display: none !important; }

/* --- Language toggle button --- */

.lang-toggle {
    display: inline-flex;
    border-radius: var(--theme-radius-sm);
    overflow: hidden;
    border: 1px solid var(--theme-border-strong);
    flex-shrink: 0;
}

.lang-btn {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.28rem 0.7rem;
    border: none;
    background: var(--theme-bg-card);
    color: var(--theme-text-muted);
    cursor: pointer;
    transition: background var(--theme-transition), color var(--theme-transition);
    line-height: 1;
}

.lang-btn + .lang-btn {
    border-left: 1px solid var(--theme-border-strong);
}

.lang-btn:hover {
    background: rgba(var(--theme-accent-rgb), 0.08);
    color: var(--theme-accent);
}

.lang-btn.lang-btn-active {
    background: var(--theme-accent);
    color: #fff;
}

/* --- RTL overrides for Hebrew mode --- */

#track-detail-body[data-lang="he"] {
    direction: rtl;
}


#track-detail-body[data-lang="he"] .compact-prereq-row {
    padding-left: 0;
    padding-right: 4.2rem;
}

#track-detail-body[data-lang="he"] .compact-nums {
    margin-left: 0;
    margin-right: auto;
}

#track-detail-body[data-lang="he"] .breadcrumb {
    direction: ltr; /* keep breadcrumb LTR */
}

/* --- Track section heading --- */

.track-section-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-text-heading);
    font-family: var(--theme-font-heading);
    border-bottom: 2px solid var(--theme-border);
    padding-bottom: 0.4rem;
    margin: 1rem 0 0.6rem;
    letter-spacing: 0.01em;
}

/* --- Prereq hidden class (track detail) --- */

#track-detail-body.prereqs-hidden .ce-meta { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   COURSE DIRECTORY — Compact list (replaces card grid)
   ══════════════════════════════════════════════════════════════ */

/* 2-column compact list — column-first flow (fill top→bottom, then next column) */
.course-directory-list-compact {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    overflow: hidden;
    columns: 2;
    column-gap: 0;
    column-rule: 2px solid var(--theme-border-strong);
}

/* Each entry must not break across columns and must shrink to fit the column width */
.course-directory-list-compact > .course-entry-compact {
    break-inside: avoid;
    min-width: 0;
}

/* Remove bottom border on the very last item */
.course-directory-list-compact > .course-entry-compact:last-child {
    border-bottom: none;
}

/* Degree section wrapper — adds spacing between B.Sc. and M.Sc. blocks */
.cd-degree-section {
    margin-bottom: 1.25rem;
}

.cd-degree-section:last-child {
    margin-bottom: 0;
}

/* Degree section header — sits above each sub-list */
.cd-degree-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    background: var(--theme-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-radius: var(--theme-radius) var(--theme-radius) 0 0;
    border: 1px solid var(--theme-primary);
    border-bottom: none;
}

/* When the list immediately follows the header, merge their borders */
.cd-degree-section .course-directory-list-compact {
    border-radius: 0 0 var(--theme-radius) var(--theme-radius);
}

/* Prereqs shown when toggle is active */
#course-directory-body.prereqs-visible .compact-prereq-row {
    display: flex;
}

/* Language switching — scoped to course directory body */
#course-directory-body[data-lang="he"] .compact-name-en { display: none; }
#course-directory-body[data-lang="he"] .compact-name-he { display: inline; }
#course-directory-body[data-lang="he"] { direction: rtl; }

#course-directory-body[data-lang="he"] .compact-prereq-row {
    padding-left: 0;
    padding-right: 4.2rem;
}

#course-directory-body[data-lang="he"] .compact-nums {
    margin-left: 0;
    margin-right: auto;
}

#course-directory-body[data-lang="he"] .cd-actions {
    margin-left: 0;
}

#course-directory-body[data-lang="he"] .breadcrumb {
    direction: ltr;
}

#course-directory-body[data-lang="he"] .lang-btn + .lang-btn {
    border-left: none;
    border-right: 1px solid var(--theme-border-strong);
}

/* Inline action buttons (website / syllabus) — sits right of compact-nums */
.cd-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex-shrink: 0;
    margin-left: 0.3rem;
}

/* Collapse action text labels on narrower viewports */
@media (max-width: 900px) {
    .cd-action-text { display: none; }
    .cd-actions .course-action-link { padding: 0.18rem 0.3rem; }
}

/* Responsive: single column on mobile */
@media (max-width: 767.98px) {
    .course-directory-list-compact {
        columns: 1;
        column-rule: none;
    }
}

/* Keep the old card-grid styles for any legacy usage */
.course-directory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 1rem;
}

.course-directory-entry {
    height: 100%;
    margin: 0;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--theme-border);
    border-bottom: 1px solid var(--theme-border);
    border-radius: var(--theme-radius);
    background: var(--theme-bg-card);
    box-shadow: var(--theme-shadow-sm);
}

.course-directory-entry:hover {
    background: var(--theme-bg-alt);
}

/* --- ce-actions (website/syllabus links in detail entry) --- */

.ce-actions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    margin-top: 0.2rem;
}

/* --- Track notation legend --- */

.track-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0.9rem;
    background: var(--theme-bg-alt);
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-sm);
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    margin-bottom: 0.75rem;
}

.track-legend-heading {
    font-weight: 600;
    color: var(--theme-text);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.25rem;
    flex-shrink: 0;
}

.track-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.track-legend-desc {
    color: var(--theme-text-muted);
}

.track-legend-sep {
    color: var(--theme-border-strong);
    font-size: 1rem;
    line-height: 1;
}

.track-legend-code {
    font-family: var(--theme-font-mono, monospace);
    font-size: 0.72rem;
    background: var(--theme-bg-card);
    border: 1px solid var(--theme-border);
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    color: var(--theme-text);
}

.track-legend-abbr {
    font-family: var(--theme-font-mono, monospace);
    font-size: 0.72rem;
    cursor: help;
    text-decoration: underline dotted;
    color: var(--theme-text);
}

/* --- Track title language switching --- */

.track-title-he   { display: none; }
.track-group-name-he { display: none; }

#track-detail-body[data-lang="he"] .track-title-en   { display: none; }
#track-detail-body[data-lang="he"] .track-title-he   { display: block; }
#track-detail-body[data-lang="he"] .track-group-name-en { display: none; }
#track-detail-body[data-lang="he"] .track-group-name-he { display: inline; }

/* --- Catalog: 2-column sem-card-grid --- */

.catalog-wrapper .sem-card-grid {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 767.98px) {
    .catalog-wrapper .sem-card-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Catalog: "Recommended Program" sub-heading --- */

.catalog-recommended-heading {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--theme-text-heading);
    font-family: var(--theme-font-heading);
    border-bottom: 2px solid var(--theme-border);
    padding-bottom: 0.3rem;
    margin: 1rem 0 0;
    letter-spacing: 0.01em;
}

/* --- Catalog: 2-column compact list (electives) --- */

/* Card border wrapping the whole list */
ul.course-list-2col {
    border: 1px solid var(--theme-border);
    border-radius: var(--theme-radius-sm);
    overflow: hidden;
}

/* Row separator */
.course-list-2col > .course-entry-compact {
    border-bottom: 1px solid var(--theme-border);
}

/* Column divider — inline-end so it sits between columns in both LTR and RTL */
.course-list-2col > .course-entry-compact:nth-child(odd) {
    border-inline-end: 2px solid var(--theme-border-strong);
}

/* Remove bottom border from last row (both cells) */
.course-list-2col > .course-entry-compact:last-child,
.course-list-2col > .course-entry-compact:nth-last-child(2):nth-child(odd) {
    border-bottom: none;
}

/* Choice-group wraps always span both columns */
.course-list-2col > .choice-group-wrap {
    grid-column: 1 / -1;
    border-right: none;
    border-bottom: 1px solid var(--theme-border);
}

@media (max-width: 575.98px) {
    ul.course-list-2col {
        grid-template-columns: 1fr;
    }
    .course-list-2col > .course-entry-compact:nth-child(odd) {
        border-inline-end: none;
    }
}

/* --- Catalog: prereqs always visible (no toggle in catalog view) --- */

.catalog-wrapper .compact-prereq-row {
    display: flex;
}

/* Inline note (tc.notes) in compact entry */
.compact-note {
    font-size: 0.72rem;
    color: var(--theme-text-muted);
    font-style: italic;
    flex-shrink: 0;
}

/* --- Language-gated content blocks (description, requirements) --- */

.lang-content-he { display: none; }

#track-detail-body[data-lang="he"] .lang-content-en { display: none; }
#track-detail-body[data-lang="he"] .lang-content-he { display: block; }

/* --- Legend hours key: both language spans, always LTR for visual match with 3+1+0 --- */

.track-legend-hours-key {
    font-size: 0.72rem;
    color: var(--theme-text-muted);
    direction: ltr; /* keep LTR so word order matches the 3+1+0 number format */
}

.track-legend-hours-he { display: none; }

#track-detail-body[data-lang="he"] .track-legend-hours-en { display: none; }
#track-detail-body[data-lang="he"] .track-legend-hours-he { display: inline; }

/* RTL flip for lang-toggle inner border */
#track-detail-body[data-lang="he"] .lang-btn + .lang-btn {
    border-left: none;
    border-right: 1px solid var(--theme-border-strong);
}

/* --- Choice group container (vertical accent border) --- */

.choice-group-wrap {
    list-style: none;
    padding: 0;
    margin: 0.2rem 0;
    border-radius: var(--theme-radius-sm);
    overflow: hidden;
    /* Prominent left "bracket" border using box-shadow so it doesn't shift layout */
    box-shadow: inset 4px 0 0 var(--theme-highlight);
    background: linear-gradient(to right, rgba(247, 147, 29, 0.06) 4px, rgba(247, 147, 29, 0.03) 100%);
    border: 1px solid #fed7aa;
}

.choice-group-wrap .choice-group-header {
    /* Slightly more saturated header within the group */
    background: #fff1e0;
    border-top: none;
}

.choice-group-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.choice-group-items .course-entry-compact {
    /* Warm tint for alternative courses */
    background: #fffcf9;
}

.choice-group-items .course-entry-compact:hover {
    background: #fff4e6;
}

.choice-group-items .course-entry-compact:last-child {
    border-bottom: none;
}

#track-detail-body[data-lang="he"] .choice-group-wrap {
    box-shadow: inset -4px 0 0 var(--theme-highlight);
    background: linear-gradient(to left, rgba(247, 147, 29, 0.06) 4px, rgba(247, 147, 29, 0.03) 100%);
}

/* --- text-accent utility --- */

.text-accent { color: var(--theme-accent); }

/* --- Track list: Alt B grouped display --- */

/* Degree section (no-filter state) */
.degree-section-b {
    margin-bottom: 2.5rem;
}

.degree-heading-b {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--theme-primary);
    margin-bottom: 1.25rem;
}

.degree-heading-b h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--theme-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

/* Track group section */
.tg-section-b {
    margin-bottom: 1.5rem;
}

.tg-header-b {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1rem;
    background: rgba(var(--theme-accent-rgb), .07);
    border: 1px solid rgba(var(--theme-accent-rgb), .18);
    border-radius: var(--theme-radius-sm);
    margin-bottom: .75rem;
    flex-wrap: wrap;
}

.tg-header-b-icon {
    color: var(--theme-accent);
    font-size: .8rem;
    flex-shrink: 0;
}

.tg-header-b-name {
    font-weight: 600;
    font-size: .88rem;
    color: var(--theme-text-heading);
}

.tg-header-b-name-he {
    font-size: .75rem;
    color: var(--theme-text-muted);
    margin-left: .25rem;
}

.tg-header-b-count {
    margin-left: auto;
    font-size: .7rem;
    color: var(--theme-text-muted);
    white-space: nowrap;
}

/* Compact inline group description */
.tg-desc-b {
    font-size: .82rem;
    color: var(--theme-text);
    line-height: 1.5;
    padding: .45rem .9rem;
    border-left: 3px solid var(--theme-accent);
    background: var(--theme-bg-alt);
    border-radius: 0 var(--theme-radius-sm) var(--theme-radius-sm) 0;
    margin-bottom: .8rem;
}

.tg-desc-b-he {
    display: block;
    margin-top: .25rem;
    color: var(--theme-text-muted);
}

/* Group filter header (when a single group is selected) */
.group-filter-header {
    background: rgba(var(--theme-accent-rgb), .05);
    border: 1px solid rgba(var(--theme-accent-rgb), .2);
    border-radius: var(--theme-radius);
    padding: 1rem 1.25rem;
}

.group-filter-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--theme-text-heading);
    margin-bottom: .2rem;
}

.group-filter-header-he {
    font-size: .85rem;
    color: var(--theme-text-muted);
    margin-bottom: .5rem;
}

.group-filter-header-desc {
    font-size: .85rem;
    color: var(--theme-text);
    line-height: 1.55;
    margin-bottom: 0;
}

/* --- Responsive --- */

@media (max-width: 767.98px) {
    #track-detail-body .sem-card-grid {
        grid-template-columns: 1fr;
    }

    .credit-summary {
        flex-direction: column;
    }

    .credit-summary-item {
        border-right: none;
        border-bottom: 1px solid var(--theme-border);
        padding: 0.75rem 0.5rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
    }

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

    .credit-summary-value {
        font-size: 1.25rem;
        min-width: 2.5rem;
    }

    .credit-summary-label {
        margin-top: 0;
    }

    .compare-toolbar {
        position: relative;
    }

    .track-card .card-body {
        padding: 1rem;
    }

    tr.choice-alt td {
        padding-left: 1rem;
    }
}

@media (max-width: 575.98px) {
    .compare-legend {
        gap: 0.5rem;
        font-size: 0.7rem;
    }
}
