/* 台灣鹽酥雞 採購叫貨系統 — 共用樣式 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #C8102E;
  --primary-dark: #9A0C24;
  --gold: #D4A24C;
  --gold-soft: #F5E6CC;
  --cream: #FFFAF2;
  --ink: #2B1A14;
  --muted: #8A7569;
  --border: #E8DCCB;
  --surface: #FFFFFF;
  --success: #2E8B57;
  --warning: #E89B0E;
  --danger: #C8102E;
  --shadow-sm: 0 1px 3px rgba(43,26,20,0.06), 0 1px 2px rgba(43,26,20,0.04);
  --shadow-md: 0 4px 14px rgba(43,26,20,0.08), 0 2px 4px rgba(43,26,20,0.05);
  --shadow-lg: 0 12px 32px rgba(43,26,20,0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

/* ============ 共用 Header ============ */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}
.app-header__brand img { height: 36px; width: auto; }
.app-header__brand small {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
  margin-left: 8px;
}
.app-header__actions { display: flex; gap: 8px; align-items: center; }

.btn-back {
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
}
.btn-back:hover { background: var(--cream); color: var(--ink); }

/* ============ 通用容器 ============ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}
.container--narrow { max-width: 880px; }

/* ============ 按鈕 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--gold { background: var(--gold); color: white; }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn--ghost:hover { background: var(--cream); }
.btn--sm { padding: 6px 12px; font-size: 13px; }
.btn--lg { padding: 14px 28px; font-size: 16px; }

/* ============ 卡片 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============ 表單 ============ */
.input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200,16,46,0.12);
}
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ============ 表格 ============ */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.tbl th {
  background: var(--gold-soft);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 2px solid var(--gold);
}
table.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--cream); }

/* ============ Badge ============ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge--haifa   { background: #FFF6D6; color: #8B6914; border: 1px solid #E8C547; }
.badge--market  { background: #E0F2E5; color: #1F6B3A; border: 1px solid #7FBC91; }
.badge--raw     { background: #FCE0E5; color: #8B1426; border: 1px solid #E89AA8; }
.badge--season  { background: #F0E0F2; color: #5C2B6B; border: 1px solid #B891C7; }
.badge--supply  { background: #E0E8F2; color: #1F3A6B; border: 1px solid #91A8C7; }
.badge--other   { background: #ECE6DC; color: var(--ink); border: 1px solid var(--border); }

.badge--success { background: #E0F2E5; color: var(--success); }
.badge--warning { background: #FFF3D6; color: var(--warning); }
.badge--danger  { background: #FCE0E5; color: var(--danger); }

/* ============ 數字漲跌 ============ */
.delta-up   { color: var(--danger); font-weight: 700; }   /* 漲 = 紅（台股慣例）*/
.delta-down { color: var(--success); font-weight: 700; }  /* 跌 = 綠 */
.delta-flat { color: var(--muted); }

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--ink);
  color: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============ 空狀態 ============ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty__icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }

/* ============ Quick Nav ============ */
.quick-nav {
  display: flex;
  background: var(--ink);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 65px;   /* below app-header */
  z-index: 99;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.quick-nav::-webkit-scrollbar { display: none; }
.quick-nav__link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  color: rgba(255,255,255,0.62);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.quick-nav__link:hover { background: rgba(255,255,255,0.08); color: white; text-decoration: none; }
.quick-nav__link--active { color: var(--gold); border-bottom-color: var(--gold); background: rgba(212,162,76,0.12); }
.quick-nav__icon { font-size: 15px; line-height: 1; }

/* ============ 響應式 ============ */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .app-header { padding: 12px 16px; }
  .app-header__brand { font-size: 16px; }
  .app-header__brand img { height: 30px; }
  .quick-nav { top: 57px; }
  .quick-nav__link { padding: 9px 14px; font-size: 12px; }
}
