/* ==========================================================================
   Base UI Template - Style System (全介面響應式適配樣式系統)
   語言: 繁體中文 | 日期格式: YYYY/MM/DD | 時區: UTC+8
   專案位置: Code(代碼)/css/style.css
   適配目標: 電腦 (Desktop > 1024px)、平板 (Tablet 769px-1024px)、手機 (Mobile <= 768px)
   ========================================================================== */

/* 1. CSS 變數系統 - 固定尺寸與色調 (Design Tokens) */
:root {
  /* 固定核心佈局尺寸 */
  --topbar-height: 60px;
  --sidebar-width: 240px;

  /* 主題色彩 Palette (已確認規範) */
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-card: #1a2332;
  --bg-card-hover: #222d40;
  --bg-input: #0d131f;

  /* 邊框與分割線 */
  --border-color: #263347;
  --border-color-light: #33445e;

  /* 文字顏色 (High-Contrast Text Tokens) */
  --text-primary: #ffffff;
  --text-secondary: #e2e8f0;
  --text-muted: #cbd5e1;
  --text-white: #ffffff;

  /* 經典品牌與狀態色彩 (High-Contrast Sky Blue for Dark Theme) */
  --accent-primary: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-light: rgba(56, 189, 248, 0.15);
  
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-info: #06b6d4;
  --color-info-bg: rgba(6, 182, 212, 0.12);

  /* 圓角與陰影 */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 0 15px rgba(56, 189, 248, 0.3);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. 全域基礎重置 (Global Reset) */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh; /* 適配手機動態網址列 */
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* 全域暗色主題滾動條 (Global Custom Dark Theme Scrollbars) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* 3. 主應用程式佈局 (App Layout) */
#app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* 4. 頂部導航欄 (Top Navigation Bar - 固定高度 60px) */
.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
  gap: 12px;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* 電腦端隱藏 Hamburger 按鈕 (因為電腦端 sidebar 固定 240px 顯示)，手機端呈現 */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.hamburger-btn:hover, .hamburger-btn:active {
  color: var(--text-white);
  background-color: var(--accent-primary);
  border-color: var(--accent-hover);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-white);
  text-decoration: none;
  white-space: nowrap;
}

.brand-plus-box {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0077ff 0%, #00c6ff 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0, 150, 255, 0.45);
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brand-logo:hover .brand-plus-box {
  transform: scale(1.05);
  box-shadow: 0 0 16px rgba(0, 180, 255, 0.65);
}

.brand-title-text {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.brand-icon {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, #0066ff, #00bfff);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow-accent);
}

.site-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  color: var(--text-primary);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.site-selector:hover {
  border-color: var(--border-color-light);
}

.system-time-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: monospace;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-success);
  background-color: var(--color-success-bg);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

/* 使用者個人頭像與下拉選單 */
.user-profile-wrapper {
  position: relative;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  transition: var(--transition-fast);
  user-select: none;
  min-height: 36px;
}

.user-profile:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color-light);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0066ff, #00bfff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.user-arrow {
  font-size: 9px;
  color: var(--text-muted);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  padding: 8px 0;
  z-index: 300;
}

.user-dropdown.active {
  display: flex;
}

.dropdown-header {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dropdown-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #0066ff, #00bfff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.dropdown-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.dropdown-email { font-size: 11px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background-color: var(--border-color); margin: 6px 0; }
.dropdown-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* 5. 核心區域 (Main Container: Sidebar + Content) */
.main-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  height: calc(100dvh - var(--topbar-height));
  overflow: hidden;
  position: relative;
}

/* 6. 左側選單欄 (Left Sidebar - 電腦端固定寬度 240px 展開狀態) */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 90;
}

.sidebar-nav {
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

/* 未收合 / 展開狀態 (Uncollapsed State) 導航選單項目配置 */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: var(--transition-fast);
  cursor: pointer;
  user-select: none;
  min-height: 44px; /* 觸控友善尺寸 */
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
}

/* 未收合選定狀態高亮 (Active Item) */
.nav-item.active {
  color: var(--text-white);
  background-color: var(--accent-light);
  border-left: 3px solid var(--accent-primary);
  font-weight: 600;
}

.nav-item .icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  background-color: var(--accent-primary);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* 7. 主內容展演區域 (Content Area - 寬敞呼吸空間感) */
.content-area {
  flex: 1;
  background-color: var(--bg-primary);
  overflow-y: auto;
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .content-area {
    padding: 20px 16px;
    gap: 24px;
  }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 4px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 按鈕樣式 (Buttons - Redesigned Modern Themes) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  min-height: 38px;
  user-select: none;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f3f4f6 !important;
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  min-height: 32px;
  border-radius: var(--radius-sm);
}

/* 網格與卡片系統 (Grid & Cards System) */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition-fast);
}

.stat-card:hover {
  border-color: var(--border-color-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--accent-primary);
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-white);
}

.stat-footer {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }

/* 主要資訊卡片 (Main Section Card - 增加舒適內邊距與離距) */
.card-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: visible;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  margin-bottom: 8px;
}

.card-header {
  padding: 20px 26px;
  border-bottom: 1px solid var(--border-color);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body {
  padding: 26px 28px;
}

/* 輸入與按鈕單行組合 (.input-group) */
.input-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.input-group .form-control {
  flex: 1;
  width: auto;
  min-width: 0;
}

.input-group .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

/* 二欄網格與區塊離距 (.grid-2col) */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
}

/* 8. 表格與列表 (Table Component) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  min-width: 600px; /* 手機端自動啟用橫向捲動 */
}

.custom-table th {
  background-color: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  white-space: nowrap;
}

.custom-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

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

.device-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.device-name { font-weight: 600; color: var(--text-white); }
.device-ip { font-size: 11px; color: var(--text-muted); font-family: monospace; }

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
}

.badge-online { background-color: var(--color-success-bg); color: var(--color-success); }
.badge-offline { background-color: var(--color-danger-bg); color: var(--color-danger); }

/* 9. 安全事件與日誌面板 (Security Logs Panel) */
.log-container {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: monospace;
  font-size: 12px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-all;
}

.log-time { color: var(--text-muted); flex-shrink: 0; }
.log-type {
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  flex-shrink: 0;
}

.log-type.INFO { background: var(--color-info-bg); color: var(--color-info); }
.log-type.SEC { background: var(--color-warning-bg); color: var(--color-warning); }
.log-type.WARN { background: var(--color-danger-bg); color: var(--color-danger); }

/* 10. 頁面分頁檢視控制 (SPA Tab Views) */
.tab-content {
  display: none;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* 10.1 色彩展示卡片 (Color Swatch Cards) */
.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.color-swatch {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.color-swatch:hover {
  border-color: var(--border-color-light);
  transform: translateY(-2px);
}

.swatch-color-box {
  height: 60px;
  width: 100%;
}

.swatch-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.swatch-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.swatch-code {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-muted);
}

/* ==========================================================================
   10.5 表單控制項與設定列系統 (Setting Rows & Form Controls System)
   ========================================================================== */

/* 設定列 (Setting Rows List) */
.setting-list {
  display: flex;
  flex-direction: column;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 20px;
  transition: background-color var(--transition-fast);
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-row:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.setting-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-desc {
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.4;
}

.setting-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.setting-control-box {
  width: 320px;
}

/* 帶圖標輸入框組 (Input Icon Group) */
.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-group .input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  color: #38bdf8;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5; /* 確保層級高於輸入框 hover 背景 stacking context */
  transition: transform var(--transition-fast), color var(--transition-fast), filter var(--transition-fast);
}

.input-icon-group:hover .input-icon {
  color: #38bdf8;
  transform: translateY(-50%) scale(1.1);
}

.input-icon-group:focus-within .input-icon {
  color: #38bdf8;
  transform: translateY(-50%) scale(1.2);
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.input-icon-group .form-control {
  padding-left: 48px;
}

/* 內聯複選框組 (Inline Checkboxes) */
.checkbox-inline-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* 單選卡片 (Radio Cards) */
.radio-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.radio-card {
  display: flex;
  align-items: flex-start;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  user-select: none;
}

.radio-card:hover {
  border-color: var(--border-color-light);
  background-color: rgba(255, 255, 255, 0.02);
}

.radio-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card:has(input:checked), .radio-card.active {
  border-color: var(--accent-primary);
  background-color: var(--accent-light);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.radio-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.radio-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.radio-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.radio-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 表單網格 Layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.form-hint {
  font-size: 12.5px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.5;
  margin-top: 4px;
}

/* ==========================================================================
   美化版 (Desktop 大尺寸): 文字輸入框 & Textarea (Re-beautified Desktop Inputs)
   ========================================================================== */
.form-control {
  background: linear-gradient(180deg, #111a2e 0%, #0b1220 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 450;
  font-family: inherit;
  width: 100%;
  min-height: 48px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.form-control::placeholder {
  color: #cbd5e1;
  opacity: 0.9;
  font-weight: 450;
}

.form-control:hover:not(:disabled) {
  border-color: rgba(59, 130, 246, 0.5);
  background: linear-gradient(180deg, #16233d 0%, #0e1728 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.form-control:focus:not(:disabled) {
  border-color: #3b82f6;
  background: #0f172a;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 8px 24px rgba(59, 130, 246, 0.15);
  transform: translateY(0);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02);
  border-style: dashed;
}

.form-control.is-invalid {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25), 0 8px 24px rgba(239, 68, 68, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
  padding: 14px 18px;
}

textarea.form-control::-webkit-scrollbar {
  width: 6px;
}

textarea.form-control::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   美化版 (Desktop 大尺寸): 下拉選單 (Re-beautified Desktop Select Dropdowns)
   ========================================================================== */
.form-select {
  background: linear-gradient(180deg, #111a2e 0%, #0b1220 100%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 16px 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 12px 46px 12px 18px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

.form-select option {
  background-color: #0f172a;
  color: #f8fafc;
  padding: 12px 16px;
  font-size: 14.5px;
}

.form-select optgroup {
  background-color: #080d16;
  color: #38bdf8;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.form-select:hover:not(:disabled) {
  border-color: rgba(59, 130, 246, 0.5);
  background-color: #16233d;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 16px 16px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.form-select:focus:not(:disabled) {
  border-color: #3b82f6;
  background-color: #0f172a;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 8px 24px rgba(59, 130, 246, 0.15);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='18 15 12 9 6 15'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 16px center !important;
  background-size: 16px 16px !important;
  transform: translateY(0);
}

.form-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02);
  border-style: dashed;
}

/* ==========================================================================
   全新美化: 客製化高質感下拉選單組件 (Custom Polished Dropdown UI)
   ========================================================================== */
.custom-select-wrapper {
  position: relative;
  width: 100%;
  user-select: none;
  z-index: 10;
}

.custom-select-wrapper.open {
  z-index: 999;
}

.custom-select-trigger {
  background: linear-gradient(180deg, #111a2e 0%, #0b1220 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  color: #f8fafc;
  padding: 12px 46px 12px 18px;
  font-size: 15px;
  font-weight: 500;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  width: 100%;
}

.custom-select-trigger .trigger-text {
  color: #f8fafc;
  font-weight: 500;
}

.custom-select-trigger.is-placeholder .trigger-text {
  color: #cbd5e1;
  font-weight: 500;
}

.custom-select-trigger:hover {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #16233d 0%, #0e1728 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.custom-select-wrapper.open .custom-select-trigger {
  border-color: #3b82f6;
  background: #0f172a;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 8px 24px rgba(59, 130, 246, 0.15);
  transform: translateY(0);
}

.custom-select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

.custom-select-wrapper.open .custom-select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background-color: #0d1527;
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  padding: 6px;
  -webkit-overflow-scrolling: touch;
}

.custom-select-wrapper.open .custom-select-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-options::-webkit-scrollbar {
  width: 6px;
}

.custom-select-options::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: var(--radius-full);
}

.custom-option {
  padding: 11px 14px;
  font-size: 14.5px;
  color: #f8fafc;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.custom-option:hover {
  background-color: #1e293b;
  color: #38bdf8;
  font-weight: 600;
}

.custom-option.selected {
  background-color: rgba(0, 102, 255, 0.3);
  color: #ffffff !important;
  font-weight: 700;
  border-left: 3.5px solid #38bdf8;
}

.custom-option.disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background-color: transparent !important;
  color: #94a3b8 !important;
  font-style: italic;
}

.custom-optgroup-title {
  color: #38bdf8;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 10px 12px 4px 12px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-optgroup-title:first-child {
  border-top: none;
  margin-top: 0;
}

/* 複選框 (Checkboxes) & 單選按鈕 (Radios) */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* 自訂高質感暗黑系 Range 滑桿 (Custom Base UI Dark Theme Range Slider) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  outline: none;
  margin: 12px 0;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

input[type="range"]:hover {
  border-color: var(--border-color-light);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  cursor: pointer;
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: var(--accent-hover);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  cursor: pointer;
}

.checkbox-container, .radio-container {
  display: flex;
  align-items: center;
  position: relative;
  padding-left: 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
  min-height: 22px;
  transition: color var(--transition-fast);
}

.checkbox-container:hover, .radio-container:hover {
  color: var(--text-primary);
}

.checkbox-container input, .radio-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 1px;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--border-color-light);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

/* 單選按鈕 (Radio Buttons) */
.radiomark {
  position: absolute;
  top: 1px;
  left: 0;
  height: 18px;
  width: 18px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.radio-container:hover input ~ .radiomark {
  border-color: var(--border-color-light);
}

.radio-container input:checked ~ .radiomark {
  border-color: var(--accent-primary);
  background-color: var(--bg-input);
}

.radiomark:after {
  content: "";
  position: absolute;
  display: none;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.radio-container input:checked ~ .radiomark:after {
  display: block;
}

.checkbox-container.disabled, .radio-container.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 開關切換器 (Toggle Switch) */
.switch-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 4px;
}

.switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  gap: 12px;
}

.switch-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.switch-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 34px;
  transition: var(--transition-fast);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition-fast);
}

.switch input:checked + .slider {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* ==========================================================================
   11. 全方位雙向與三端響應式斷點適配 (Responsive Breakpoints)
   ========================================================================== */

/* 11.1 中型螢幕與平板端適配 (Tablet / Medium Screens: 769px ~ 1024px) */
@media (max-width: 1024px) {
  .system-time-badge { display: none; } /* 釋放頂欄空間 */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 11.2 手機與窄螢幕斷點適配 (Mobile Devices: <= 768px) */
@media (max-width: 768px) {
  /* 顯示手機端專屬 Hamburger 側邊欄開關 */
  .hamburger-btn {
    display: flex !important;
  }

  /* 隱藏非關鍵頂欄資訊，節省手機螢幕寬度 */
  .system-time-badge {
    display: none !important;
  }
  
  .system-status span:not(.status-dot) {
    display: none; /* 手機端僅保留亮綠狀態點 */
  }

  .system-status {
    padding: 6px;
    background: transparent;
  }

  .topbar {
    padding: 0 12px;
  }

  /* 手機端側邊欄轉為 Off-canvas 動態滑出式抽屜 */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* 完全滑出螢幕外 */
    height: 100vh;
    height: 100dvh;
    width: var(--sidebar-width) !important;
    box-shadow: var(--shadow-lg);
    z-index: 250;
    transition: transform var(--transition-normal), left var(--transition-normal);
  }

  /* 手機端抽屜展開狀態 */
  .sidebar.mobile-open {
    left: 0;
  }

  /* 遮罩背景 */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 240;
    display: none;
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* 內容區域手機端內邊距 */
  .content-area {
    padding: 16px 12px;
    gap: 16px;
  }

  /* 頁面標頭手機端垂直佈局 */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .header-actions .btn {
    flex: 1;
  }

  /* 數據指標單欄顯示 */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .card-header {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .card-body {
    padding: 16px;
  }

  /* === 表單控制項與設定列手機端適配 (Mobile Form Controls Adaptation) === */
  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 12px;
  }

  .setting-info {
    width: 100%;
  }

  .setting-control {
    width: 100% !important;
    justify-content: flex-start;
  }

  .setting-control select.form-select,
  .setting-control .input-icon-group,
  .setting-control .form-control {
    width: 100% !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  /* 手機端保持精簡小尺寸 (Mobile Form Controls Sizing) */
  .form-control {
    min-height: 40px !important;
    padding: 9px 12px !important;
    font-size: 13.5px !important;
    border-radius: 6px !important;
  }

  .form-select {
    min-height: 40px !important;
    padding: 9px 36px 9px 12px !important;
    font-size: 13.5px !important;
    border-radius: 6px !important;
    background-position: right 12px center !important;
  }

  .input-icon-group .form-control {
    padding-left: 38px !important;
  }

  .input-icon-group .input-icon {
    left: 12px !important;
    font-size: 14px !important;
    z-index: 5 !important;
  }

  textarea.form-control {
    min-height: 85px !important;
    padding: 10px 12px !important;
    font-size: 13.5px !important;
  }

  .form-label {
    font-size: 13px !important;
    margin-bottom: 4px !important;
  }

  .checkbox-inline-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .radio-card-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .switch-row-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .switch-item {
    padding: 12px 14px;
  }

  .form-control, .form-select {
    font-size: 14px;
    padding: 10px 12px;
    min-height: 42px;
  }
}

/* 11.3 超窄手機螢幕適配 (Small Mobile Screens: <= 480px) */
@media (max-width: 480px) {
  .brand-logo span {
    font-size: 13.5px;
  }

  .user-name {
    display: none; /* 僅保留頭像圖示與下拉箭頭 */
  }

  .user-profile {
    padding: 4px 8px;
  }

  .page-title {
    font-size: 18px;
  }

  .page-subtitle {
    font-size: 12px;
  }

  .log-entry {
    flex-direction: column;
    gap: 2px;
  }

  .setting-title {
    font-size: 13px;
  }

  .setting-desc {
    font-size: 11.5px;
  }

  .radio-card {
    padding: 12px 14px;
  }
}

/* ==========================================================================
   12. 彈窗與對話框系統 (Modal Dialogs & Backdrop Overlay System)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: rgba(6, 10, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: linear-gradient(180deg, #131c31 0%, #0d1527 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: scale(0.92) translateY(-20px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  position: relative;
  z-index: 3001;
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.02);
}

.modal-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-white);
  background-color: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .modal-dialog {
    max-width: 100%;
    margin: 10px;
    border-radius: 12px;
  }
  .modal-header, .modal-body, .modal-footer {
    padding: 16px;
  }
}

/* ==========================================================================
   13. 廣播橫幅與 Toast 動態通知系統 (Alert Banners & Toast Notification System)
   ========================================================================== */

/* 廣播橫幅堆疊 (Alert Banner Stack) */
.alert-banner-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  position: relative;
  transition: all var(--transition-fast);
}

.alert-banner .alert-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-banner .alert-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.alert-banner .alert-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}

.alert-banner .alert-message {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

.alert-banner .alert-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.alert-banner .alert-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1;
}

.alert-banner .alert-close:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Banner 4 色主題 */
.alert-banner.alert-danger {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.12) 0%, rgba(13, 21, 39, 0.9) 100%);
  border-color: rgba(239, 68, 68, 0.4);
  border-left: 4px solid var(--color-danger);
}

.alert-banner.alert-success {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(13, 21, 39, 0.9) 100%);
  border-color: rgba(16, 185, 129, 0.4);
  border-left: 4px solid var(--color-success);
}

.alert-banner.alert-info {
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.12) 0%, rgba(13, 21, 39, 0.9) 100%);
  border-color: rgba(6, 182, 212, 0.4);
  border-left: 4px solid var(--color-info);
}

.alert-banner.alert-warning {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(13, 21, 39, 0.9) 100%);
  border-color: rgba(245, 158, 11, 0.4);
  border-left: 4px solid var(--color-warning);
}

/* 按鈕水平排版 (Btn Group Row) */
.btn-group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Toast 浮動容器與卡片 (Toast Container & Items) */
.toast-container {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 380px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background-color: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: all 0.25s ease;
}

.toast-item.toast-success { border-left: 4px solid var(--color-success); }
.toast-item.toast-info { border-left: 4px solid var(--color-info); }
.toast-item.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-item.toast-danger { border-left: 4px solid var(--color-danger); }

.toast-item.hide {
  opacity: 0;
  transform: translateX(50px) scale(0.9);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* 公告列表 (Notice Feed List) */
.notice-feed-list {
  display: flex;
  flex-direction: column;
}

.notice-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.notice-feed-item:last-child {
  border-bottom: none;
}

.notice-feed-item:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.notice-feed-item.unread {
  background-color: rgba(0, 102, 255, 0.04);
}

.notice-feed-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background-color: rgba(255, 255, 255, 0.04);
}

.notice-feed-icon.icon-danger { background-color: var(--color-danger-bg); color: var(--color-danger); }
.notice-feed-icon.icon-success { background-color: var(--color-success-bg); color: var(--color-success); }
.notice-feed-icon.icon-warning { background-color: var(--color-warning-bg); color: var(--color-warning); }

.notice-feed-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.notice-feed-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.notice-title-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.notice-feed-tag {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.notice-feed-tag.tag-danger { color: var(--color-danger); }
.notice-feed-tag.tag-success { color: var(--color-success); }
.notice-feed-tag.tag-warning { color: var(--color-warning); }

.notice-feed-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  word-break: break-word;
}

.notice-badge-unread {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.16) 0%, rgba(220, 38, 38, 0.28) 100%);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.45);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
  margin-left: auto;
  letter-spacing: 0.5px;
  user-select: none;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
  white-space: nowrap;
}

.notice-badge-unread .unread-ping {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: unreadPulse 1.8s infinite ease-in-out;
}

@keyframes unreadPulse {
  0% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.85);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.notice-badge-read {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-left: auto;
  letter-spacing: 0.5px;
  user-select: none;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
  white-space: nowrap;
}

.notice-badge-read:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.notice-feed-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

.notice-feed-time {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   14. 第三方登入與 OAuth 認證系統 (OAuth & Social Login Component System)
   ========================================================================== */

/* OAuth 按鈕網格 (OAuth Button Grid) */
.oauth-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

/* 各平台獨立品牌高質感登入按鈕 (OAuth Brand Buttons) */
.btn-oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 48px;
  width: 100%;
  position: relative;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.oauth-brand-icon {
  flex-shrink: 0;
}

/* Discord 按鈕 */
.btn-oauth.btn-discord {
  background: linear-gradient(180deg, #5865F2 0%, #4752C4 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-oauth.btn-discord:hover {
  background: linear-gradient(180deg, #6975f3 0%, #5865F2 100%);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.35);
  transform: translateY(-1.5px);
}

/* Google 按鈕 */
.btn-oauth.btn-google {
  background-color: #ffffff;
  color: #1f2937;
  border-color: #e5e7eb;
}
.btn-oauth.btn-google:hover {
  background-color: #f8fafc;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15), 0 2px 6px rgba(0, 0, 0, 0.2);
  transform: translateY(-1.5px);
}

/* LINE 按鈕 */
.btn-oauth.btn-line {
  background: linear-gradient(180deg, #06c755 0%, #05b34c 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-oauth.btn-line:hover {
  background: linear-gradient(180deg, #07d85d 0%, #06c755 100%);
  box-shadow: 0 4px 16px rgba(6, 199, 85, 0.35);
  transform: translateY(-1.5px);
}

/* WordPress.com 按鈕 */
.btn-oauth.btn-wordpress {
  background: linear-gradient(180deg, #21759b 0%, #185a77 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-oauth.btn-wordpress:hover {
  background: linear-gradient(180deg, #288bb9 0%, #21759b 100%);
  box-shadow: 0 4px 16px rgba(33, 117, 155, 0.35);
  transform: translateY(-1.5px);
}

/* Twitch 按鈕 */
.btn-oauth.btn-twitch {
  background: linear-gradient(180deg, #9146ff 0%, #7227e2 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-oauth.btn-twitch:hover {
  background: linear-gradient(180deg, #a35eff 0%, #9146ff 100%);
  box-shadow: 0 4px 16px rgba(145, 70, 255, 0.35);
  transform: translateY(-1.5px);
}

/* 嵌入式登入卡片組件 (Embeddable OAuth Login Card) */
.oauth-login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #131c31 0%, #0d1527 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.oauth-card-header {
  text-align: center;
  margin-bottom: 24px;
}

.oauth-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0066ff 0%, #38bdf8 100%);
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px auto;
  box-shadow: 0 0 20px rgba(0, 102, 255, 0.4);
}

.oauth-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.oauth-card-subtitle {
  font-size: 12.5px;
  color: #cbd5e1;
}

/* 圓形快捷社交登入圖示組 (Social Circle Icon Grid) */
.social-icon-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.social-icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.2s ease;
}

.social-icon-btn svg {
  flex-shrink: 0;
  pointer-events: none;
}

.social-icon-btn.btn-discord { background-color: #5865F2; color: #ffffff; }
.social-icon-btn.btn-discord:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(88, 101, 242, 0.4); }

.social-icon-btn.btn-google { background-color: #ffffff; }
.social-icon-btn.btn-google:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2); }

.social-icon-btn.btn-line { background-color: #06c755; color: #ffffff; }
.social-icon-btn.btn-line:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(6, 199, 85, 0.4); }

.social-icon-btn.btn-wordpress { background-color: #21759b; color: #ffffff; }
.social-icon-btn.btn-wordpress:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(33, 117, 155, 0.4); }

.social-icon-btn.btn-twitch { background-color: #9146ff; color: #ffffff; }
.social-icon-btn.btn-twitch:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(145, 70, 255, 0.4); }

/* 文字分隔線 (Divider with Text) */
.divider-with-text {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.divider-with-text::before,
.divider-with-text::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider-with-text span {
  padding: 0 12px;
}

/* 密碼強度指示器 (Password Strength Indicator) */
.password-strength {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.password-strength-bar {
  flex: 1;
  height: 4px;
  background-color: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.password-strength-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
}

.password-strength-text {
  font-size: 11px;
  color: #10b981;
  font-weight: 600;
  white-space: nowrap;
}

/* ==========================================================================
   10. 條款介面專用樣式 (Terms & Policy Hub Styles)
   ========================================================================== */
.terms-tab-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.terms-tab-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.terms-tab-btn.active {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 600;
}

.terms-header-box {
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px dashed var(--border-color);
}

.terms-article-box {
  background: rgba(13, 19, 31, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.terms-article-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.terms-article-text {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

.terms-list {
  margin-top: 10px;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.7;
}

.terms-list li {
  margin-bottom: 6px;
}

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

.terms-faq-card {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
}

.terms-faq-q {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 8px;
}

.terms-faq-a {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   11. 關於介紹頁面專用樣式 (About Us & Showcase Styles)
   ========================================================================== */
.about-hero-logo {
  font-size: 42px;
  margin-bottom: 12px;
  display: inline-block;
  animation: floatBounce 3s ease-in-out infinite;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.about-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.about-stat-item {
  background: rgba(13, 19, 31, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.about-stat-num {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.about-stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

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

.about-feature-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition-fast);
}

.about-feature-card:hover {
  border-color: var(--border-color-light);
  transform: translateY(-2px);
}

.about-feature-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.about-feature-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.about-feature-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.about-timeline {
  position: relative;
  padding-left: 20px;
}

.about-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.timeline-version {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.timeline-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

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

.about-team-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.team-avatar {
  font-size: 36px;
  margin-bottom: 12px;
}

.team-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.team-role {
  font-size: 11.5px;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 10px;
}

.team-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   50. 工具模組專屬樣式 (12 大功能工具 + OAuth 登入卡片 + 日誌 KPI)
   ========================================================================== */

/* 轉盤抽獎 Lucky Wheel */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 20px 0;
}

.wheel-canvas-wrapper {
  position: relative;
  width: 320px;
  height: 320px;
  max-width: 100%;
}

#wheel-canvas {
  width: 320px;
  height: 320px;
  border-radius: 50%;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25), 0 0 0 8px #1a2332;
  transition: transform 4s cubic-bezier(0.15, 0.99, 0.18, 1);
}

.wheel-pointer {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 25px solid #ef4444;
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

/* 盲盒抽獎 Blindbox Grid */
.blindbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.blindbox-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 2px dashed #33445e;
  border-radius: var(--radius-lg);
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.blindbox-card:hover {
  transform: translateY(-5px) scale(1.03);
  border-color: var(--accent-primary);
  box-shadow: 0 10px 20px rgba(56, 189, 248, 0.25);
}

.blindbox-icon {
  font-size: 42px;
  margin-bottom: 8px;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.blindbox-card:hover .blindbox-icon {
  transform: rotate(15deg) scale(1.15);
}

.blindbox-opened {
  border-style: solid;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

/* 2FA 碼顯示卡片 */
.totp-code-display {
  font-family: monospace;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 6px;
  color: var(--accent-primary);
  background: #090d16;
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
  margin: 15px 0;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* Discord Webhook 預覽器 */
.discord-embed-preview {
  background-color: #2f3136;
  border-left: 4px solid #5865F2;
  border-radius: 4px;
  padding: 14px;
  color: #dcddde;
  font-family: sans-serif;
  margin-top: 15px;
}

.discord-embed-title {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}

.discord-embed-desc {
  font-size: 13.5px;
  color: #b9bbbe;
  line-height: 1.4;
}

/* 6 大第三方社交登入按鈕區 */
.social-login-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 15px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  color: #fff;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-social:hover {
  transform: translateY(-2px);
  opacity: 0.92;
  color: #fff;
  text-decoration: none;
}

.btn-discord { background-color: #5865F2; }
.btn-google { background-color: #ea4335; }
.btn-line { background-color: #06C755; }
.btn-wordpress { background-color: #21759b; }
.btn-paypal { background-color: #003087; }
.btn-twitch { background-color: #9146FF; }

/* ==========================================================================
   全記錄操作日誌與表格極致響應式適配 (Audit Log & Responsive Table System)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.6);
}

.item-manage-table {
  width: 100%;
  min-width: 1240px; /* 確保電腦、平板與手機端 9 大欄位絕不被擠爆或變形 */
  border-collapse: collapse;
  table-layout: auto;
}

.item-manage-table th, 
.item-manage-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.item-manage-table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.4px;
}

/* 操作日誌 9 大欄位精準寬度與防換行壓縮設計 */
.item-manage-table td:nth-child(1) { width: 55px; font-weight: 700; color: var(--text-muted); text-align: center; }
.item-manage-table td:nth-child(2) { min-width: 105px; white-space: nowrap; }
.item-manage-table td:nth-child(3) { min-width: 220px; max-width: 320px; word-break: break-word; }
.item-manage-table td:nth-child(4) { min-width: 190px; white-space: nowrap; font-weight: 600; } /* 存取帳號防斷行 */
.item-manage-table td:nth-child(5) { min-width: 200px; max-width: 300px; word-break: break-all; }
.item-manage-table td:nth-child(6) { min-width: 130px; white-space: nowrap; font-family: monospace; }
.item-manage-table td:nth-child(7) { min-width: 150px; white-space: nowrap; }
.item-manage-table td:nth-child(8) { min-width: 150px; white-space: nowrap; }
.item-manage-table td:nth-child(9) { min-width: 110px; white-space: nowrap; text-align: center; }

.item-manage-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.035);
}

.item-img-preview {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .social-login-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   15. 彈窗對話框與快捷登入元件 (Modal Dialogs & Social Login Buttons)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-dialog {
  background: #111827;
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 30px rgba(56, 189, 248, 0.15);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(17, 24, 39, 0.95);
}

.modal-header h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 客製關閉圖標按鈕 (Polished Modal Close Button) */
.modal-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  padding: 0;
  margin: 0;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
  transform: rotate(90deg) scale(1.05);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.modal-body {
  padding: 24px;
}

/* 第三方社交登入按鈕網格 (Social OAuth Buttons Grid) */
.social-login-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: #ffffff !important;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.btn-social svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-social:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  filter: brightness(1.15);
}

.btn-discord {
  background: linear-gradient(135deg, #5865F2 0%, #404EED 100%);
  border-color: rgba(88, 101, 242, 0.4);
}

.btn-google {
  background: linear-gradient(135deg, #ea4335 0%, #c5221f 100%);
  border-color: rgba(234, 67, 53, 0.4);
}

.btn-line {
  background: linear-gradient(135deg, #06C755 0%, #05a847 100%);
  border-color: rgba(6, 199, 85, 0.4);
}

.btn-wordpress {
  background: linear-gradient(135deg, #21759b 0%, #195875 100%);
  border-color: rgba(33, 117, 155, 0.4);
}

.btn-paypal {
  background: linear-gradient(135deg, #003087 0%, #001c64 100%);
  border-color: rgba(0, 48, 135, 0.4);
}

.btn-twitch {
  background: linear-gradient(135deg, #9146FF 0%, #772ce8 100%);
  border-color: rgba(145, 70, 255, 0.4);
}

/* ==========================================================================
   隨機抽籤輪盤專屬樣式 (Interactive Lucky Wheel System)
   ========================================================================== */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.wheel-canvas-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  max-width: 100%;
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6), 0 0 0 5px var(--border-color);
  transition: transform 4s cubic-bezier(0.15, 0.9, 0.2, 1);
  cursor: pointer;
  max-width: 100%;
  height: auto;
}

/* 中心懸浮點擊按鈕 (Center Click Pill Button) */
.wheel-center-spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid var(--accent-primary);
  border-radius: 30px;
  color: #ffffff;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 14px rgba(56, 189, 248, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  white-space: nowrap;
}

.wheel-center-spin-btn:hover {
  background: var(--accent-primary);
  color: #0f172a;
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 6px 22px rgba(56, 189, 248, 0.6);
}

.wheel-center-spin-btn:active {
  transform: translate(-50%, -50%) scale(0.96);
}

/* 右側紅色指示箭頭 (Right Pointer Arrow ▶) */
.wheel-pointer-right {
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-right: 24px solid #ef4444;
  filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.6));
  z-index: 12;
  pointer-events: none;
}

/* 右側快速控制面板 */
.wheel-quick-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wheel-textarea {
  font-family: monospace, inherit;
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  background-color: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.shortcut-kbd-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 4px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 11px;
  color: var(--accent-primary);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   2FA TOTP 驗證生成器專屬樣式 (2FA TOTP Generator System)
   ========================================================================== */
.totp-code-box {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-family: monospace, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 3px;
  text-align: center;
  user-select: all;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.totp-code-box:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.totp-progress-container {
  width: 100%;
  height: 6px;
  background-color: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
  margin-bottom: 12px;
}

.totp-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  width: 100%;
  transition: width 1s linear;
}

.qrcode-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.qrcode-img-box {
  width: 210px;
  height: 210px;
  background-color: #ffffff;
  padding: 10px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   全域卡片寬度一致性與響應式適配 (Mobile Responsive & Card Uniformity System)
   ========================================================================== */

/* 1. 技術診斷參數表格規範 */
.tech-param-table {
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: collapse !important;
  font-size: 13px !important;
  line-height: 1.9 !important;
  table-layout: fixed !important;
  box-sizing: border-box !important;
}

.tech-param-table td {
  padding: 4px 0 !important;
  box-sizing: border-box !important;
}

.tech-param-table td.label-col {
  color: var(--text-muted) !important;
  width: 145px !important;
  max-width: 145px !important;
  vertical-align: top !important;
  padding-right: 10px !important;
  white-space: nowrap !important;
}

.tech-param-table td.val-col {
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
  vertical-align: top !important;
}

/* 2. 手機與窄螢幕 (<= 768px) 寬度與內邊距強制統一 */
@media (max-width: 768px) {
  .card-section,
  .terms-article-box,
  .stat-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 16px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .card-section .card-header {
    padding: 10px 0 12px 0 !important;
    margin-bottom: 12px !important;
    gap: 10px !important;
    box-sizing: border-box !important;
    width: 100% !important;
  }

  .card-section .card-body {
    padding: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .grid-2col,
  .radio-card-grid,
  .switch-row-grid,
  .form-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 16px !important;
    box-sizing: border-box !important;
  }

  /* 強制所有 JS 動態產生的網格 container 在手機端一律為單欄 100% 寬度 */
  div[style*="grid-template-columns"],
  .kpi-grid {
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* 手機端 (<= 768px): 輸入框與按鈕轉為兩行 (滿版垂直雙層堆疊) */
  .input-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .input-group .form-control,
  .input-group .form-select,
  .input-group select,
  .input-group .custom-select-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 1 !important;
  }

  .input-group .btn {
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    z-index: 10 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(56, 189, 248, 0.3) !important;
  }

  .tech-param-table td.label-col {
    width: 125px !important;
    max-width: 125px !important;
    font-size: 12.5px !important;
  }
  
  .tech-param-table td.val-col {
    font-size: 12.5px !important;
  }
}

@media (max-width: 480px) {
  .tech-param-table td.label-col {
    width: 110px !important;
    max-width: 110px !important;
    font-size: 12px !important;
  }
  .tech-param-table td.val-col {
    font-size: 12px !important;
  }
}




