/* ============================================================
   AskAKOL Design System
   Mobile-first · Navy + Coral · Clean & Simple
   ============================================================ */

/* --- Tokens --- */
:root {
  /* Brand */
  --navy:       #1b2b4b;
  --navy-light: #2d4a7a;
  --coral:      #e8664f;
  --coral-hover:#d4553f;
  --coral-soft: #fde9e4;

  /* Surfaces */
  --bg:         #f7f7f4;
  --surface:    #ffffff;
  --surface-2:  #fafbfc;
  --elevated:   #ffffff;

  /* Text */
  --text:       #1d2433;
  --text-2:     #5b6475;
  --text-3:     #8f96a3;
  --text-inv:   #ffffff;

  /* Borders */
  --border:     #e3e5ea;
  --border-2:   #d0d3da;

  /* Feedback */
  --success:    #2d9e6e;
  --success-bg: #e6f7ef;
  --warn:       #d4930d;
  --warn-bg:    #fdf5e6;
  --error:      #d94452;
  --error-bg:   #fde8ea;
  --info:       #3b82f6;
  --info-bg:    #eff6ff;

  /* Data badges */
  --badge-a:    #2d9e6e;  /* 官方授權 */
  --badge-b:    #3b82f6;  /* 公開數字 */
  --badge-c:    #8f96a3;  /* 截圖審核 */

  /* Layout */
  --gutter:     16px;
  --max-w:      1200px;
  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  16px;
  --radius-full:9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:  0 4px 20px rgba(0,0,0,.12);

  /* Transitions */
  --ease:       cubic-bezier(.4,0,.2,1);
  --dur:        200ms;

  /* Z layers */
  --z-sticky:   100;
  --z-modal:    200;
  --z-toast:    300;
}

/* --- Dark mode --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy:       #c9d6f2;
    --navy-light: #a3b5d9;
    --coral:      #ff8a73;
    --coral-hover:#ff7a60;
    --coral-soft: #3a2420;
    --bg:         #0f1420;
    --surface:    #161d2c;
    --surface-2:  #1a2233;
    --elevated:   #1e2740;
    --text:       #e6e9f0;
    --text-2:     #9aa4b6;
    --text-3:     #6b7588;
    --border:     #2a3346;
    --border-2:   #354058;
    --shadow-sm:  0 1px 2px rgba(0,0,0,.2);
    --shadow:     0 2px 8px rgba(0,0,0,.3);
    --shadow-lg:  0 4px 20px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --navy:       #c9d6f2;
  --navy-light: #a3b5d9;
  --coral:      #ff8a73;
  --coral-hover:#ff7a60;
  --coral-soft: #3a2420;
  --bg:         #0f1420;
  --surface:    #161d2c;
  --surface-2:  #1a2233;
  --elevated:   #1e2740;
  --text:       #e6e9f0;
  --text-2:     #9aa4b6;
  --text-3:     #6b7588;
  --border:     #2a3346;
  --border-2:   #354058;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.2);
  --shadow:     0 2px 8px rgba(0,0,0,.3);
  --shadow-lg:  0 4px 20px rgba(0,0,0,.4);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--coral); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--coral-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* --- Typography --- */
.t-hero   { font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 700; line-height: 1.2; color: var(--navy); }
.t-h1     { font-size: 1.75rem; font-weight: 700; line-height: 1.3; color: var(--navy); }
.t-h2     { font-size: 1.35rem; font-weight: 700; line-height: 1.35; color: var(--navy); }
.t-h3     { font-size: 1.1rem; font-weight: 600; line-height: 1.4; color: var(--navy); }
.t-body   { font-size: 1rem; line-height: 1.6; }
.t-small  { font-size: 0.875rem; line-height: 1.5; }
.t-tiny   { font-size: 0.75rem; line-height: 1.4; }
.t-muted  { color: var(--text-2); }
.t-center { text-align: center; }

/* --- Layout --- */
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.section   { padding: 48px 0; }
.section + .section { padding-top: 0; }

.flex     { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap{ flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs   { gap: 4px; }
.gap-sm   { gap: 8px; }
.gap-md   { gap: 16px; }
.gap-lg   { gap: 24px; }
.gap-xl   { gap: 32px; }

.grid     { display: grid; gap: 16px; }
.grid-2   { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3   { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4   { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* --- Card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-2);
}
.card--flat { box-shadow: none; }
.card--flat:hover { box-shadow: none; }

/* --- Button --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px;
  font-size: 0.95rem; font-weight: 600;
  border: none; border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--coral); color: #fff;
}
.btn--primary:hover { background: var(--coral-hover); color: #fff; }

.btn--secondary {
  background: transparent; color: var(--navy);
  border: 1.5px solid var(--border-2);
}
.btn--secondary:hover { border-color: var(--coral); color: var(--coral); }

.btn--ghost {
  background: transparent; color: var(--text-2);
  padding: 8px 16px;
}
.btn--ghost:hover { color: var(--coral); background: var(--coral-soft); }

.btn--sm { padding: 6px 16px; font-size: 0.85rem; }
.btn--lg { padding: 14px 32px; font-size: 1.05rem; }
.btn--block { width: 100%; }

/* --- Input --- */
.input-group { display: flex; flex-direction: column; gap: 4px; }
.input-group label { font-size: 0.875rem; font-weight: 500; color: var(--text-2); }
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(232,102,79,.15);
}
.input::placeholder { color: var(--text-3); }

select.input { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6475' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* --- Badge --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  font-size: 0.75rem; font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge--coral  { background: var(--coral-soft); color: var(--coral); }
.badge--green  { background: var(--success-bg); color: var(--success); }
.badge--blue   { background: var(--info-bg); color: var(--info); }
.badge--gray   { background: var(--surface-2); color: var(--text-3); }
.badge--navy   { background: rgba(27,43,75,.1); color: var(--navy); }

/* Data verification badges */
.badge--data-a { background: var(--success-bg); color: var(--badge-a); }
.badge--data-b { background: var(--info-bg); color: var(--badge-b); }
.badge--data-c { background: var(--surface-2); color: var(--badge-c); }

/* --- Tag --- */
.tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.tag:hover, .tag.active {
  border-color: var(--coral);
  color: var(--coral);
  background: var(--coral-soft);
}

/* --- Avatar --- */
.avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.avatar--sm  { width: 32px; height: 32px; }
.avatar--lg  { width: 64px; height: 64px; }
.avatar--xl  { width: 96px; height: 96px; }

/* --- Stat card --- */
.stat-card {
  text-align: center;
  padding: 20px 12px;
}
.stat-card__num {
  font-size: 1.5rem; font-weight: 700;
  color: var(--coral);
  line-height: 1.2;
}
.stat-card__label {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-top: 2px;
}

/* --- Nav / Header --- */
.header {
  position: sticky; top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-sticky);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.header__logo {
  font-size: 1.2rem; font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  display: flex; align-items: center; gap: 6px;
}
.header__logo span { color: var(--coral); }
.header__nav {
  display: flex; align-items: center; gap: 4px;
}
.header__link {
  padding: 6px 12px;
  font-size: 0.9rem; font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius);
  transition: all var(--dur) var(--ease);
}
.header__link:hover { color: var(--coral); background: var(--coral-soft); }
.header__link.active { color: var(--coral); }

/* Mobile menu */
.header__menu-btn {
  display: none;
  background: none; border: none;
  padding: 8px; cursor: pointer;
  color: var(--text);
}
@media (max-width: 768px) {
  .header__nav { display: none; }
  .header__nav.open {
    display: flex; flex-direction: column;
    position: absolute; top: 56px; left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px var(--gutter);
    box-shadow: var(--shadow-lg);
  }
  .header__menu-btn { display: block; }
}

/* --- Footer --- */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,.7);
  padding: 40px 0 24px;
  margin-top: 64px;
}
.footer a { color: rgba(255,255,255,.85); }
.footer a:hover { color: #fff; }
.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}
.footer__col h4 {
  color: #fff; font-size: 0.9rem; font-weight: 600;
  margin-bottom: 12px;
}
.footer__col ul { display: flex; flex-direction: column; gap: 6px; }
.footer__col a { font-size: 0.85rem; }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 16px;
  font-size: 0.8rem;
  text-align: center;
}

/* --- Flow steps --- */
.flow-steps {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 0.85rem; font-weight: 500;
  white-space: nowrap;
}
.flow-arrow { color: var(--coral); font-weight: 700; font-size: 0.9rem; }

/* --- Toast --- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-toast);
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; transition: opacity var(--dur) var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; pointer-events: auto; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: var(--z-modal);
  display: flex; align-items: center; justify-content: center;
  padding: var(--gutter);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.modal__close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 1.2rem;
  padding: 4px;
}
.modal__close:hover { color: var(--text); }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state__title { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }

/* --- Loading --- */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Utilities --- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mt-xl { margin-top: 32px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.p-md  { padding: 16px; }
.p-lg  { padding: 24px; }

/* Responsive */
@media (min-width: 768px) {
  :root { --gutter: 24px; }
  .section { padding: 64px 0; }
  .md\:grid-2 { grid-template-columns: 1fr 1fr; }
  .md\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:flex-row { flex-direction: row; }
  .md\:hidden { display: none; }
}
@media (min-width: 1024px) {
  .lg\:grid-4 { grid-template-columns: repeat(4, 1fr); }
}
