/* ============================================================
   淡江大學 115 學年度課件系統 — 專用入口網站主樣式 (portal.css)
   ============================================================ */

:root {
  --font-sans: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* 主色系（預設） */
  --c-primary: #065A82;
  --c-primary-light: #1C7293;
  --c-accent: #F97316;
  --c-accent-hover: #ea580c;
  
  /* 介面底色與文字 (Light Theme) */
  --bg-app: #f1f5f9;
  --bg-topbar: rgba(255, 255, 255, 0.95);
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: rgba(255, 255, 255, 0.08);
  --bg-sidebar-active: rgba(249, 115, 22, 0.18);
  --bg-card: #ffffff;
  --bg-surface: #f8fafc;
  --bg-statusbar: #0b1329;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-sidebar: #cbd5e1;
  --text-sidebar-bright: #ffffff;
  --text-inverse: #ffffff;

  --border-light: #e2e8f0;
  --border-sidebar: rgba(255, 255, 255, 0.1);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.12), 0 8px 10px -6px rgba(0,0,0,0.04);

  --topbar-height: 60px;
  --sidebar-width: 320px;
  --statusbar-height: 38px;
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-topbar: rgba(15, 23, 42, 0.95);
  --bg-sidebar: #060911;
  --bg-card: #111827;
  --bg-surface: #1f2937;
  --bg-statusbar: #030712;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-light: #1f2937;
  --border-sidebar: rgba(255, 255, 255, 0.08);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   1. TOP NAVBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(6, 90, 130, 0.35);
}

.brand-info h1 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Course Switcher */
.course-switch {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 3px;
  border-radius: 10px;
  gap: 4px;
}

.course-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.course-btn:hover {
  color: var(--text-main);
  background: rgba(0,0,0,0.03);
}

.course-btn.active {
  background: var(--c-primary);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.course-btn.active.web3 {
  background: #7C3AED;
}

/* View Mode Switcher */
.mode-switch {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: #ffffff;
  color: var(--c-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

[data-theme="dark"] .mode-btn.active {
  background: #374151;
  color: #ffffff;
}

/* Topbar Right Tools */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.icon-btn:hover {
  color: var(--text-main);
  background: var(--bg-card);
  border-color: #cbd5e1;
}

/* ============================================================
   2. APP CONTAINER & SIDEBAR
   ============================================================ */
.app-body {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-height) - var(--statusbar-height));
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  border-right: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, transform 0.25s ease;
  flex-shrink: 0;
  z-index: 500;
}

.sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-sidebar);
}

.sidebar-course-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
  margin-bottom: 8px;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
}

.sidebar-search {
  margin-top: 10px;
  position: relative;
}

.sidebar-search input {
  width: 100%;
  padding: 7px 12px 7px 30px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}

.sidebar-search input:focus {
  border-color: var(--c-accent);
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-search-icon {
  position: absolute;
  left: 9px;
  top: 7px;
  font-size: 12px;
  color: #94a3b8;
}

/* Sidebar Tree Content */
.sidebar-tree {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 30px;
}

.tree-module-title {
  padding: 12px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.week-item {
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background 0.15s;
  overflow: hidden;
}

.week-header {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
}

.week-header:hover {
  background: var(--bg-sidebar-hover);
}

.week-item.active > .week-header {
  background: var(--bg-sidebar-active);
  color: #fff;
  border-left: 3px solid var(--c-accent);
}

.week-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  width: 22px;
}

.week-title {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}

.week-badges {
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-status {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-done { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.badge-planned { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.badge-holiday { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.badge-exam { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Subsections list */
.section-list {
  list-style: none;
  padding: 6px 8px 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  margin: 4px 8px 8px 20px;
  border-radius: 0 8px 8px 0;
}

.section-item {
  padding: 6px 10px;
  font-size: 12.5px;
  color: #cbd5e1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.section-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

.section-item.active {
  color: #fb923c;
  background: rgba(249, 115, 22, 0.2);
  font-weight: 700;
  border-left: 3px solid #f97316;
}


/* ============================================================
   3. MAIN WORKSPACE / VIEWER
   ============================================================ */
.main-workspace {
  flex: 1;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Dashboard View */
.dashboard-view {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 80px;
}

.dashboard-hero {
  background: linear-gradient(135deg, #0c2340 0%, #065a82 60%, #1c7293 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 36px 40px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.dashboard-hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.25), transparent 70%);
  pointer-events: none;
}

.hero-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.dashboard-hero h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.25;
}

.dashboard-hero p {
  font-size: 15px;
  color: #e0f2fe;
  max-width: 720px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  gap: 24px;
  margin-top: 24px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.stat-num {
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 11px;
  color: #bae6fd;
}

/* Course Cards Grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
  margin-bottom: 36px;
}

.course-card {
  background: var(--bg-card);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.course-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.course-card h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.course-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 16px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.btn-primary {
  background: var(--c-primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--c-primary-light); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* SOP Pipeline Section */
.sop-section {
  background: var(--bg-card);
  border-radius: 14px;
  border: 1px solid var(--border-light);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 36px;
}

.sop-section h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.sop-step {
  background: var(--bg-surface);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}

.sop-step-num {
  font-size: 11px;
  font-weight: 800;
  color: var(--c-accent);
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.sop-step h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

.sop-step p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Viewer Frame Container */
.viewer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
}

.viewer-header {
  height: 42px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.viewer-title-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.viewer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-frame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* ============================================================
   4. BOTTOM STATUS BAR
   ============================================================ */
.statusbar {
  height: var(--statusbar-height);
  background: var(--bg-statusbar);
  color: #94a3b8;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.statusbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.statusbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  font-weight: 500;
}

.statusbar-breadcrumb .sep {
  color: #64748b;
}

.statusbar-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-badge-live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.statusbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-link {
  color: #94a3b8;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.15s;
}

.status-link:hover {
  color: #ffffff;
}

.btn-pptx-download {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff !important;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-pptx-download:hover {
  filter: brightness(1.1);
}
