/* static/calendar.css  (Class Calendar page, uses the tokens + buttons from main.css) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }

.calMain { max-width: 1200px; margin: 0 auto; padding: 40px 20px 0; }

.cal-hero { text-align: center; max-width: 760px; margin: 0 auto 32px; animation: rise 0.5s var(--ease-out) both; }
.cal-hero h1 { font-size: 3.6rem; color: var(--heading); line-height: 1.1; margin-bottom: 10px; }
.cal-hero p { color: var(--text-muted); font-size: 1.1rem; line-height: 1.6; }

.cal-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }

.cal-card {
    background: var(--card-bg);
    border: 2px solid var(--line);
    border-top: 6px solid var(--secondary-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
    padding: 28px 26px;
    animation: rise 0.5s var(--ease-out) both;
}
.cal-schedule { animation-delay: 0.08s; }
.cal-help { animation-delay: 0.14s; }
.cal-card h2 { font-size: 2rem; color: var(--heading); margin-bottom: 16px; }
.cal-card h3 { font-size: 1.3rem; color: var(--heading); }

/* ---------- Form controls ---------- */
.search-box { position: relative; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-box input,
.filters select,
.opt-row select {
    font: inherit;
    color: var(--text-main);
    background: var(--surface);
    border: 2px solid var(--line-strong);
    border-radius: var(--border-radius);
    max-width: 100%;
    transition: border-color var(--dur) ease, box-shadow var(--dur) ease, background-color var(--dur) ease;
}
.search-box input { width: 100%; min-height: 50px; padding: 12px 14px 12px 42px; font-size: 1rem; }
.filters select, .opt-row select { min-height: 44px; padding: 8px 12px; cursor: pointer; }
.search-box input:hover, .filters select:hover, .opt-row select:hover { border-color: var(--secondary-color); }
.search-box input:focus, .filters select:focus, .opt-row select:focus {
    outline: none;
    border-color: var(--secondary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(230, 161, 11, 0.2);
}

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* Segmented control */
.seg { display: inline-flex; background: var(--surface); border: 2px solid var(--line); border-radius: var(--border-radius); padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { background: transparent; color: var(--text-main); min-height: 38px; padding: 0 14px; font-size: 0.9rem; border-radius: 10px; }
.seg button:hover { background: var(--line); color: var(--heading); }
.seg button.on { background: var(--primary-color); color: #fff; box-shadow: 0 3px 0 var(--primary-shade); }
#termSeg button.on { animation: choicePop 0.3s var(--ease-pop); }

/* Suggestion chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; font-size: 0.9rem; color: var(--text-muted); }
.chips button {
    background: var(--card-bg);
    color: var(--text-main);
    min-height: 34px;
    padding: 0 13px;
    font-size: 0.85rem;
    border: 2px solid var(--line-strong);
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 0 var(--line-strong);
}
.chips button:hover { border-color: var(--primary-color); color: var(--heading); transform: translateY(-2px); box-shadow: 0 4px 0 var(--line-strong); }
.chips button:active { transform: translateY(1px); box-shadow: none; }

/* ---------- Results ---------- */
.result-count { margin: 16px 0 8px; font-size: 0.9rem; color: var(--text-muted); min-height: 1.2em; }
.results { display: flex; flex-direction: column; gap: 14px; }
.results p.muted { padding: 18px; text-align: center; background: var(--surface); border: 2px dashed var(--line-strong); border-radius: var(--border-radius); line-height: 1.6; }

.course {
    border: 2px solid var(--line);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 3px 0 var(--line);
}
.course-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-bottom: 2px solid var(--line); }
.course-code { font-size: 1.6rem; color: var(--heading); line-height: 1; }
.course-title { font-weight: 600; flex: 1 1 160px; }
.course-cr { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; padding: 2px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); }

.sec { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px; transition: background-color var(--dur) ease; }
.sec + .sec { border-top: 1px solid var(--line); }
.sec:hover { background: var(--surface); }
.sec-info { min-width: 0; font-size: 0.92rem; line-height: 1.45; }
.sec-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.sec-id { font-size: 1rem; }
.crn { color: var(--text-muted); font-size: 0.8rem; }
.sec-ins { color: var(--text-muted); font-size: 0.85rem; }
.term-badge { font-size: 0.72rem; font-weight: 600; padding: 2px 9px; border-radius: var(--radius-pill); color: #fff; }
.term-badge.F { background: #b4540a; }
.term-badge.W { background: #2a6fa8; }

.add-btn { flex: none; min-height: 40px; min-width: 92px; padding: 0 16px; font-size: 0.9rem; box-shadow: 0 3px 0 var(--btn-shade); }
.add-btn:hover { box-shadow: 0 5px 0 var(--btn-shade); }
.add-btn.on {
    --btn-bg: rgba(35, 160, 58, 0.12);
    --btn-bg-hover: rgba(217, 63, 69, 0.12);
    --btn-fg: var(--success);
    --btn-shade: rgba(35, 160, 58, 0.35);
    border-color: rgba(35, 160, 58, 0.45);
}
.add-btn.on:hover { --btn-fg: var(--danger); --btn-shade: rgba(217, 63, 69, 0.35); border-color: rgba(217, 63, 69, 0.45); }

.sec-more {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 44px; padding: 0 16px;
    background: transparent; color: var(--heading); font-size: 0.88rem;
    border-top: 1px solid var(--line); border-radius: 0;
}
.sec-more:hover { background: var(--surface); }
.sec-more i { transition: transform var(--dur) ease; }
.sec-more:hover i { transform: translateY(2px); }

.more-btn { display: flex; margin: 18px auto 0; }

/* ---------- Schedule ---------- */
.cal-schedule { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; }
.sched-head { display: flex; align-items: center; justify-content: space-between; }
.count-badge {
    background: var(--secondary-color); color: #1a1400; font-weight: 700;
    min-width: 34px; height: 34px; border-radius: var(--radius-pill);
    display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; margin-bottom: 16px;
    box-shadow: 0 3px 0 var(--secondary-shade);
}

.term-head { margin: 14px 0 6px; font-size: 1.25rem; }
.sel { display: flex; gap: 10px; align-items: flex-start; padding: 10px 6px; border-bottom: 1px solid var(--line); border-radius: 8px; }
.swatch { flex: none; width: 10px; align-self: stretch; border-radius: 5px; }
.sel-body { flex: 1; min-width: 0; font-size: 0.92rem; line-height: 1.4; }
.sel-meta { color: var(--text-muted); font-size: 0.82rem; }
.warn { color: var(--danger); font-size: 0.82rem; font-weight: 600; margin-top: 2px; }
.rm {
    flex: none; display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    background: var(--surface); color: var(--text-muted);
    border: 2px solid var(--line); border-radius: 50%;
    font-size: 1.3rem; line-height: 1;
}
.rm:hover { color: #fff; background: var(--danger); border-color: var(--danger); transform: rotate(90deg); }

.notices { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.notice { font-size: 0.85rem; line-height: 1.5; padding: 10px 12px; border: 2px solid var(--line); border-left: 5px solid var(--secondary-color); background: var(--surface); border-radius: 10px; }
.notice.bad { border-left-color: var(--danger); background: rgba(217, 63, 69, 0.07); }

/* Week preview */
#weekWrap { margin-top: 18px; }
.term-tabs { margin-bottom: 10px; }
.week-scroll { overflow-x: auto; border: 2px solid var(--line); border-radius: var(--border-radius); background: var(--card-bg); }
.week { --hour: 40px; display: grid; grid-template-columns: 42px repeat(var(--cols, 5), minmax(64px, 1fr)); min-width: 380px; font-size: 0.72rem; }
.week.empty { display: block; padding: 18px; min-width: 0; }
.w-corner, .w-dayhead { background: var(--surface); border-bottom: 2px solid var(--line); }
.w-dayhead { text-align: center; padding: 7px 0; font-weight: 600; border-left: 1px solid var(--line); }
.w-times { position: relative; height: calc(var(--hours) * var(--hour)); }
.w-times span { position: absolute; right: 5px; transform: translateY(-50%); color: var(--text-muted); font-size: 0.68rem; }
.w-times span:first-child { transform: translateY(0); }
.w-col {
    position: relative; height: calc(var(--hours) * var(--hour));
    border-left: 1px solid var(--line);
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour));
}
.blk {
    position: absolute; padding: 3px 5px; border-radius: 7px; color: #fff; overflow: hidden; line-height: 1.2;
    border: 1px solid rgba(255, 255, 255, 0.35); box-sizing: border-box;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
    transition: transform var(--dur) ease, box-shadow var(--dur) ease;
}
.blk:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2); z-index: 2; }
.blk b { display: block; font-size: 0.72rem; }
.blk span { font-size: 0.66rem; opacity: 0.92; }
.blk.sporadic { border-style: dashed; border-color: rgba(255, 255, 255, 0.85); }
.blk.clash { outline: 2px solid var(--danger); outline-offset: -2px; }

/* Options + actions */
.opts { margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--line); }
.opts h3 { margin-bottom: 10px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 0.95rem; }
.opt-check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; cursor: pointer; }
.opt-check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--secondary-color); flex: none; cursor: pointer; }
.opt-check small { display: block; color: var(--text-muted); font-size: 0.78rem; margin-top: 2px; line-height: 1.4; }

.sched-actions { margin-top: 20px; text-align: center; }
.dl-btn {
    width: 100%;
    min-height: 56px;
    font-family: "Bebas Neue", sans-serif;
    font-weight: 400;
    font-size: 1.7rem;
    letter-spacing: 1.5px;
    padding: 6px 20px 2px;
    box-shadow: 0 5px 0 var(--btn-shade);
}
.dl-btn i { font-size: 1.2rem; margin-top: -4px; }
.summary { margin: 12px 0 4px; font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Help ---------- */
.cal-help { margin-top: 24px; }
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.cal-help details {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--border-radius);
    padding: 0 16px;
    transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.cal-help details:hover { border-color: var(--line-strong); }
.cal-help details[open] { border-color: var(--secondary-color); box-shadow: 0 3px 0 rgba(230, 161, 11, 0.35); }
.cal-help summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-help summary::-webkit-details-marker { display: none; }
.cal-help summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--heading); transition: transform 0.25s var(--ease-pop); }
.cal-help details[open] summary::after { transform: rotate(45deg); }
.cal-help details p { margin: -4px 0 14px; line-height: 1.6; font-size: 0.95rem; animation: fadeIn 0.25s ease; }
.notes { margin: 10px 0 0 20px; list-style: disc; }
.notes li { line-height: 1.6; margin-bottom: 6px; color: var(--text-main); }

/* ---------- Mobile bar + toast ---------- */
.mobile-bar {
    display: none; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 900;
    background: var(--primary-color); color: #fff; min-height: 48px; padding: 0 24px;
    box-shadow: 0 4px 0 var(--primary-shade), var(--shadow-lg); border-radius: var(--radius-pill); gap: 8px; align-items: center;
    transition: opacity 0.2s ease, transform 0.2s var(--ease-pop);
}
.mobile-bar:hover { transform: translateX(-50%) translateY(-2px); }
.mobile-bar.gone { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(10px); }
.toast {
    position: fixed; left: 50%; bottom: 80px; transform: translate(-50%, 10px) scale(0.96);
    background: #1f2430; color: #fff; padding: 11px 18px; border-radius: var(--radius-pill); font-size: 0.9rem;
    box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease, transform 0.25s var(--ease-pop); z-index: 1600; max-width: 90vw; text-align: center;
}
html.dark-mode .toast { background: #e7e9ee; color: #111317; }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

@media (max-width: 960px) {
    .cal-layout { grid-template-columns: minmax(0, 1fr); }
    .cal-schedule { position: static; max-height: none; overflow: visible; }
    .mobile-bar:not([hidden]) { display: flex; }
    .help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .calMain { padding: 24px 14px 0; }
    .cal-hero { margin-bottom: 22px; }
    .cal-hero h1 { font-size: 2.6rem; }
    .cal-hero p { font-size: 1rem; }
    .cal-card { padding: 20px 14px; }
    .cal-card h2 { font-size: 1.7rem; }

    .filters { flex-direction: column; align-items: stretch; }
    .filters .seg { display: flex; }
    .filters .seg button { flex: 1; padding: 0 6px; }
    .filters select { width: 100%; }

    .course-head { flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px 14px; }
    .course-title { flex: none; }
    .sec { padding: 12px 14px; align-items: center; }
    .add-btn { min-width: 0; padding: 0 12px; font-size: 0.85rem; }

    .sel-body { font-size: 0.88rem; }
    .opt-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .dl-btn { font-size: 1.45rem; }
}
