/**
 * Main CSS - 客製化樣式
 * 處理 Tailwind 無法覆蓋的特效與動畫
 */

:root {
  --primary-navy: #0F172A;
  --accent-gold: #D97706;
  --bg-light: #F1F5F9;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Noto Sans TC', sans-serif;
  background-color: var(--bg-light);
  padding-bottom: 90px;
}

/* ==================== Google 登入按鈕 ==================== */
.google-btn {
  display: flex;
  align-items: center;
  background-color: white;
  border: 1px solid #dadce0;
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: background-color .3s, box-shadow .3s;
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 13px;
  color: #3c4043;
}

.google-btn:hover {
  background-color: #f7fafe;
  border-color: #d2e3fc;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3);
}

.google-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

/* ==================== 分頁切換動畫 ==================== */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== 導航列 Active 狀態 ==================== */
.nav-item {
  transition: all 0.2s ease;
}

.nav-item.active {
  color: var(--accent-gold);
  font-weight: 700;
}

.nav-item.active svg {
  fill: currentColor;
}

/* ==================== 快速情境按鈕 ==================== */
.quick-btn {
  text-align: left;
  transition: all 0.2s;
}

.quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: #D97706;
}

.quick-btn:active {
  transform: translateY(0);
}

/* ==================== Toast 通知 ==================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -20px);
  padding: 12px 24px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 600;
  color: white;
  /* 確保 Toast 比 Modal 還要高，這樣開著彈窗也能看到成功訊息 */
  z-index: 10001 !important;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.toast-success {
  background-color: #10b981;
}

.toast-error {
  background-color: #ef4444;
}

.toast-warning {
  background-color: #f59e0b;
}

/* ==================== Modal 彈窗 ==================== */

/* Modal 開啟時鎖定背景滾動 (跨平台相容) */
body.modal-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

/* iOS Safari 額外修正 */
@supports (-webkit-touch-callout: none) {
  body.modal-open {
    -webkit-overflow-scrolling: auto;
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* 原本可能是 100，改為 10000 確保最高層級 */
  z-index: 10000 !important;
  display: flex;
  align-items: center; /* 讓彈窗垂直置中 */
  justify-content: center;
  padding: 60px 16px 120px 16px;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background-color: white;
  width: 100%;
  max-width: 28rem;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transform: scale(1);
  transition: transform 0.3s ease;
  margin: 0 auto;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 20px 12px 120px 12px;
    align-items: flex-start;
  }

  .modal-content {
    max-width: 100%;
    border-radius: 16px;
    margin: 0 auto;
    padding: 20px 16px;
  }
}

/* ==================== 知識卡片 Hover ==================== */
.knowledge-card {
  transition: all 0.2s ease;
  cursor: pointer;
}

.knowledge-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ==================== 捲軸美化 ==================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ==================== 響應式修正 ==================== */
/* 移除大螢幕隱藏導航的設定，讓導航在所有螢幕都顯示 */
@media (min-width: 1024px) {
  body {
    padding-bottom: 90px; /* 確保內容不被導航遮住 */
  }
  
  .view-section {
    min-height: 400px;
  }
}

/* 桌面版導航樣式優化 */
@media (min-width: 1024px) {
  nav {
    justify-content: center;
    gap: 2rem;
  }
  
  .nav-item {
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
  }
  
  .nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .nav-item span {
    font-size: 0.875rem;
  }
}

/* ==================== 表單元素美化 ==================== */
select:focus,
textarea:focus,
input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 載入動畫 ==================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.animate-pulse {
  animation: pulse 2s infinite;
}

/* ==================== 按鈕按壓效果 ==================== */
button:active {
  transform: scale(0.98);
}

/* ==================== 漸層背景動畫 ==================== */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.bg-gradient-animated {
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
}

/* ==================== 卡片陰影層次 ==================== */
.card-shadow {
  box-shadow: 
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.card-shadow-lg {
  box-shadow: 
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ==================== 文字選取顏色 ==================== */
::selection {
  background-color: #fbbf24;
  color: #1f2937;
}

/* ==================== 防止文字被選取 (特定元素) ==================== */
.nav-item,
.quick-btn,
.knowledge-card {
  user-select: none;
  -webkit-user-select: none;
}

/* ==================== Safe Area (iOS) ==================== */
@supports (padding: env(safe-area-inset-bottom)) {
  nav {
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
}

/* ==================== 載入骨架屏 ==================== */
.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 25%,
    #e0e0e0 50%,
    #f0f0f0 75%
  );
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ==================== 打字機效果 (備用) ==================== */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  animation: typing 3s steps(40, end);
}

/* ==================== 淡入淡出通用 ==================== */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

.fade-out {
  animation: fadeOut 0.5s ease-out;
}

.animate-fadeIn {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ==================== 文字截斷 ==================== */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==================== Toggle Switch (趕時間模式) ==================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #D97706;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* ==================== 按鈕 disabled 狀態 ==================== */
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:disabled:hover {
  transform: none;
}

/* ==================== 筆記卡片樣式 ==================== */
.note-card {
  transition: all 0.2s ease;
  position: relative;
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.note-card:active {
  transform: translateY(0);
}

/* 收藏按鈕 */
.note-card .favorite-btn {
  opacity: 0.6;
  transition: all 0.2s;
}

.note-card:hover .favorite-btn {
  opacity: 1;
}

.note-card .favorite-btn:hover {
  transform: scale(1.2);
}

/* ==================== 語音輸入按鈕 ==================== */
.voice-input-btn {
  transition: all 0.2s ease;
}

.voice-input-btn:hover {
  background-color: #eff6ff;
  color: #2563eb;
}

.voice-input-btn.recording {
  animation: pulse-recording 1s infinite;
  background-color: #fef2f2;
  color: #dc2626;
}

@keyframes pulse-recording {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
  }
}

/* ==================== 筆記篩選標籤 ==================== */
#notesActiveFilters .inline-flex {
  animation: fadeIn 0.2s ease-out;
}

#notesActiveFilters button {
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

#notesActiveFilters button:hover {
  opacity: 1;
}

/* ==================== 筆記空狀態 ==================== */
.empty-state {
  animation: fadeIn 0.3s ease-out;
}

.empty-state svg {
  animation: float 3s ease-in-out infinite;
}

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

/* ==================== 儲存為筆記按鈕動畫 ==================== */
#saveToNotesBtn {
  animation: pulse-attention 2s infinite;
}

@keyframes pulse-attention {
  0%, 100% {
    box-shadow: 0 4px 14px -1px rgba(245, 158, 11, 0.3);
  }
  50% {
    box-shadow: 0 6px 20px -1px rgba(245, 158, 11, 0.5);
  }
}

#saveToNotesBtn:hover {
  animation: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -1px rgba(245, 158, 11, 0.4);
}

/* ==================== 使用提示詞按鈕 ==================== */
#usePromptInEditBtn,
#usePromptFromDetailBtn {
  transition: all 0.2s;
}

#usePromptInEditBtn:hover,
#usePromptFromDetailBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -1px rgba(16, 185, 129, 0.3);
}

/* ==================== 筆記 Modal 左對齊文字 ==================== */
#noteEditModal .modal-content,
#noteDetailModal .modal-content {
  text-align: left;
}

/* ==================== 筆記表單 textarea 焦點樣式 ==================== */
#noteDialogueInput:focus,
#noteRemarksInput:focus {
  background-color: white;
  border-color: #3b82f6;
}

/* ==================== 隱私提醒區塊樣式 ==================== */
.bg-amber-50 {
  background-color: #fffbeb;
}

/* ==================== 每日挑戰里程碑 ==================== */
.streak-milestone {
  text-align: center;
  padding: 12px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.3s;
  opacity: 0.5;
}

.streak-milestone.achieved {
  opacity: 1;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #fbbf24;
  box-shadow: 0 4px 6px -1px rgba(251, 191, 36, 0.2);
}

.streak-milestone.achieved .text-2xl {
  animation: bounce 2s infinite;
}

/* ==================== 挑戰歷史日曆 ==================== */
.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  min-height: 70px;
  transition: all 0.2s;
}

.day-cell.completed {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #22c55e;
}

.day-cell.completed .text-lg {
  color: #16a34a;
}

.day-cell.today {
  border-color: #3b82f6;
  border-width: 3px;
}

.day-cell.missed {
  background: #fef2f2;
  border-color: #fecaca;
}


/* ==================== V3.9 Enhanced: 電玩風格經驗值進度條 ==================== */

/* 進度條容器（外框） */
.xp-bar-container {
  position: relative;
  width: 100%;
  background: linear-gradient(to bottom, #e2e8f0, #cbd5e1);
  border-radius: 9999px;
  height: 16px;
  overflow: hidden;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.05);
  border: 2px solid #94a3b8;
}

/* 進度條本體（內填充） */
.xp-bar {
  height: 100%;
  border-radius: 9999px;
  transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  overflow: hidden;
}

/* 進度條閃爍動畫（電玩感） */
.xp-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* 進度條顏色變化（根據進度百分比動態調整 class） */
.xp-bar-low {
  background: linear-gradient(to right, #9ca3af, #6b7280);
}

.xp-bar-medium {
  background: linear-gradient(to right, #3b82f6, #2563eb);
}

.xp-bar-high {
  background: linear-gradient(to right, #fbbf24, #f59e0b);
}

.xp-bar-nearly-max {
  background: linear-gradient(to right, #10b981, #059669);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* 進度條上的百分比文字（內嵌在進度條上） */
.xp-bar span {
  font-size: 10px;
  font-weight: bold;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: 10;
  white-space: nowrap;
}

/* 進度條脈衝效果（接近升級時） */
.xp-bar.near-levelup {
  animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
  }
}

/* 等級顯示文字（電玩風格標題） */
#userLevel {
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: -0.5px;
}

/* 升級進度資訊文字 */
#xpProgressInfo {
  font-size: 11px;
  line-height: 1.6;
  padding: 8px 12px;
  background: linear-gradient(to right, #f8fafc, #f1f5f9);
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

#xpProgressInfo .font-bold {
  font-family: 'Roboto Mono', monospace;
}

/* 進度徽章（可選，顯示在進度條右上角） */
#xpProgressBadge {
  animation: badge-bounce 2s infinite;
}

@keyframes badge-bounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.1);
  }
}

/* 會員徽章優化（電玩風格） */
#memberTier {
  font-size: 12px;
  padding: 6px 16px;
  border-radius: 9999px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

#memberTier:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 響應式設計：手機版調整 */
@media (max-width: 640px) {
  .xp-bar-container {
    height: 14px;
  }
  
  #xpProgressInfo {
    font-size: 10px;
    padding: 6px 10px;
  }
  
  #userLevel {
    font-size: 16px;
  }
}

/* ==================== 等級色彩系統（10 級） ==================== */

/* Lv.1 - 實習新人 */
.level-1 {
  color: #9ca3af;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

/* Lv.2 - 潛力新秀 */
.level-2 {
  color: #60a5fa;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

/* Lv.3 - 業務尖兵 */
.level-3 {
  color: #06b6d4;
  background: linear-gradient(135deg, #cffafe, #a5f3fc);
}

/* Lv.4 - 銷售菁英 */
.level-4 {
  color: #f97316;
  background: linear-gradient(135deg, #fed7aa, #fdba74);
}

/* Lv.5 - 金牌業務 */
.level-5 {
  color: #eab308;
  background: linear-gradient(135deg, #fef3c7, #fde047);
}

/* Lv.6 - 專業顧問 */
.level-6 {
  color: #6366f1;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}

/* Lv.7 - 榮耀顧問 */
.level-7 {
  color: #a855f7;
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
}

/* Lv.8 - 鑽石會員 */
.level-8 {
  color: #ec4899;
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
}

/* Lv.9 - 巔峰領袖 */
.level-9 {
  color: #dc2626;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  animation: prestige-glow 3s infinite;
}

/* Lv.10 - 殿堂傳奇 */
.level-10 {
  color: #7c3aed;
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  animation: legendary-shine 4s infinite;
}

/* 高階等級發光效果 */
@keyframes prestige-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.6);
  }
}

@keyframes legendary-shine {
  0%, 100% {
    box-shadow: 0 0 15px rgba(124, 58, 237, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.8);
    transform: scale(1.05);
  }
}

/* ==================== 升級動畫（可選，當經驗值更新時觸發） ==================== */
@keyframes levelup-celebration {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.levelup-animation {
  animation: levelup-celebration 0.6s ease-out;
}

/* 經驗值增加時的數字跳動效果 */
@keyframes xp-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(-8px);
  }
  75% {
    transform: translateY(-4px);
  }
}

.xp-gain-animation {
  animation: xp-bounce 0.5s ease-out;
  color: #10b981;
  font-weight: bold;
}

/* ==================== 用戶下拉選單 ==================== */
#userDropdownMenu {
  animation: dropdown-slide 0.2s ease-out;
}

@keyframes dropdown-slide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#userDropdownMenu.hidden {
  animation: dropdown-slide-out 0.15s ease-in;
}

@keyframes dropdown-slide-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* 下拉選單按鈕懸停效果 */
#userDropdownMenu button:hover {
  background-color: #f8fafc;
}

#userDropdownMenu button:active {
  transform: scale(0.98);
}

/* ==================== 社群分享按鈕 ==================== */
.share-social-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border-radius: 16px;
  color: white;
  font-weight: bold;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}

.share-social-btn:active {
  transform: scale(0.95);
}

.share-social-btn svg {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* ==================== 歡迎畫面關閉按鈕 ==================== */
.modal-content {
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #94a3b8;
  transition: all 0.2s;
  line-height: 1;
}

.modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #475569;
  transform: scale(1.1);
}

.modal-close-btn:active {
  transform: scale(0.95);
}

/* ==================== 下拉選單高優先級樣式 ==================== */
#userDropdownMenu {
  z-index: 99999 !important;
  position: fixed !important;
}

/* ==================== 手機版底部導航優化 ==================== */
nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1000 !important; /* 確保在大部分內容之上，但低於下拉選單 */
}

/* 確保內容不被底部導航遮擋 */
main {
  padding-bottom: 80px !important; /* 為底部導航留出空間 */
}

/* iOS Safari 安全區域支持 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  nav {
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)) !important;
  }
  
  main {
    padding-bottom: calc(80px + env(safe-area-inset-bottom)) !important;
  }
}

/* ==================== 管理員面板樣式 ==================== */
.admin-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  transition: all 0.2s;
  cursor: pointer;
}

.admin-tab-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.admin-tab-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border-color: #2563eb;
  color: white;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
}

.admin-tab-btn svg {
  transition: transform 0.2s;
}

.admin-tab-btn.active svg {
  transform: scale(1.1);
}

.admin-panel {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.admin-panel.active {
  display: block;
}

.backup-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  transition: all 0.2s;
  cursor: pointer;
}

.backup-btn:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #3b82f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.backup-btn:active {
  transform: translateY(0);
}

.backup-btn svg {
  flex-shrink: 0;
}

/* 預覽區域樣式 */
#importPreviewContent {
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 格式提示樣式 */
#formatHint {
  animation: fadeIn 0.3s ease-out;
}

