/*
 * main.css — 留学生机票比价 v0.1 基础样式
 * 原则: mobile-first / 单列 / 可点元素 >=44px / 无动画美化
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  background: #fff;
}

.app-header {
  padding: 16px;
  border-bottom: 1px solid #e5e5e5;
}
.app-header h1 { margin: 0; font-size: 18px; font-weight: 600; }

/* T-07 (2026-04-20, v0.1.1 polish): 顶部 nav. 当前页用 aria-current="page" 加粗 + 深色. 朴素无框架匹配 v0.1 风格. */
.app-nav { display: flex; gap: 16px; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; }
.app-nav a { color: #2563eb; text-decoration: none; font-size: 14px; }
.app-nav a[aria-current="page"] { font-weight: 700; color: #111827; }

.container { max-width: 480px; margin: 0 auto; padding: 16px; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 4px; font-size: 14px; color: #333; }

/* 所有 input/select/button 统一 44px 触点, 16px 字号(iOS 避免缩放). F4 顺带加 email/number, textarea 单独控 min-height */
.search-form input[type="date"],
.search-form input[type="email"],
.search-form input[type="number"],
.search-form textarea,
.search-form select,
.submit-btn {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #111;
}

.flex-toggle { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.flex-toggle input[type="checkbox"] { min-width: 20px; min-height: 20px; }
.flex-hint { font-size: 12px; color: #888; margin: 4px 0 0 28px; }

.submit-btn {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
  cursor: pointer;
}

.results { margin-top: 24px; min-height: 60px; }

.results-hint {
  margin: 0;
  padding: 16px;
  border: 1px dashed #ccc;
  border-radius: 4px;
  color: #555;
  font-size: 14px;
}

.results-summary {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #f5f7fa;
  border-radius: 4px;
  font-size: 13px;
  color: #444;
}

/* ---------- 卡片 ---------- */
.offer-card {
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.price-box { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.price-usd { font-size: 28px; font-weight: 700; color: #2563eb; line-height: 1.2; }
.price-cny { margin-top: 2px; font-size: 14px; color: #666; }
.price-rate-note { margin-top: 2px; font-size: 11px; color: #999; }

.leg { padding: 12px 0; border-bottom: 1px dashed #eee; }
.leg:last-of-type { border-bottom: none; }

.leg-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.leg-title {
  font-size: 12px; font-weight: 600; color: #fff;
  background: #6b7280; padding: 2px 6px; border-radius: 3px;
}
.leg-route { font-size: 16px; font-weight: 600; color: #111; }

.leg-airline {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px; font-size: 14px; color: #333;
}
.airline-name { font-weight: 500; }
.flight-numbers { color: #666; }

.leg-times {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.time-block { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 120px; }
.time-label { font-size: 12px; color: #888; }
.time-value { font-size: 14px; color: #111; font-variant-numeric: tabular-nums; }
.time-arrow { padding-top: 18px; color: #888; font-size: 14px; }

/* 时区未知标记(Q3: 不静默) */
.tz-unknown {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  font-size: 11px;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 3px;
  align-self: flex-start;
}

.leg-meta { display: flex; gap: 16px; font-size: 13px; color: #555; flex-wrap: wrap; }

.offer-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid #eee; gap: 12px; flex-wrap: wrap;
}
.offer-source { font-size: 12px; color: #888; }

.booking-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 20px;
  background: #2563eb; color: #fff;
  font-size: 15px; font-weight: 600;
  text-decoration: none; border-radius: 4px;
}

/* ---------- 状态框(loading/empty/error) ---------- */
.status-box {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 24px 16px;
  border-radius: 4px; text-align: center;
}
.status-loading { border: 1px dashed #93c5fd; background: #eff6ff; color: #1d4ed8; }
.status-empty   { border: 1px dashed #ccc;    background: #fafafa; color: #555; }
.status-error   { border: 1px solid #fecaca;  background: #fef2f2; color: #b91c1c; }
.status-text    { margin: 0; font-size: 14px; }

.spinner {
  width: 28px; height: 28px;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ---------- F3 加载更多按钮 ---------- */
.load-more {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 16px 0;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.load-more:hover { background: #1d4ed8; }

/* ---------- F4 订阅表单 / 管理页 ---------- */
/* warning-banner: F16 + BLOCKER-007 自订自收限制提示, 置于 /subscribe 顶部. 琥珀色系避免和 .status-error 红冲突 */
.warning-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 4px;
  color: #78350f;
  font-size: 13px;
  line-height: 1.55;
}
.warning-banner code {
  padding: 1px 4px;
  background: #fef3c7;
  border-radius: 3px;
  font-size: 12px;
}

/* textarea 高度由 rows 控制, 其余字段(email/number/date/select)共享上方统一块 */
.search-form textarea { min-height: 88px; resize: vertical; }

/* danger: 取消订阅按钮, 红色系, 覆盖 .booking-btn 蓝底 */
.booking-btn.danger { background: #dc2626; border-color: #dc2626; }
.booking-btn.danger:hover { background: #b91c1c; }

/* F10 B: 按钮 disabled / 已取消文案 / 回搜索页链接 */
button:disabled { opacity: 0.5; cursor: not-allowed; }
.status-cancelled { color: #888; padding: 16px; text-align: center; }
.back-link { display: inline-block; margin-top: 12px; color: #2563eb; }

/* ---------- 社区占位 ---------- */
.community-section {
  margin-top: 32px; padding: 16px;
  background: #f5f5f5;
  border: 1px dashed #d4d4d4;
  border-radius: 6px;
}
.community-section h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: #555; }
.placeholder-hint { margin: 0; font-size: 13px; color: #777; line-height: 1.6; }

/* T-03 排序下拉: 搜索前 hidden, JS 在 showOffers 时取消 hidden。高度与 select 一致 (min-height 44px 移动端触点)。 */
.sort-controls { margin: 12px 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.sort-controls label { color: #333; }
.sort-controls select { min-height: 44px; padding: 4px 8px; font-size: 14px; border: 1px solid #ccc; border-radius: 4px; background: #fff; }
