/* 教室座位及學生點名系統 - 進階現代化樣式表 (含登入入口、總管理員控制台與CSV範本) */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700&display=swap');

:root {
  --font-family: 'Noto Sans TC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  font-family: var(--font-family);
  background-color: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

/* 登入遮罩與背景質感 */
.login-backdrop {
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, rgba(248, 250, 252, 0.95) 90%),
              radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1) 0%, rgba(248, 250, 252, 0.95) 90%);
}

/* 講台黑板擬真質感 */
.podium-board {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 4px solid #334155;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

/* 座位卡片基礎樣式 */
.seat-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}

.seat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -4px rgba(0, 0, 0, 0.12);
}

/* 出勤狀態樣式 */
.status-present {
  background: linear-gradient(to bottom right, #f0fdf4, #dcfce7);
  border-color: #22c55e;
  color: #15803d;
}

.status-late {
  background: linear-gradient(to bottom right, #fffbeb, #fef3c7);
  border-color: #f59e0b;
  color: #b45309;
}

.status-leave {
  background: linear-gradient(to bottom right, #eff6ff, #dbeafe);
  border-color: #3b82f6;
  color: #1d4ed8;
}

.status-absent {
  background: linear-gradient(to bottom right, #fff1f2, #ffe4e6);
  border-color: #f43f5e;
  color: #be123c;
}

.status-unmarked {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #64748b;
}

/* 走道/空位樣式 */
.seat-aisle {
  background-color: #ffffff !important;
  border: 2px dashed #cbd5e1 !important;
  box-shadow: none !important;
  opacity: 0.75;
}

.seat-aisle:hover {
  transform: translateY(-2px);
  border-color: #6366f1 !important;
  background-color: #f8fafc !important;
  opacity: 1;
}

/* 選取待對調座位的動畫光暈 */
.seat-swap-active {
  animation: swap-pulse 1.5s infinite;
  outline: 3px solid #6366f1;
  outline-offset: 3px;
  z-index: 20;
}

@keyframes swap-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
  }
}

/* 課堂抽問中籤 - 聚光燈特效 */
.seat-spotlight {
  animation: spotlight-glow 0.8s infinite alternate;
  outline: 4px solid #ec4899 !important;
  outline-offset: 4px;
  z-index: 30;
  transform: scale(1.05) !important;
}

@keyframes spotlight-glow {
  from {
    box-shadow: 0 0 20px 5px rgba(236, 72, 153, 0.8);
  }
  to {
    box-shadow: 0 0 35px 12px rgba(244, 63, 94, 0.95);
  }
}

/* 學生自選座位狀態 */
.seat-selectable {
  cursor: pointer;
  border: 2px dashed #3b82f6 !important;
  background-color: #eff6ff !important;
  transition: all 0.2s;
}

.seat-selectable:hover {
  background-color: #dbeafe !important;
  border-color: #2563eb !important;
  transform: scale(1.03);
}

.seat-selected-target {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
  color: white !important;
  border-color: #312e81 !important;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.6) !important;
}

/* 特殊標籤配色 */
.tag-leader {
  background-color: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.tag-care {
  background-color: #ffe4e6;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.tag-ta {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.tag-default {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* 分組討論島型桌外框 */
.group-pod {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.group-pod:hover {
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08);
}

/* 幸運輪盤特效 */
.roulette-container {
  background: radial-gradient(circle, #312e81 0%, #1e1b4b 100%);
  border: 4px solid #818cf8;
  box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.5);
}

/* 即時問答樣式 */
.quiz-option-btn {
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #e2e8f0;
}

.quiz-option-btn:hover {
  border-color: #6366f1;
  background-color: #eef2ff;
  transform: translateY(-2px);
}

.quiz-option-selected {
  border-color: #4f46e5 !important;
  background: #e0e7ff !important;
  color: #312e81 !important;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.quiz-bar-fill {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 防呆提醒卡片 */
.anti-error-banner {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-left: 5px solid #f59e0b;
}

/* CSV 範本展示框 */
.csv-code-box {
  background: #0f172a;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-x: auto;
}

/* 自訂卷軸 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 列印專用 */
@media print {
  body {
    background-color: #ffffff !important;
  }
  .no-print {
    display: none !important;
  }
  .print-only {
    display: block !important;
  }
  .seat-card {
    box-shadow: none !important;
    border-width: 1px !important;
    page-break-inside: avoid;
  }
  .podium-board {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border: 1px solid #94a3b8 !important;
  }
}

/* 設備自適應與行動端友善樣式 */
.mobile-sticky-bar {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1), 0 -4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* 橫向滾動左右提示遮罩 */
.scroll-hint-wrapper {
  position: relative;
}

.scroll-hint-indicator {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, rgba(241, 245, 249, 0.95));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.scroll-hint-wrapper.has-overflow .scroll-hint-indicator {
  opacity: 1;
}

/* 全景微縮模式下的座位卡 */
.seat-mini-cell {
  min-height: 56px !important;
  padding: 4px 2px !important;
  border-radius: 8px !important;
}

.seat-mini-cell .mini-name {
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
}

.seat-mini-cell .mini-coord {
  font-size: 9px !important;
  opacity: 0.8 !important;
}

/* 電腦雙欄吸頂 */
@media (min-width: 1024px) {
  .sticky-desktop-sidebar {
    position: sticky;
    top: 5rem;
  }
}
