/**
 * HonniSys — Catppuccin Mocha 全域主題覆蓋層
 *
 * 載入方式：置於各頁既有 stylesheet「之後」（inline-style 頁面則置於 <style> 之前）
 *   <link rel="stylesheet" href="/static/mocha-theme.css">
 *
 * 只做覆蓋與精緻化，不定義版面結構。
 * 色盤：https://catppuccin.com/palette (Mocha)
 */

/* ================================
   1. 變數覆蓋 — style.css / admin/style.css 詞彙
   ================================ */
:root {
  --bg-main: #1e1e2e;        /* base */
  --bg-card: #313244;        /* surface0 */
  --bg-input: #313244;
  --text-primary: #cdd6f4;   /* text */
  --text-secondary: #a6adc8; /* subtext0 */
  --accent: #cba6f7;         /* mauve */
  --accent-dark: #b48eec;
  --line: #45475a;           /* surface1 */
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  --error: #f38ba8;          /* red */
  --warning: #f9e2af;        /* yellow */
  --success: #a6e3a1;        /* green */

  /* ---- admin.css 詞彙 ---- */
  --bg-base: #11111b;        /* crust */
  --bg-sunken: #181825;      /* mantle */
  --bg-surface: #1e1e2e;
  --bg-raised: #313244;
  --border-subtle: rgba(69, 71, 90, 0.4);
  --border: #3b3b54;
  --border-strong: #45475a;
  --text: #cdd6f4;
  --text-muted: #6c7086;     /* overlay0 */
  --text-subtle: #585b70;    /* surface2 */
  --accent-hover: #d8bdf9;
  --accent-press: #b48eec;
  --accent-soft: rgba(203, 166, 247, 0.12);
  --info: #89b4fa;
  --info-soft: rgba(137, 180, 250, 0.14);
  --success-soft: rgba(166, 227, 161, 0.14);
  --warning-soft: rgba(249, 226, 175, 0.14);
  --danger: #f38ba8;
  --danger-soft: rgba(243, 139, 168, 0.16);
  --focus-ring: 0 0 0 2px rgba(203, 166, 247, 0.3);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.15);
  --shadow-raised: 0 8px 28px rgba(0, 0, 0, 0.45);

  /* ---- Mocha 補充色（供 inline / 新樣式引用）---- */
  --mocha-lavender: #b4befe;
  --mocha-maroon: #eba0ac;
  --mocha-peach: #fab387;
  --mocha-teal: #94e2d5;
  --mocha-blue: #89b4fa;
  --mocha-pink: #f5c2e7;
  --mocha-crust: #11111b;
  --mocha-surface2: #585b70;
}

/* ================================
   2. Phase 1 — 背景層次與氛圍
   ================================ */
body {
  background-color: #1e1e2e;
  color: #cdd6f4;
}

/* 極低調的環境光暈，讓暗底不是死黑一片 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(203, 166, 247, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 35% at 95% 100%, rgba(180, 190, 254, 0.04) 0%, transparent 55%);
  pointer-events: none;
  z-index: -1;
}

/* 分隔線：純色 → 淡出漸層 */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(203, 166, 247, 0.2), transparent);
}

/* ================================
   3. Phase 2 — Typography
   ================================ */
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h1, h2, h3 {
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* 品牌字（sidebar logo / 登入標題）：襯線體的中醫氣質 */
.logo,
.brand-serif {
  font-family: "Songti TC", "Noto Serif TC", "Source Han Serif TC", serif;
  font-weight: 600;
  letter-spacing: 0.08em;
}

small, .text-muted, .stat-label, .user-role, .filter-group label {
  color: #6c7086;
}

/* ================================
   4. Phase 3 — 按鈕與互動元件
   ================================ */

/* 主要按鈕：Mauve 底 + 深色字（淺紫上白字對比不足） */
.btn,
.btn-primary,
.btn-edit {
  background: #cba6f7;
  color: #11111b;
  border-radius: 8px;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover,
.btn-primary:hover,
.btn-edit:hover {
  background: #cba6f7;
  filter: brightness(1.1);
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(203, 166, 247, 0.25);
}

.btn:active,
.btn-primary:active {
  transform: scale(0.99);
  filter: brightness(0.95);
}

/* 次要 / 取消 / 搜尋按鈕 */
.btn-secondary,
.btn-cancel,
.btn-search,
.pagination button {
  background: transparent;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover,
.btn-cancel:hover,
.btn-search:hover,
.pagination button:hover:not(:disabled) {
  background: rgba(203, 166, 247, 0.08);
  border-color: #cba6f7;
  color: #cdd6f4;
}

/* Outline / 匯出按鈕 */
.btn-export,
.btn-outline {
  color: #cba6f7;
  border: 1px solid #cba6f7;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-export:hover,
.btn-outline:hover {
  background: #cba6f7;
  color: #11111b;
}

/* 危險按鈕：紅 → Maroon 系 */
.btn-delete {
  color: #f38ba8;
  border: 1px solid #f38ba8;
  border-radius: 8px;
}

.btn-delete:hover {
  background: #eba0ac;
  border-color: #eba0ac;
  color: #11111b;
}

/* LINE 按鈕維持品牌綠，僅柔化 */
.btn-line {
  background: #06c755;
  color: #ffffff;
}
.btn-line:hover {
  background: #05b44b;
  filter: none;
}

/* 輸入框 */
input, select, textarea {
  border-color: #45475a;
  accent-color: #cba6f7;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #cba6f7;
  box-shadow: 0 0 0 2px rgba(203, 166, 247, 0.3), inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

input::placeholder, textarea::placeholder {
  color: #6c7086;
}

/* select 自訂箭頭（僅 select 元素，checkbox/radio 不受影響） */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23a6adc8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* Sidebar 導覽 */
.nav-item {
  transition: background 0.15s ease, color 0.15s ease;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(203, 166, 247, 0.06);
}

.nav-item.active {
  background: rgba(203, 166, 247, 0.1);
  color: #cba6f7;
  border-left: 3px solid #cba6f7;
}

.nav-item.logout { color: #f38ba8; }

/* ================================
   5. Phase 4 — 卡片與容器
   ================================ */
.card,
.section,
.stat-card,
.filters {
  background: #313244;
  border: 1px solid rgba(69, 71, 90, 0.4);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.modal-content {
  background: #313244;
  border: 1px solid rgba(69, 71, 90, 0.5);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.section h2 {
  border-bottom: none;
  position: relative;
  padding-bottom: 12px;
}

.section h2::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(203, 166, 247, 0.35), rgba(69, 71, 90, 0.3) 50%, transparent);
}

.stat-value { color: #cba6f7; }

/* 表格 */
.data-table {
  background: #313244;
  border: 1px solid rgba(69, 71, 90, 0.4);
}

.data-table th {
  background: #292a3d;
  color: #a6adc8;
}

.data-table th, .data-table td {
  border-bottom: 1px solid rgba(69, 71, 90, 0.5);
}

.data-table tr:hover td {
  background: rgba(69, 71, 90, 0.35);
}

/* 狀態標籤 → 圓角 pill + Mocha 配色 */
.status-badge, .role-badge {
  border-radius: 20px;
  padding: 2px 10px;
  font-weight: 500;
}

.status-badge.待確認 { background: rgba(249, 226, 175, 0.15); color: #f9e2af; }
.status-badge.已確認 { background: rgba(148, 226, 213, 0.15); color: #94e2d5; }
.status-badge.已完成 { background: rgba(166, 227, 161, 0.15); color: #a6e3a1; }
.status-badge.已取消 { background: rgba(243, 139, 168, 0.15); color: #f38ba8; }
.status-badge.已掛號 { background: rgba(137, 180, 250, 0.15); color: #89b4fa; }
.status-badge.已報到 { background: rgba(250, 179, 135, 0.15); color: #fab387; }
.status-badge.看診中 { background: rgba(203, 166, 247, 0.15); color: #cba6f7; }
.role-badge.admin   { background: rgba(203, 166, 247, 0.15); color: #cba6f7; }
.role-badge.staff   { background: rgba(166, 173, 200, 0.15); color: #a6adc8; }

/* 對話泡（chat.html） */
.bot {
  background: #313244;
  border: 1px solid rgba(69, 71, 90, 0.5);
}

.user {
  background: #cba6f7;
  color: #11111b;
  font-weight: 500;
}

.input-bar {
  background: #181825;
  border-top: 1px solid rgba(69, 71, 90, 0.5);
}

/* 自訂滾動條 */
* {
  scrollbar-width: thin;
  scrollbar-color: #45475a transparent;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #45475a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #585b70; }

/* ================================
   6. Phase 5 — 微動畫
   ================================ */
@keyframes mochaFadeIn {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

@keyframes mochaDropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes mochaToastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

body { animation: mochaFadeIn 0.2s ease-out; }

.search-results, .dropdown-menu {
  animation: mochaDropIn 0.15s ease-out;
}

.toast {
  animation: mochaToastIn 0.25s ease-out;
}

/* 尊重使用者的減少動態偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
