/**
 * FinNexus 主題（§3.1）
 * 統一基礎 #2C3E50；公司 #2980B9；家庭 #27AE60；隱藏項淡金邊
 */

/* ── 全站觸控優化：消除 300ms 點擊延遲 + iOS 點選殘影 ── */
*, *::before, *::after {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
:root {
  /* ── Phase 4.3：Design Tokens ── */

  /* 語義色（已有） */
  --fn-base: #2C3E50;
  --fn-business: #2980B9;
  --fn-family: #27AE60;
  --fn-hidden-border: rgba(212, 175, 55, 0.5);

  /* Primary / Accent — 對應 intro / dashboard 原硬編碼 hex */
  --color-primary: #1E3A8A;          /* 原 intro #1E3A8A */
  --color-primary-500: #3B82F6;      /* 原 hero gradient */
  --color-accent: #7C3AED;           /* 紫色強調 */
  --color-pink: #EC4899;
  --color-warn: #F59E0B;
  --color-success: #10B981;
  --color-danger: #EF4444;
  --color-info: #0EA5E9;

  /* Neutral scale（Tailwind-like） */
  --color-neutral-50:  #F9FAFB;
  --color-neutral-100: #F3F4F6;
  --color-neutral-200: #E5E7EB;
  --color-neutral-300: #D1D5DB;
  --color-neutral-400: #9CA3AF;
  --color-neutral-500: #6B7280;
  --color-neutral-600: #4B5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1F2937;
  --color-neutral-900: #111827;

  /* Spacing scale（4px base） */
  --space-1: 0.25rem;   /*  4px */
  --space-2: 0.5rem;    /*  8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);

  /* Typography */
  --font-size-xs: 0.72rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
}

/* ── Phase 4.2：_partials/amount_card.html 對應樣式 ── */
.fn-amount-card {
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-neutral-50);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.fn-amount-card__head {
  font-size: var(--font-size-sm);
  color: var(--color-neutral-600);
  font-weight: var(--font-weight-medium);
}
.fn-amount-card__title { color: inherit; }
.fn-amount-card__value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-neutral-900);
}
.fn-amount-card__subtitle { color: var(--color-neutral-500); }

.fn-card-tone--income   { border-left: 4px solid var(--color-success); }
.fn-card-tone--expense  { border-left: 4px solid var(--color-danger); }
.fn-card-tone--warn     { border-left: 4px solid var(--color-warn); }
.fn-card-tone--primary  { border-left: 4px solid var(--color-primary); }
.fn-card-tone--neutral  { border-left: 4px solid var(--color-neutral-400); }

[data-theme="family"] .navbar,
.navbar.bg-primary {
  background-color: var(--fn-family) !important;
}

.fn-hidden-item {
  border: 1px solid var(--fn-hidden-border);
}

/* ── 導覽與分頁視覺統一 ── */
.fn-nav-tabs {
  display: flex;
  gap: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  background: #f9fafb;
  padding: 0.2rem;
}
.fn-nav-tabs .nav-link {
  flex: 1;
  text-align: center;
  border: none;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: #6b7280;
  background: transparent;
  transition: all 0.15s;
}
.fn-nav-tabs .nav-link:hover { color: #374151; background: #f3f4f6; }
.fn-nav-tabs .nav-link.active {
  background: var(--fn-family);
  color: #fff;
}
.fn-nav-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}
.fn-nav-pill:hover { background: rgba(255, 255, 255, 0.35); }

.fn-month-pill {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.fn-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--fn-family) 0%, #047857 100%);
  color: #fff;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 0.875rem;
}
.fn-month-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}
.fn-month-nav .fn-month-title { font-size: 1.1rem; font-weight: 700; }
.fn-filter-pill {
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  background: #fff;
  text-decoration: none;
  transition: all 0.15s;
}
.fn-filter-pill:hover,
.fn-filter-pill.active { border-color: var(--fn-family); color: var(--fn-family); background: #f0fdf4; }
/* ── 底部導覽列（與頂部 navbar 主題一致）── */
.fn-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
.fn-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.5rem 0.25rem;
  min-height: 52px;
  font-size: 0.65rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.15s;
}
.fn-bottom-nav a i { font-size: 1.3rem; }
.fn-tab-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  text-align: center;
}
.fn-bottom-nav a.active,
.fn-bottom-nav a:hover { color: var(--fn-family); }
/* Admin 六鍵時略縮字級與內距 */
.fn-bottom-nav--dense a {
  font-size: 0.58rem;
  padding: 0.45rem 0.12rem;
  min-height: 50px;
}
.fn-bottom-nav--dense a i { font-size: 1.15rem; }
@media (min-width: 992px) {
  .fn-bottom-nav { display: none !important; }
  .fn-main-has-bottom-nav { padding-bottom: 1rem !important; }
}

/* ── 寬螢幕 App 式版面：主內容限制寬度並置中 ── */
@media (min-width: 768px) {
  .fn-app-container {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
  }
  .fn-app-container--wide {
    max-width: 960px;
  }
}
