/* =========================================
   NCCU 通識體育檢核系統
   Apple HIG 風格 × 政大品牌識別
   Primary: #19348f | Accent: #fa1916
   ========================================= */

:root {
  --blue:       #19348f;
  --blue-dark:  #122670;
  --blue-light: #e8ecf8;
  --red:        #fa1916;
  --bg:         #f2f2f7;
  --surface:    #ffffff;
  --surface2:   #f9f9fb;
  --border:     rgba(0,0,0,0.08);
  --text:       #1c1c1e;
  --text-sub:   #8e8e93;
  --text-mute:  #c7c7cc;
  --green:      #30d158;
  --green-bg:   #d1f2e4;
  --green-text: #1a7a41;
  --amber:      #ff9f0a;
  --amber-bg:   #fff3cd;
  --amber-text: #856404;
  --shadow-sm:  0 1px 6px rgba(0,0,0,0.06), 0 0 1px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-blue: 0 4px 20px rgba(25,52,143,0.28);
  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  18px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display',
               'Noto Sans TC', 'PingFang TC', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Navbar ── */
.site-nav {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-emblem { display: block; }
.nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user {
  font-size: 13px;
  color: var(--text-sub);
}
.btn-logout {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-decoration: none;
}
.btn-logout:hover { opacity: 0.7; }

/* ── Dual-category badge & selector ── */
.dual-badge {
  display: inline-block;
  font-size: 9px; font-weight: 600;
  background: #eef0ff; color: var(--blue);
  border-radius: 99px; padding: 1px 7px;
  margin-left: 5px; vertical-align: middle;
  letter-spacing: .02em;
}
.dual-selector {
  display: flex; flex-direction: column; gap: 4px;
}
.dual-opt {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text);
  cursor: pointer; line-height: 1.4;
}
.dual-opt input[type="radio"] {
  accent-color: var(--blue);
  width: 13px; height: 13px; flex-shrink: 0;
}

/* ── Calculate action ── */
.calc-action {
  text-align: center;
  padding: 8px 0 4px;
}
.calc-hint {
  font-size: 12px; color: var(--text-mute);
  margin-bottom: 10px;
}
.btn-calc {
  display: inline-flex; align-items: center;
  font-size: 15px; font-weight: 600;
  color: #fff; background: var(--blue);
  border: none; border-radius: var(--radius);
  padding: 13px 32px;
  cursor: pointer; font-family: inherit;
  box-shadow: var(--shadow-blue);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn-calc:hover  { background: var(--blue-dark); }
.btn-calc:active { transform: scale(.98); }

/* ── Results divider ── */
.results-divider {
  display: flex; align-items: center; gap: 12px;
}
.results-divider::before,
.results-divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}
.results-divider-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-sub); letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
}

/* ── Main ── */
.main-content .container { max-width: 720px; }

/* ── Student Card ── */
.student-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.student-avatar {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--blue), #2a4db5);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  flex-shrink: 0;
}
.student-info { flex: 1; }
.student-name { font-size: 15px; font-weight: 600; color: var(--text); }
.student-meta { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.divider { margin: 0 5px; }
.btn-ghost {
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  padding: 0;
}
.btn-ghost:hover { opacity: 0.7; }

/* ── Progress Card ── */
.banner-card {
  background: linear-gradient(145deg, var(--blue) 0%, #2a5298 100%);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow-blue);
  margin-bottom: 14px;
  color: #fff;
}
.banner-label {
  font-size: 11px;
  font-weight: 500;
  opacity: .7;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.banner-number {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
}
.banner-denom {
  font-size: 14px;
  font-weight: 400;
  opacity: .65;
}
.banner-hint {
  font-size: 12px;
  margin-top: 5px;
  opacity: .8;
}
.banner-hint.ok { opacity: 1; color: #a8f0c6; }
.banner-pct-ring {
  position: relative;
  width: 72px; height: 72px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ring-svg {
  position: absolute; top: 0; left: 0;
  width: 72px; height: 72px;
  transform: rotate(0deg);
}
.ring-label {
  position: relative; z-index: 1;
  font-size: 13px; font-weight: 700;
  color: #fff;
}
.banner-bar-wrap {
  background: rgba(255,255,255,.2);
  border-radius: 99px; height: 5px;
  margin-top: 14px; overflow: hidden;
}
.banner-bar {
  height: 100%; background: #fff;
  border-radius: 99px;
  transition: width .8s ease;
}

/* ── Rule Card ── */
.rule-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid;
  margin-bottom: 14px;
}
.rule-card.rule-ok  { border-left-color: var(--green); }
.rule-card.rule-warn { border-left-color: var(--amber); }
.rule-title {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 3px;
}
.rule-status { font-weight: 400; color: var(--text-sub); }
.rule-desc {
  font-size: 12px; color: var(--text-sub);
  margin-bottom: 10px; line-height: 1.5;
}
.rule-fields { display: flex; gap: 6px; flex-wrap: wrap; }
.rule-field {
  font-size: 11px; font-weight: 600;
  padding: 4px 13px; border-radius: 99px; border: none;
}
.field-ok  { background: var(--green-bg); color: var(--green-text); }
.field-ng  { background: var(--bg); color: var(--text-mute); }

/* ── Section Title ── */
.section-title {
  font-size: 12px; font-weight: 600;
  color: var(--text-sub); letter-spacing: .05em;
  text-transform: uppercase; margin-bottom: 10px;
}

/* ── Category Grid ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.cat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.cat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.cat-header {
  display: flex; align-items: center;
  gap: 6px; margin-bottom: 6px; flex-wrap: wrap;
}
.cat-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; min-width: 70px; }
.cat-range { font-size: 10px; color: var(--text-mute); }
.cat-credits {
  font-size: 1.4rem; font-weight: 700;
  color: var(--text); line-height: 1; margin-bottom: 4px;
}
.cat-denom { font-size: 12px; font-weight: 400; color: var(--text-sub); }
.cat-core  { font-size: 10px; color: var(--text-mute); margin-left: 3px; }
.cat-bar-bg {
  background: var(--bg); border-radius: 99px;
  height: 5px; overflow: hidden; margin-top: 4px;
}
.cat-bar { height: 100%; border-radius: 99px; transition: width .7s ease; }
.cat-excess { font-size: 10px; color: var(--text-mute); margin-top: 4px; }

/* ── Tags ── */
.tag {
  font-size: 10px; font-weight: 600;
  padding: 2px 9px; border-radius: 99px;
}
.tag-green { background: var(--green-bg); color: var(--green-text); }
.tag-amber { background: var(--amber-bg); color: var(--amber-text); }
.tag-gray  { background: var(--bg); color: var(--text-mute); }

/* ── Footnote ── */
.footnote {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 11px; color: var(--text-sub);
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 14px; box-shadow: var(--shadow-sm);
  line-height: 1.6;
}
.footnote-icon { color: var(--red); font-weight: 700; flex-shrink: 0; }

/* ── Login ── */
.login-page {
  background: var(--bg);
  min-height: 85vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.login-box { width: 100%; max-width: 360px; }
.login-hero { text-align: center; margin-bottom: 28px; }
.login-school {
  font-size: 18px; font-weight: 700;
  color: var(--text); margin-top: 14px; letter-spacing: .01em;
}
.login-tagline { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}
.login-card-title {
  font-size: 22px; font-weight: 700;
  color: var(--text); margin-bottom: 5px;
}
.login-card-sub {
  font-size: 13px; color: var(--text-sub);
  margin-bottom: 22px;
}
.login-error {
  background: #fff1f0; border: 0.5px solid #ffa39e;
  color: #cf1322; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.form-group { margin-bottom: 12px; }
.form-label-custom {
  font-size: 11px; font-weight: 600;
  color: var(--text-sub); display: block;
  margin-bottom: 5px; letter-spacing: .04em;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  font-size: 15px; color: var(--text);
  font-family: inherit; outline: none;
  transition: box-shadow .15s;
}
.form-input:focus {
  box-shadow: 0 0 0 3px rgba(25,52,143,0.18);
}
.form-input::placeholder { color: var(--text-mute); }
.btn-primary-custom {
  display: block; width: 100%;
  background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 14px;
  font-size: 16px; font-weight: 600;
  font-family: inherit; cursor: pointer;
  letter-spacing: .01em;
  transition: background .15s, transform .1s, box-shadow .15s;
  margin-top: 6px;
}
.btn-primary-custom:hover {
  background: var(--blue-dark);
  box-shadow: var(--shadow-blue);
}
.btn-primary-custom:active { transform: scale(.99); }
.login-help {
  font-size: 12px; color: var(--text-mute);
  text-align: center; margin-top: 16px; margin-bottom: 0;
}

/* ── Tab Bar (Details) ── */
.tab-bar {
  display: flex; gap: 3px; flex-wrap: wrap;
  background: #e5e5ea; border-radius: 10px;
  padding: 3px; width: fit-content; margin-bottom: 14px;
}
.tab-btn {
  padding: 6px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 500;
  background: transparent; color: var(--text-sub);
  border: none; cursor: pointer; font-family: inherit;
  transition: all .15s; white-space: nowrap;
}
.tab-btn.active {
  background: var(--surface); color: var(--blue);
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Detail List ── */
.detail-summary {
  font-size: 12px; color: var(--text-sub); margin-bottom: 10px;
}
.text-ok { color: var(--green-text); }
.text-ng { color: #d70015; }
.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.detail-header-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--surface2);
  border-bottom: 0.5px solid rgba(0,0,0,0.06);
  font-size: 10px; font-weight: 600;
  color: var(--text-sub); letter-spacing: .05em;
  text-transform: uppercase;
}
.detail-row {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 0.5px solid rgba(0,0,0,0.05);
  transition: background .1s;
}
.detail-row:hover { background: var(--surface2); }
.detail-row-last { border-bottom: none; }
.detail-row-index { width: 20px; font-size: 11px; color: var(--text-mute); text-align: center; flex-shrink: 0; }
.detail-row-name  { flex: 2; font-size: 13px; color: var(--text); }
.detail-row-cat   { flex: 1; font-size: 11px; color: var(--text-sub); min-width: 70px; }
.detail-row-core  { width: 44px; flex-shrink: 0; }
.detail-row-credit { width: 46px; flex-shrink: 0; font-size: 11px; color: var(--text-sub); text-align: right; }
.detail-row-status { width: 66px; flex-shrink: 0; text-align: right; }
.dh-idx    { width: 20px; flex-shrink: 0; }
.dh-name   { flex: 2; }
.dh-cat    { flex: 1; min-width: 70px; }
.dh-core   { width: 44px; flex-shrink: 0; }
.dh-credit { width: 46px; flex-shrink: 0; text-align: right; }
.dh-status { width: 66px; flex-shrink: 0; text-align: right; }

.status-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
}
.status-ok { background: var(--green-bg); color: var(--green-text); }
.status-ng { background: var(--bg); color: var(--text-mute); }

.core-badge {
  font-size: 10px; font-weight: 500;
  padding: 2px 8px; border-radius: 99px;
  background: #fff3e0; color: #c05600; border: none;
}
.gen-badge {
  font-size: 10px; padding: 2px 8px; border-radius: 99px;
  background: var(--bg); color: var(--text-mute);
}

/* ── Page Header (Details) ── */
.page-header { margin-bottom: 16px; }
.page-header-inner {
  display: flex; justify-content: space-between;
  align-items: flex-end; gap: 1rem; flex-wrap: wrap;
}
.page-eyebrow {
  font-size: 11px; font-weight: 600;
  color: var(--blue); letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 4px;
}
.page-title {
  font-size: 26px; font-weight: 700;
  color: var(--text); margin-bottom: 3px; line-height: 1.2;
}
.page-desc { font-size: 13px; color: var(--text-sub); margin: 0; }

/* ── Empty State ── */
.empty-state {
  text-align: center; padding: 3rem 2rem;
  color: var(--text-mute); background: var(--surface);
  border-radius: var(--radius);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: 13px; margin: 0; }

/* ════════════════════════════════════════
   Details Page — Wide Layout
   ════════════════════════════════════════ */
.details-layout .main-content .container,
.details-layout.main-content .container { max-width: 1280px; }

/* ── GE Category Tags ── */
.cat-tag {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 600;
  padding: 2px 9px; border-radius: 99px;
  white-space: nowrap; line-height: 1.7;
  transition: box-shadow .12s;
}
.cat-tag-HUM  { background: #fdf0e6; color: #a05a2c; }
.cat-tag-SOC  { background: #e8f0fa; color: #1d4a8f; }
.cat-tag-NAT  { background: #e8f5e8; color: #1f5e1f; }
.cat-tag-INFO { background: #f0ebfa; color: #5b3fa0; }
.cat-tag-COL  { background: #f2f2f7; color: #636366; }
.cat-tag-CHI  { background: #fff7e6; color: #9a5000; }
.cat-tag-ENG  { background: #e8f0ff; color: #1a40cc; }
.cat-tag-PE   { background: #e8f4f3; color: #0a6a62; }
.cat-tag-OTHER { background: #f2f2f7; color: #8e8e93; }

/* Dual-select: tag acts as radio label */
.cat-tag-sel {
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 1px;
}
.cat-tag-sel.is-selected { outline-color: currentColor; }
.cat-tag-sel input[type="radio"] { display: none; }

/* ── Required / Elective badges ── */
.badge-required { font-size: 10px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #fee2e2; color: #b91c1c; white-space: nowrap; }
.badge-elective  { font-size: 10px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #eff6ff; color: #1d4ed8; white-space: nowrap; }

/* ── Core dot (●) beside course name ── */
.core-dot {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: #c05600;
  margin-right: 4px; vertical-align: 2px; flex-shrink: 0;
}

/* ── Score cells ── */
.score-pass { color: #1a7a41; font-weight: 700; }
.score-fail { color: #b91c1c; font-weight: 700; }
.score-na   { color: var(--text-mute); font-size: 12px; }

/* ── Filter Bar ── */
.filter-bar {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
}
.filter-bar .fb-label {
  font-size: 10px; font-weight: 600;
  color: var(--text-sub); text-transform: uppercase;
  letter-spacing: .04em; display: block; margin-bottom: 4px;
}
.filter-bar .form-select {
  font-size: 12px; border-radius: 9px;
  border-color: rgba(0,0,0,.12); color: var(--text);
  min-width: 110px;
}
.filter-bar .form-control-search {
  font-size: 12px; border-radius: 9px;
  border: 1px solid rgba(0,0,0,.12); padding: 5px 10px;
  outline: none; color: var(--text); min-width: 160px;
  transition: box-shadow .15s;
}
.filter-bar .form-control-search:focus {
  box-shadow: 0 0 0 3px rgba(25,52,143,.15);
}
.filter-bar .btn-reset {
  font-size: 12px; padding: 5px 14px;
  border-radius: 9px; border: 1px solid rgba(0,0,0,.12);
  background: none; color: var(--text-sub); cursor: pointer;
  font-family: inherit; white-space: nowrap;
  transition: background .12s;
}
.filter-bar .btn-reset:hover { background: var(--bg); }

/* ── Courses Table Card ── */
.table-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.courses-table { margin-bottom: 0; }
.courses-table thead th {
  background: var(--surface2);
  font-size: 10px; font-weight: 600; color: var(--text-sub);
  letter-spacing: .05em; text-transform: uppercase;
  border-bottom: 1px solid rgba(0,0,0,.08);
  padding: 10px 14px; white-space: nowrap;
  vertical-align: middle;
}
.courses-table thead th.sortable { cursor: pointer; }
.courses-table thead th.sortable:hover { color: var(--text); }
.courses-table thead th .sort-icon { margin-left: 4px; font-size: 9px; opacity: .4; }
.courses-table thead th .sort-icon::after { content: "⇅"; }
.courses-table thead th.sort-asc  .sort-icon { opacity: 1; color: var(--blue); }
.courses-table thead th.sort-asc  .sort-icon::after { content: "▲"; }
.courses-table thead th.sort-desc .sort-icon { opacity: 1; color: var(--blue); }
.courses-table thead th.sort-desc .sort-icon::after { content: "▼"; }
.courses-table tbody td {
  padding: 10px 14px; vertical-align: middle;
  border-bottom: 0.5px solid rgba(0,0,0,.05);
  font-size: 13px;
}
.courses-table tbody tr:last-child td { border-bottom: none; }
.courses-table tbody tr.hidden-row { display: none; }

/* Course name cell */
.cn-main { font-weight: 500; color: var(--text); line-height: 1.4; }
.cn-sub  { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

/* Tags container */
.tags-wrap { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* Empty row */
.empty-row td { text-align: center; padding: 3rem; color: var(--text-mute); }
.empty-row .ei { font-size: 2rem; margin-bottom: .4rem; }

/* Result count chip */
.result-count {
  font-size: 11px; color: var(--text-sub);
  display: inline-block;
  margin-bottom: 8px;
}
.result-count strong { color: var(--text); }
