/* style.css - 現代化金融儀表板質感樣式 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --card-bg: rgba(255, 255, 255, 0.95);
}

html, body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
  -webkit-text-size-adjust: 100%;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

main, header, nav, section, footer {
  max-width: 100vw;
}

/* ==========================================
   iOS 靈動島 / 瀏海 / APP (Standalone) 安全區域適配
   ========================================== */
header {
  padding-top: 0 !important;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* APP (PWA / Standalone) 模式下不額外留白 */
@media all and (display-mode: standalone) {
  header {
    padding-top: 0 !important;
  }
  #screen-lock {
    padding-top: 0 !important;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 16px) !important;
  }
  main {
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 20px) !important;
  }
}

/* iOS Safari 瀏覽器支援 */
@supports (-webkit-touch-callout: none) {
  header {
    padding-top: 0 !important;
  }
}

/* 防止 iOS 表格與畫布撐爆寬度 */
.overflow-x-auto {
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
}

canvas {
  max-width: 100% !important;
}

/* 隱藏滾動條但保持滾動 */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* 玻璃擬態與陰影 */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
}

.glass-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* 自訂滾動條 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 漸層文字與卡片 */
.gradient-text-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-header {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}

.gradient-income {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.gradient-expense {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.gradient-savings {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

.gradient-recurring {
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

/* 標籤徽章動畫 */
.badge-pulse {
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* 動態按鈕縮放與觸感 */
.btn-interactive {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-interactive:hover {
  transform: translateY(-2px);
}
.btn-interactive:active {
  transform: translateY(1px);
}

/* 類別圖標容器 */
.category-icon-box {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: transform 0.2s ease;
}
.category-icon-box:hover {
  transform: scale(1.1);
}

/* 模態彈窗過渡 */
.modal-overlay {
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  transition: opacity 0.25s ease-out;
}

.modal-content {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease-out;
}

/* 儀表進度條美化 */
.custom-progress {
  height: 8px;
  border-radius: 9999px;
  background-color: #e2e8f0;
  overflow: hidden;
}

.custom-progress-bar {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 財務健康度圓形量表 */
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 響應式優化 */
@media (max-width: 640px) {
  .mobile-hide {
    display: none !important;
  }
  
  .modal-overlay {
    padding: 12px;
  }

  .modal-content {
    padding: 16px !important;
    max-height: 88vh;
    border-radius: 20px !important;
  }

  .glass-card {
    padding: 14px !important;
    border-radius: 16px !important;
  }
}
