/* public/css/dashboard.css - 儀表板兩欄主頁、課程卡片網格與右側資訊欄 */
/* =========================================================
   原版 COOL 兩欄首頁（中間課程網格 + 右側獨立捲動）
   ========================================================= */
.view-dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}
.tag-cyan { color: var(--cyan); background: rgba(0, 245, 255, 0.08); }
.tag-amber { color: var(--amber); background: rgba(255, 176, 32, 0.1); }

.cool-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
  align-items: stretch;
}

.cool-dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.dash-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.dash-title-wrap {
  min-width: 220px;
}

.dash-title {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
}

.telemetry-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  --chip-edge: var(--cyan-line);
  padding: 6px 13px;
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--cyan-line);
  background-color: rgba(0, 245, 255, 0.035);
  background-image:
    linear-gradient(135deg, transparent 4.2px, var(--chip-edge) 4.2px, var(--chip-edge) 5.8px, transparent 5.8px),
    linear-gradient(-45deg, transparent 4.2px, var(--chip-edge) 4.2px, var(--chip-edge) 5.8px, transparent 5.8px);
  background-position: top left, bottom right;
  background-size: 12px 12px;
  background-repeat: no-repeat;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat-chip-alert {
  --chip-edge: var(--amber-line);
  box-shadow: inset 0 0 0 1px var(--amber-line);
}

.stat-label {
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: var(--text-sub);
}

.stat-val {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--cyan-bright);
}

.stat-chip-alert .stat-val.has-urgent {
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.6);
}

.course-toolbar {
  flex-shrink: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   原版 COOL 課程卡片網格（僅此區於首頁獨立捲動）
   ========================================================= */
.courses-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
  padding-right: 6px;
  padding-bottom: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 16px;
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: #000000;
  background-image:
    linear-gradient(135deg, transparent 7.6px, var(--cyan) 7.6px, var(--cyan) 9.6px, transparent 9.6px),
    linear-gradient(-45deg, transparent 7.6px, var(--cyan) 7.6px, var(--cyan) 9.6px, transparent 9.6px);
  background-position: top left, bottom right;
  background-size: 18px 18px;
  background-repeat: no-repeat;
  clip-path: polygon(
    12px 0,
    100% 0,
    100% calc(100% - 12px),
    calc(100% - 12px) 100%,
    0 100%,
    0 12px
  );
  box-shadow: inset 0 0 0 1px var(--cyan-line);
  transition: box-shadow 0.16s ease, transform 0.14s ease, background-color 0.16s ease;
}

.course-card:hover {
  box-shadow: inset 0 0 0 1px var(--cyan), inset 0 0 22px rgba(0, 245, 255, 0.08);
  transform: translateY(-2px);
}

.course-banner {
  position: relative;
  height: 92px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom: 1px solid var(--cyan-line);
  /* 疊加左上 45° 斜邊線，避免被橫幅背景色遮蓋 */
  background-image:
    linear-gradient(135deg, transparent 7.6px, var(--cyan) 7.6px, var(--cyan) 9.6px, transparent 9.6px),
    linear-gradient(rgba(0, 245, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 245, 255, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, rgba(0, 245, 255, 0.14), rgba(0, 0, 0, 0.92));
  background-position: top left, 0 0, 0 0, 0 0;
  background-size: 18px 18px, 16px 16px, 16px 16px, 100% 100%;
  background-repeat: no-repeat, repeat, repeat, no-repeat;
  overflow: hidden;
  cursor: pointer;
}

.course-banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.24;
  filter: grayscale(100%) contrast(1.2);
  pointer-events: none;
}

.course-banner-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.course-code {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cyan-bright);
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid var(--cyan-line);
  max-width: 78%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-fav {
  color: var(--amber);
  font-size: 0.92rem;
  text-shadow: 0 0 8px rgba(255, 176, 32, 0.65);
}

.course-term {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-sub);
}

.course-body {
  padding: 12px 14px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.course-name {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

.course-name:hover {
  color: var(--cyan);
}

.course-quick-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--cyan-hair);
}

.quick-tab-btn {
  padding: 8px 4px;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--cyan-hair);
  color: var(--text-sub);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.quick-tab-btn:last-child {
  border-right: 0;
}

.quick-tab-btn:hover {
  background: rgba(0, 245, 255, 0.12);
  color: var(--cyan-bright);
}

/* =========================================================
   右側資訊欄：To Do / Coming Up / 最新公告（參考圖節點導引線）
   ========================================================= */
.cool-right-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  padding-bottom: 12px;
}

.rail-section {
  flex-shrink: 0;
  padding: 14px 16px;
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-left: 8px;
  border-left: 1px solid var(--cyan-hair);
}

.rail-list::-webkit-scrollbar,
.courses-grid::-webkit-scrollbar,
.cool-right-rail::-webkit-scrollbar,
.course-tab-content::-webkit-scrollbar,
.course-subnav::-webkit-scrollbar,
.cmd-results::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
  width: 5px;
}
.rail-list::-webkit-scrollbar-thumb,
.courses-grid::-webkit-scrollbar-thumb,
.cool-right-rail::-webkit-scrollbar-thumb,
.course-tab-content::-webkit-scrollbar-thumb,
.course-subnav::-webkit-scrollbar-thumb,
.cmd-results::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 255, 0.35);
}

.rail-item {
  --rail-edge: var(--cyan-hair);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px 8px 22px;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px var(--cyan-hair);
  background-color: rgba(0, 245, 255, 0.025);
  background-image:
    linear-gradient(225deg, transparent 5.6px, var(--rail-edge) 5.6px, var(--rail-edge) 7.4px, transparent 7.4px),
    linear-gradient(315deg, transparent 5.6px, var(--rail-edge) 5.6px, var(--rail-edge) 7.4px, transparent 7.4px);
  background-position: top right, bottom right;
  background-size: 14px 14px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: background-color 0.14s ease, box-shadow 0.14s ease;
}

.rail-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 7px var(--cyan);
}

.rail-item.urgency-critical::before {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}
.rail-item.urgency-warning::before {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.rail-item:hover {
  --rail-edge: var(--cyan);
  background-color: rgba(0, 245, 255, 0.11);
  box-shadow: inset 0 0 0 1px var(--cyan);
}

.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.item-course {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-countdown {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}
.item-countdown.critical { color: #ff7990; }
.item-countdown.warning { color: var(--amber); }
.item-countdown.normal { color: var(--cyan); }

.item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.item-sub {
  font-size: 0.73rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 20px 12px;
  text-align: center;
  border: 1px dashed var(--cyan-hair);
  color: var(--text-sub);
  font-size: 0.82rem;
}

