/* Figma Color Variables */
:root {
    --crimson-red: #A41034;
    --background-red: #AB6161;
    --black: #000000;
    --white: #FFFFFF;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-size: 1.1rem;
    color: var(--black);
    line-height: 1.6;
    background-color: #fff;
    background-image: url("../images/page-background.png");
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: center center;
    background-size: cover;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Bar */
.navbar {
    background-color: var(--crimson-red);
    color: var(--white);
    padding: 0.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    position: relative;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.9;
}

.logo-image {
    height: 55px;
    width: auto;
    max-width: 275px;
    object-fit: contain;
}

.logo-text-image {
    height: 44px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: 3rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-auth {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.nav-link-active {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.nav-icon {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.nav-username {
    color: var(--white);
    font-weight: 500;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    flex: 1;
}

/* Matches page - stretch to fill more space */
.main-content:has(.matches-container) {
    max-width: 98%;
    padding: 0 0.5rem;
}

/* Search page */
.main-content:has(.search-container) {
    max-width: 98%;
    width: 100%;
    padding: 0 0.5rem;
}

.search-container {
    max-width: 1400px;
    margin: 0 auto;
}

.search-page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 1rem;
}

.search-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.search-field-label {
    flex: 1;
    min-width: 200px;
    display: flex;
}

.search-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fafafa;
}

.search-input:focus {
    outline: 2px solid var(--crimson-red);
    outline-offset: 1px;
    border-color: var(--crimson-red);
    background: var(--white);
}

.search-term-wrap {
    display: flex;
    align-items: center;
}

.search-term-select {
    padding: 0.55rem 2rem 0.55rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: var(--white);
    cursor: pointer;
    min-width: 7.5rem;
}

.search-clear-btn {
    font: inherit;
    cursor: pointer;
    background: transparent;
}

.search-clear-btn:focus-visible {
    outline: 2px solid var(--crimson-red);
    outline-offset: 2px;
}

.search-filter-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.search-clear-link {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border: 1px solid var(--crimson-red);
    border-radius: 6px;
    color: var(--crimson-red);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}

.search-clear-link:hover {
    background: rgba(164, 16, 52, 0.08);
}

.search-filters-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #555;
    background: #eee;
    border-radius: 999px;
}

.search-table-wrap {
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}

.search-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.search-results-table thead th {
    text-align: left;
    padding: 0.75rem 0.85rem;
    border-bottom: 2px solid #ddd;
    color: #333;
    font-weight: 600;
    white-space: nowrap;
    background: #fafafa;
}

.search-results-table tbody td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #eee;
    vertical-align: top;
    color: #222;
}

.search-results-table tbody tr:hover {
    background: #f9f9f9;
}

.search-col-num {
    position: relative;
    font-weight: 600;
    white-space: nowrap;
    padding-left: 0.65rem;
}

.search-row-accent {
    position: absolute;
    left: 0;
    top: 0.35rem;
    bottom: 0.35rem;
    width: 3px;
    background: var(--crimson-red);
    border-radius: 2px;
}

.search-col-title {
    max-width: 28rem;
}

.search-col-time {
    color: #444;
    font-size: 0.88rem;
    white-space: nowrap;
}

.search-no-rows,
.search-hint,
.search-empty-panel {
    padding: 1rem 1.25rem;
    color: #555;
    line-height: 1.5;
}

.search-empty-panel {
    background: #fff8f8;
    border: 1px solid rgba(164, 16, 52, 0.25);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.search-empty-panel a {
    color: var(--crimson-red);
    font-weight: 600;
}

.search-no-rows {
    text-align: center;
    padding: 2rem 1rem;
}

.search-hint {
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.search-hint--below {
    margin-top: 0.75rem;
    color: #666;
}

.search-limit-note {
    margin-top: 0.65rem;
    font-size: 0.85rem;
    color: #666;
}

.search-add-form {
    margin: 0;
}

.search-add-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1b5e20;
    background: rgba(232, 245, 233, 0.9);
    border: 1px solid #2e7d32;
    border-radius: 6px;
    cursor: pointer;
}

.search-add-btn:hover {
    background: #e8f5e9;
}

.search-saved-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #666;
}

.search-col-action {
    white-space: nowrap;
    width: 5rem;
}

.search-adv-toggle-wrap {
    margin-bottom: 0.75rem;
}

.search-adv-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #333;
    background: var(--white);
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.search-adv-toggle:hover {
    background: #f5f5f5;
    border-color: #aaa;
}

.search-adv-toggle--open {
    background: #f0f0f0;
    border-color: #999;
}

.search-adv-toggle-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.search-adv-toggle--open .search-adv-toggle-arrow {
    transform: rotate(90deg);
}

.search-adv-panel {
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.85rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.search-adv-section {
    margin-bottom: 1rem;
}

.search-adv-section:last-child {
    margin-bottom: 0;
}

.search-adv-heading {
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.search-day-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.search-day-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.search-day-btn:hover {
    background: #eee;
    border-color: #aaa;
}

.search-day-btn.active {
    background: var(--crimson-red);
    color: var(--white);
    border-color: var(--crimson-red);
}

.search-time-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.search-preset-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #333;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.search-preset-btn:hover {
    background: #eee;
    border-color: #aaa;
}

.search-preset-btn.active {
    background: var(--crimson-red);
    color: var(--white);
    border-color: var(--crimson-red);
}

.search-time-range {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.search-time-label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #555;
}

.search-time-select {
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    font-size: 0.88rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: var(--white);
    appearance: auto;
    min-width: 130px;
}

.search-time-select:focus {
    outline: 2px solid var(--crimson-red);
    outline-offset: 1px;
    border-color: var(--crimson-red);
}

.search-adv-actions {
    padding-top: 0.25rem;
    border-top: 1px solid #eee;
    margin-top: 0.25rem;
}

.search-adv-clear-btn {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--crimson-red);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.search-adv-clear-btn:hover {
    color: #8a0d2a;
}

/* Calendar page — near full viewport */
.main-content:has(.calendar-page) {
    max-width: 100%;
    width: 100%;
    margin: 0.35rem 0 0.5rem;
    padding: 0 0.35rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.calendar-page {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.calendar-layout {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex: 1;
    min-height: calc(100dvh - 7.5rem);
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e5e5e5;
}

.calendar-sidebar {
    width: min(240px, 22vw);
    flex-shrink: 0;
    padding: 1.1rem 0.75rem;
    border-right: 1px solid #ddd;
    background: #fafafa;
    overflow-y: auto;
}

.calendar-sidebar-section + .calendar-sidebar-section {
    margin-top: 1.75rem;
}

.calendar-sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.calendar-placeholder-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.calendar-placeholder-list--tight {
    margin-top: 0.75rem;
}

.calendar-placeholder-bar {
    height: 10px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e8e8e8, #f2f2f2);
}

.calendar-course-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.calendar-course-line {
    font-size: 0.82rem;
    line-height: 1.35;
    color: #333;
}

.calendar-course-code {
    font-weight: 600;
    display: block;
}

.calendar-course-meta {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 0.15rem;
}

.calendar-empty-hint {
    font-size: 0.82rem;
    color: #777;
    line-height: 1.4;
    margin: 0;
}

.calendar-sidebar-divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 0.5rem 0 0.75rem;
}

.calendar-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: #444;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.calendar-checkbox {
    width: 1rem;
    height: 1rem;
    accent-color: var(--crimson-red);
}

.calendar-board {
    flex: 1;
    min-width: 0;
    padding: 1rem 1rem 1rem 0.5rem;
    display: flex;
    flex-direction: column;
}

.calendar-row-label {
    font-size: 0.8rem;
    color: #b0b0b0;
    margin: 0 0 0.35rem 52px;
}

.calendar-board-header {
    display: flex;
    align-items: stretch;
    margin-bottom: 0;
}

.calendar-corner {
    width: 56px;
    flex-shrink: 0;
}

.calendar-day-headers {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--cal-days, 5), minmax(0, 1fr));
    gap: 0;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.calendar-board-body {
    display: flex;
    flex: 1;
    min-height: var(--cal-axis-px, 448px);
    align-items: stretch;
}

.calendar-time-axis {
    width: 56px;
    flex-shrink: 0;
    min-height: var(--cal-axis-px, 448px);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    align-self: stretch;
}

.calendar-time-slot {
    flex: 1;
    font-size: 0.7rem;
    color: #9a9a9a;
    padding: 2px 4px 0 0;
    border-top: 1px solid #eaeaea;
    line-height: 1.2;
    min-height: 0;
}

.calendar-time-slot:first-child {
    border-top: none;
}

.calendar-columns {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    min-width: 0;
    min-height: var(--cal-axis-px, 448px);
    align-self: stretch;
}

.calendar-columns--week {
    grid-template-columns: repeat(var(--cal-days, 5), minmax(0, 1fr));
}

.calendar-day-headers--week {
    grid-template-columns: repeat(var(--cal-days, 5), minmax(0, 1fr));
}

.calendar-day-col {
    border-left: 1px solid #e8e8e8;
    min-width: 0;
}

.calendar-day-col:first-child {
    border-left: none;
}

.calendar-day-grid {
    position: relative;
    height: 100%;
    background-image: repeating-linear-gradient(
        to bottom,
        #f3f3f3 0,
        #f3f3f3 1px,
        transparent 1px,
        transparent calc(100% / var(--cal-intervals, 8))
    );
}

.cal-event {
    border-radius: 4px;
    padding: 3px 4px;
    font-size: clamp(0.55rem, 0.9vw, 0.72rem);
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    border: 2px solid;
    box-sizing: border-box;
    z-index: 1;
}

.cal-event-block {
    position: absolute;
    right: auto;
}

.cal-event--hidden {
    display: none;
}

.cal-event-block:hover {
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
    filter: brightness(0.96);
    cursor: default;
}

.cal-tooltip {
    position: fixed;
    z-index: 1100;
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    line-height: 1.35;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    white-space: normal;
    word-wrap: break-word;
    opacity: 0;
    transition: opacity 0.12s;
}

.cal-tooltip.visible {
    opacity: 1;
}

.cal-pref-icon {
    display: inline-block;
    font-size: 0.72rem;
    margin-left: 0.15rem;
    vertical-align: middle;
    line-height: 1;
}

.cal-pref-star {
    color: #e6a800;
}

.cal-pref-heart {
    color: #e05590;
}

.calendar-check-row:hover {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
}

.calendar-check-label {
    display: inline;
}

.calendar-course-line[data-course-title]:hover {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.cal-event--c0 { border-color: #2e7d32; background: rgba(232, 245, 233, 0.96); color: #1b5e20; }
.cal-event--c1 { border-color: #e65100; background: rgba(255, 243, 224, 0.96); color: #bf360c; }
.cal-event--c2 { border-color: #1565c0; background: rgba(227, 242, 253, 0.96); color: #0d47a1; }
.cal-event--c3 { border-color: #c62828; background: rgba(255, 235, 238, 0.96); color: #b71c1c; }
.cal-event--c4 { border-color: #6a1b9a; background: rgba(243, 229, 245, 0.96); color: #4a148c; }
.cal-event--c5 { border-color: #00695c; background: rgba(224, 242, 241, 0.96); color: #004d40; }
.cal-event--c6 { border-color: #4527a0; background: rgba(237, 231, 246, 0.96); color: #311b92; }
.cal-event--c7 { border-color: #ef6c00; background: rgba(255, 224, 178, 0.96); color: #e65100; }
.cal-event--c8 { border-color: #0277bd; background: rgba(179, 229, 252, 0.96); color: #01579b; }
.cal-event--c9 { border-color: #558b2f; background: rgba(241, 248, 233, 0.96); color: #33691e; }
.cal-event--c10 { border-color: #ad1457; background: rgba(252, 228, 236, 0.96); color: #880e4f; }
.cal-event--c11 { border-color: #455a64; background: rgba(236, 239, 241, 0.96); color: #263238; }

@media (max-width: 1100px) {
    .calendar-layout {
        flex-direction: column;
        min-height: auto;
    }

    .calendar-sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    .calendar-columns--week {
        overflow-x: auto;
        grid-template-columns: repeat(var(--cal-days, 5), minmax(88px, 1fr));
    }
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flash-message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.flash-message-success,
.flash-message {
    background-color: #4CAF50;
    color: white;
}

.flash-message-error {
    background-color: #dc3545;
    color: white;
}

.flash-message-info {
    background-color: #2196F3;
    color: white;
    max-width: 700px;
    text-align: center;
    line-height: 1.6;
}

/* Center flash messages and limit width */
.flash-messages .flash-message {
    max-width: 400px;
    width: 100%;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 60vh;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    margin-bottom: 1.5rem;
    color: var(--crimson-red);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.auth-link {
    margin-top: 1rem;
    text-align: center;
    display: block;
}

.auth-link a {
    color: var(--crimson-red);
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--crimson-red);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #8a0d2a;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-danger {
    background-color: #dc3545;
    color: var(--white);
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Discover Page */
.discover-container {
    max-width: 990px;
    margin: 0 auto;
}

/* Welcome Popup Modal */
.welcome-popup {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.welcome-popup.hidden {
    display: none;
}

.welcome-popup-content {
    background: var(--background-red);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    color: var(--white);
    text-align: center;
}

.welcome-popup-content h2 {
    color: var(--white);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.welcome-popup-content > p {
    color: var(--white);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.button-guide {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: flex-start;
}

.guide-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    color: var(--crimson-red);
    font-size: 1.5rem;
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.guide-btn.small-btn {
    width: 44px;
    height: 44px;
    font-size: 1.21rem;
}

.guide-btn.undo-btn {
    background: #87ceeb;
    color: var(--white);
}

.guide-btn.discard-btn {
    background: #ff4444;
    color: var(--white);
}

.guide-btn.heart-btn {
    background: #ff69b4;
    color: var(--white);
}

.guide-btn.star-btn {
    background: #ffaa00;
    color: var(--white);
}

.guide-text {
    color: var(--white);
    font-size: 1rem;
    text-align: left;
}

.welcome-popup-content .btn-primary {
    background-color: var(--crimson-red);
    color: var(--white);
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.welcome-popup-content .btn-primary:hover {
    background-color: #8a0d2a;
}

.course-card {
    background: var(--background-red);
    border-radius: 12px;
    padding: 1.375rem 3.3rem;                
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-bottom: 1rem;
}

.course-header-bar {
    background: var(--crimson-red);
    padding: 0.55rem 0.825rem;
    border-radius: 8px;           
    width: 100%;                  
    text-align: center;
    margin: 0 0 1.1rem 0;
    box-sizing: border-box;
    color: var(--white);
    font-weight: bold;
}


.course-header {
    margin-bottom: 1.5rem;
}


.course-header-bar .course-number {
    font-weight: bold;
    font-size: 1.21rem;
    color: var(--white);
}

.course-dept {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(164, 16, 52, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
}

.course-number {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--white);
}

.dept-icon {
    font-size: 1.5rem;
}

.course-title-section {
    margin-bottom: 1.1rem;
}

.course-title {
    font-size: 1.65rem;
    margin-bottom: 0.275rem;
    color: var(--white);
}

.course-instructor {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 0.275rem;
}

.course-link {
    color: var(--white);
    text-decoration: underline;
    font-size: 0.935rem;
}

.course-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.65rem;
    margin-bottom: 1.1rem;
}

.course-description h3,
.course-metadata h3 {
    font-size: 1.1rem;
    margin-bottom: 0.55rem;
    color: var(--white);
}

.course-description {
    padding-right: 0;
}

.course-metadata {
    padding-left: 0;
    padding-right: 0;
}

.description-text {
    padding: 0;
    color: var(--white);
    max-height: 198px;
    overflow-y: auto;
    font-size: 0.99rem;
    font-weight: normal;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Strip all formatting and ensure consistent white text styling */
.description-text * {
    color: var(--white) !important;
    font-size: 0.99rem !important;
    font-weight: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    background: transparent !important;
    background-color: transparent !important;
    text-decoration: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.description-text p,
.description-text div,
.description-text span,
.description-text li,
.description-text ul,
.description-text ol,
.description-text strong,
.description-text em,
.description-text b,
.description-text i,
.description-text mark,
.description-text code,
.description-text pre {
    color: var(--white) !important;
    font-size: 0.99rem !important;
    font-weight: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    line-height: 1.5 !important;
    background: transparent !important;
    background-color: transparent !important;
}

/* Normalize headings to regular text size */
.description-text h1,
.description-text h2,
.description-text h3,
.description-text h4,
.description-text h5,
.description-text h6 {
    color: var(--white) !important;
    font-size: 0.99rem !important;
    font-weight: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    line-height: 1.5 !important;
    background: transparent !important;
    margin: 0 !important;
}

/* Style links consistently as white text */
.description-text a {
    color: var(--white) !important;
    text-decoration: underline !important;
    background: transparent !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.description-text a:hover {
    color: var(--white) !important;
    opacity: 0.8;
}

/* Remove list styling inconsistencies */
.description-text ul,
.description-text ol {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
}

.description-text li {
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure no text selection highlighting interferes */
.description-text::selection {
    background: rgba(255, 255, 255, 0.3) !important;
    color: var(--white) !important;
}

.description-text *::selection {
    background: rgba(255, 255, 255, 0.3) !important;
    color: var(--white) !important;
}

.metadata-item {
    margin-bottom: 0.55rem;
    color: var(--white);
    font-size: 0.99rem;
}

.metadata-item strong {
    display: block;
    margin-bottom: 0.275rem;
}

.days-display {
    display: flex;
    gap: 0.55rem;
    margin-top: 0.55rem;
}

.day {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    color: var(--white);
    font-weight: bold;
}

.day.active {
    background: var(--white);
    color: var(--crimson-red);
}

.quotes-section {
    margin-bottom: 1rem;
}

.quotes-section h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.quotes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.quote-item {
    background: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: 6px;
    color: var(--white);
    font-style: italic;
}

.course-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}

.actions-row {
    display: flex;
    gap: 2.75rem;
    justify-content: center;
    align-items: center;
}

.action-form {
    display: inline-block;
}

.action-btn {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: none;
    background: var(--white);
    color: var(--crimson-red);
    font-size: 1.65rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    vertical-align: middle;
    justify-content: center;
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.discard-btn {
    background: #ff4444;
    color: var(--white);
}

.star-btn {
    background: #ffaa00;
    color: var(--white);
}

.heart-btn {
    background: #ff69b4;
    color: var(--white);
}

.undo-btn {
    background: #87ceeb;
    color: var(--white);
}

.small-btn {
    width: 44px;
    height: 44px;
    font-size: 1.21rem;
}

.no-courses-message {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Matches Page */
.matches-container {
    max-width: 100%;
    width: 100%;
}

.matches-container h1 {
    color: var(--crimson-red);
    margin-bottom: 2rem;
}

.sorting-game-section {
    background: var(--background-red);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 100%;
}

.sorting-game-section h2 {
    text-align: center;
    color: var(--white);
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.comparison-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
}

.comparison-card {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    width: 450px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.comparison-card.clickable-card {
    cursor: pointer;
}

.comparison-card.clickable-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.comparison-card-content h3 {
    color: var(--crimson-red);
    margin-bottom: 0.5rem;
}

.comparison-card-content h4 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.comparison-card-content .instructor {
    color: #666;
    margin-bottom: 1rem;
}

.comparison-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.card-form {
    margin: 0;
    padding: 0;
}

.vs-divider {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--white);
}

.comparison-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 0 1rem;
}

.action-form {
    margin: 0;
}

.btn.btn-action {
    padding: 0.75rem 1.5rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    background-color: #ffffff !important;
    color: #000000 !important;
    min-width: 120px;
    font-weight: 500;
}

.btn.btn-action:hover {
    background-color: #f5f5f5 !important;
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn.btn-action:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    background-color: #ffffff !important;
}

.saved-classes-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.saved-classes-section h2 {
    color: var(--crimson-red);
    margin-bottom: 1.5rem;
}

.term-group {
    margin-bottom: 2rem;
}

.term-heading {
    color: var(--crimson-red);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.saved-classes-table {
    width: 100%;
    border-collapse: collapse;
}

.saved-classes-table thead {
    background-color: var(--crimson-red);
    color: var(--white);
}


.saved-classes-table th {
    vertical-align: middle;
    text-align: left;
    padding: 0.75rem;
}
.saved-classes-table td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}


.saved-classes-table td:nth-child(2) {
    max-width: 400px;
    word-wrap: break-word;
}

.saved-classes-table th:nth-child(6),
.saved-classes-table td:nth-child(6) {
    text-align: center;
    font-weight: 600;
    color: var(--crimson-red);
    
}

.course-name-link {
    color: var(--crimson-red);
    text-decoration: none;
    transition: text-decoration 0.2s;
}

.course-name-link:hover {
    text-decoration: underline;
}

.saved-classes-table tbody tr:hover {
    background-color: #fff5f7;
}

.saved-classes-table tbody tr.rank-sortable-row:hover {
    background-color: #fce4ec;
}


.action-cells {
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
    vertical-align: middle;
    white-space: nowrap;
}

.inline-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    vertical-align: middle;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: transform 0.2s;
    vertical-align: middle;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    min-height: 1.5rem;
}

.icon-btn:hover {
    transform: scale(1.2);
}

.icon-btn.active {
    color: var(--crimson-red);
}

.icon-btn.star-icon.active {
    color: #ffd700; /* Yellow/gold for active star */
}

.icon-btn.heart-icon.active {
    color: var(--crimson-red); /* Red for active heart */
}

.remove-btn {
    color: #dc3545;
}

.no-comparison-message,
.no-saved-message {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Profile Page */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
}

.profile-card {
    background: var(--background-red);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.profile-card h1 {
    color: var(--white);
    margin-bottom: 0.5rem;
    text-align: center;
}

.profile-subtitle {
    color: var(--white);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.profile-form {
    background: rgba(255,255,255,0.95);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h2 {
    color: var(--crimson-red);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.radio-label:hover {
    border-color: var(--crimson-red);
}

.radio-label input[type="radio"],
.radio-label input[type="checkbox"] {
    margin: 0;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background-color: #f5f5f5;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.select-all-label {
    margin-bottom: 0.75rem;
}

.requirements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.requirements-column h3 {
    color: var(--crimson-red);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #666;
    color: white;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.info-icon:hover {
    background-color: var(--crimson-red);
}

.info-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #333;
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 300px;
    white-space: normal;
}

.info-tooltip.show {
    display: block;
}

.info-tooltip strong {
    font-weight: 600;
}

.requirements-column .checkbox-label {
    display: block;
    margin-bottom: 0.5rem;
}

.reset-section {
    background: rgba(255,255,255,0.95);
    padding: 1.5rem;
    border-radius: 8px;
}

.reset-section h2 {
    color: var(--crimson-red);
    margin-bottom: 1rem;
}

.reset-note {
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .course-content {
        grid-template-columns: 1fr;
    }
    
    .quotes-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-cards {
        flex-direction: column;
    }
    
    .requirements-grid {
        grid-template-columns: 1fr;
    }
    
    .saved-classes-table {
        font-size: 0.9rem;
    }
    
    .saved-classes-table th,
    .saved-classes-table td {
        padding: 0.5rem;
    }
}

/* Footer */
.site-footer {
    padding: 0.75rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
    background-color: var(--white);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.footer-text p {
    margin: 0;
    font-size: 0.75rem;
    color: #666;
    line-height: 1.4;
}

.footer-logo-container {
    display: flex;
    align-items: center;
}

.footer-logo {
    height: 50px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.footer-logo:hover {
    opacity: 1;
}

/* Discover: inconspicuous progress (full width of discover block) */
.discover-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.75rem;
    opacity: 0.65;
    font-size: 0.75rem;
    color: #444;
}

.discover-progress-track {
    flex: 1 1 auto;
    min-width: 0;
    height: 7px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.discover-progress-wrap--below-card {
    margin-top: 0.75rem;
    width: 100%;
    opacity: 0.85;
}

.discover-progress-fill {
    height: 100%;
    background: rgba(164, 16, 52, 0.45);
    border-radius: 2px;
    transition: width 0.25s ease;
}

.discover-progress-text {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rank-hint-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.rank-hint-progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    transition: width 0.25s ease;
}

.rank-hint-buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    width: 100%;
}

.rank-hint-popup .btn-secondary,
.scroll-hint-popup .btn-secondary {
    margin-top: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: transparent;
    color: var(--white);
    cursor: pointer;
}

.rank-hint-popup .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.scroll-hint-actions {
    margin-top: 1rem;
}

/* Matches: comparison pair — smaller secondary actions, pink hover */
.comparison-actions-compact {
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.btn-comparison-secondary {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    min-width: auto;
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    cursor: pointer;
    font-weight: 500;
}

.btn-comparison-secondary:hover {
    background: #fff;
    border-color: #ccc;
}

.comparison-card.clickable-card:hover {
    background: #fce4ec;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.rank-drag-hint {
    font-size: 0.85rem;
    color: #666;
    margin: -0.25rem 0 0.75rem 0;
}

.rank-sortable-row {
    cursor: grab;
}

.rank-sortable-row.rank-dragging {
    cursor: grabbing;
    opacity: 0.85;
}

