/* ==========================================================================
   特朗普行程追踪与新闻监控系统 · 样式
   设计取向：深色、信息密度高、一眼看出"哪条刚变过"。
   配色与前端预览版保持一致，保证交付物与已确认的方案视觉一致。
   ========================================================================== */

:root {
  --bg: #0f1419;
  --panel: #161b22;
  --panel2: #1c232c;
  --line: #2a313c;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3b82f6;
  --accent2: #1f6feb;
  --red: #ef4444;
  --yellow: #eab308;
  --green: #22c55e;
  --brown: #a16207;
  --pink: #ec4899;
  --gray: #6b7280;
  --hl-new: #fbbf24;
}

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

body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 14px 60px; }

/* ===== 顶部滚动公告框 ===== */
.ticker-bar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(180deg, #0b0f14, #11161d);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
}
.ticker-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px 4px; max-width: 960px; margin: 0 auto; }
.ticker-head .lbl { font-size: 13px; font-weight: 700; color: #f0c674; }
.ticker-head .badge { font-size: 11px; background: var(--accent2); color: #fff; padding: 1px 7px; border-radius: 10px; }
.ticker-head .pause {
  margin-left: auto; font-size: 12px; background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); border-radius: 6px; padding: 3px 10px; cursor: pointer;
}
.ticker-head .pause:hover { border-color: var(--accent); }
.ticker-box { height: 84px; overflow: hidden; position: relative; max-width: 960px; margin: 0 auto; padding: 0 14px; }
.ticker-track { position: absolute; left: 14px; right: 14px; top: 0; will-change: transform; }
.ticker-box:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  height: 28px; display: flex; align-items: center; gap: 8px; padding: 0 4px; cursor: pointer;
  color: var(--text); white-space: nowrap; overflow: hidden;
}
.ticker-item:hover { background: rgba(59, 130, 246, .08); }
.ticker-item .d { color: #f0c674; font-variant-numeric: tabular-nums; flex: none; }
.ticker-item .t { color: var(--muted); font-size: 12px; flex: none; }
.ticker-item .src { color: #7dd3fc; font-size: 12px; flex: none; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ticker-item .ttl { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.ticker-item.flash { animation: flash 2.4s ease-out; }
.ticker-empty { color: var(--muted); font-size: 13px; padding: 26px 4px; }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none !important; } }

/* ===== 状态栏 ===== */
.statusbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 0; color: var(--muted); font-size: 12px; }
.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.statusbar.offline .dot { background: var(--gray); box-shadow: none; animation: none; }
.statusbar.offline .state-text { color: var(--gray); }
.statusbar b { color: var(--text); }
.statusbar .refresh {
  margin-left: auto; background: var(--accent2); border: none; color: #fff; border-radius: 6px;
  padding: 5px 14px; cursor: pointer; font-size: 12px;
}
.statusbar .refresh:hover { background: var(--accent); }
.statusbar .refresh:disabled { opacity: .5; cursor: wait; }

/* ===== 区块标题 ===== */
.section-title { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; font-size: 16px; font-weight: 700; flex-wrap: wrap; }
.section-title .tag { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; }

/* ===== 行程卡片 ===== */
.day-card { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin-bottom: 16px; overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); font-size: 13px; flex-wrap: wrap; }
.day-head .date { font-weight: 700; font-size: 15px; }
.day-head .ver, .day-head .cnt { color: var(--muted); }
.day-head .cnt b { color: var(--text); }
.day-head .est { color: var(--yellow); background: rgba(234, 179, 24, .12); border: 1px solid rgba(234, 179, 24, .4); border-radius: 6px; padding: 1px 7px; font-size: 11px; }
.day-head .upd { margin-left: auto; color: var(--muted); font-size: 12px; }
.appt { display: grid; grid-template-columns: 6px 1fr; gap: 0; border-top: 1px solid var(--line); }
.appt:nth-child(odd) .appt-body { background: rgba(255, 255, 255, .012); }
.appt .rail { background: var(--red); }
.appt.cat-poolcall .rail { background: var(--yellow); }
.appt.cat-brief .rail { background: var(--green); }
.appt.cat-potus .rail { background: var(--brown); }
.appt.cat-pool .rail { background: var(--pink); }
.appt.cat-axios .rail { background: var(--gray); }
.appt-body { padding: 9px 14px; display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: start; }
.appt .time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.appt .time.tbd { color: var(--yellow); font-weight: 600; }
.appt .main .title { margin-bottom: 3px; }
.appt .main .meta { color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 10px; }
.appt .badge { font-size: 11px; border-radius: 5px; padding: 1px 7px; font-weight: 600; white-space: nowrap; align-self: start; }
.badge.b-tbd { color: var(--yellow); border: 1px dashed var(--yellow); background: transparent; }
.badge.b-confirm { color: var(--green); background: rgba(34, 197, 94, .14); border: 1px solid rgba(34, 197, 94, .4); }
.badge.b-change { color: #fb923c; background: rgba(251, 146, 60, .14); border: 1px solid rgba(251, 146, 60, .4); }
.badge.b-new { color: #fff; background: var(--accent2); }
.badge.b-removed { color: var(--gray); background: rgba(107, 114, 128, .14); border: 1px solid rgba(107, 114, 128, .4); }
.badge.b-cat { color: var(--muted); background: var(--panel2); border: 1px solid var(--line); font-weight: 500; }
.appt.flash { animation: flash 2.4s ease-out; }
.appt.removed .title, .appt.removed .time { text-decoration: line-through; opacity: .55; }
.appt .hist { margin-top: 4px; color: var(--muted); font-size: 11px; cursor: pointer; }
.appt .hist-list { margin-top: 4px; color: var(--muted); font-size: 11px; display: none; }
.appt .hist-list.open { display: block; }

@keyframes flash { 0% { background: rgba(251, 191, 36, .28); } 100% { background: transparent; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ===== 行程展开控件 ===== */
/* 默认只展示最近 7 天，更早的靠这个按钮按需追加，避免一屏铺满 30 天导致页面过长 */
.schedule-foot { text-align: center; padding: 16px 12px 4px; }
.schedule-foot .expand-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 20px; cursor: pointer; font-size: 13px;
  transition: border-color .18s ease, background .18s ease, transform .12s ease;
}
.schedule-foot .expand-btn::before { content: '▾'; color: var(--muted); font-size: 11px; }
.schedule-foot .expand-btn:hover { border-color: var(--accent); background: rgba(59, 130, 246, .1); }
.schedule-foot .expand-btn:active { transform: translateY(1px); }
.schedule-foot .expand-btn:disabled { opacity: .5; cursor: wait; }
.schedule-foot .foot-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ===== 24h 新闻列表 ===== */
.news-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.news-bar .count { color: var(--muted); font-size: 13px; }
.news-bar .count b { color: var(--text); }
.news-bar select, .news-bar .bybtn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 4px 8px; font-size: 12px; cursor: pointer;
}
.news-list { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.news-row { display: grid; grid-template-columns: 64px 84px 78px 1fr; gap: 10px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.news-row:first-child { border-top: none; }
.news-row:hover { background: rgba(59, 130, 246, .06); }
.news-row .pub { font-weight: 700; font-variant-numeric: tabular-nums; }
.news-row .rel { color: var(--muted); font-size: 12px; }
.news-row .src { font-size: 12px; text-align: center; border-radius: 6px; padding: 2px 0; border: 1px solid var(--line); opacity: 0; visibility: hidden; transition: opacity .18s ease; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-row:hover .src { opacity: 1; visibility: visible; }
.news-row .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-row .multi { color: var(--yellow); font-size: 11px; margin-left: 6px; }
.news-row .est { color: var(--muted); font-size: 11px; margin-left: 6px; }
.news-row.new { animation: flash 2.4s ease-out; }
.news-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 12px; }
.news-foot button { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 14px; cursor: pointer; font-size: 12px; }
.news-foot button:hover { border-color: var(--accent); }
.skeleton { height: 42px; border-top: 1px solid var(--line); background: linear-gradient(90deg, #161b22 25%, #1c232c 50%, #161b22 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ===== 其他 ===== */
.toast {
  position: fixed; top: 120px; left: 50%; transform: translateX(-50%); background: var(--hl-new); color: #111;
  font-weight: 700; padding: 8px 18px; border-radius: 20px; box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
  z-index: 80; opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.empty { color: var(--muted); font-size: 13px; padding: 22px 14px; }
.error-bar { display: none; background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .4); color: #fca5a5; border-radius: 8px; padding: 8px 12px; font-size: 12px; margin: 10px 0; }
.error-bar.show { display: block; }
.footer { color: var(--muted); font-size: 11px; margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); line-height: 1.8; }

@media (max-width: 640px) {
  .appt-body { grid-template-columns: 80px 1fr; }
  .appt .badge { grid-column: 2; justify-self: start; }
  .news-row { grid-template-columns: 56px 1fr; }
  .news-row .rel, .news-row .src { display: none; }
}
