/* ==========================================================================
   OmniPulse News - Apple / iOS 18 Design System & Mobile-First Stylesheet
   Focus: Usability First, Real Utility, Refined Apple Aesthetics
   ========================================================================== */

:root {
  /* iOS Light Palette (Default) */
  --ios-system-bg: #F2F2F7;
  --ios-card-bg: #FFFFFF;
  --ios-subcard-bg: #F8F9FA;
  --ios-elevated-bg: #FFFFFF;
  --ios-label-primary: #1C1C1E;
  --ios-label-secondary: #8E8E93;
  --ios-label-tertiary: #C7C7CC;
  --ios-border: rgba(0, 0, 0, 0.08);
  --ios-border-subtle: rgba(0, 0, 0, 0.04);
  --ios-separator: #E5E5EA;

  /* Apple System Colors */
  --ios-blue: #007AFF;
  --ios-blue-light: #EBF5FF;
  --ios-green: #34C759;
  --ios-green-light: #EDFAF0;
  --ios-orange: #FF9500;
  --ios-orange-light: #FFF6E8;
  --ios-red: #FF3B30;
  --ios-red-light: #FEECEB;

  /* Shadows */
  --ios-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --ios-shadow-md: 0 4px 18px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --ios-shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.03);

  /* Radius */
  --radius-pill: 9999px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
}

/* iOS Dark Mode */
html.dark {
  --ios-system-bg: #000000;
  --ios-card-bg: #1C1C1E;
  --ios-subcard-bg: #2C2C2E;
  --ios-elevated-bg: #2C2C2E;
  --ios-label-primary: #FFFFFF;
  --ios-label-secondary: #8E8E93;
  --ios-label-tertiary: #48484A;
  --ios-border: rgba(255, 255, 255, 0.10);
  --ios-border-subtle: rgba(255, 255, 255, 0.05);
  --ios-separator: #38383A;

  --ios-blue-light: rgba(0, 122, 255, 0.16);
  --ios-green-light: rgba(52, 199, 89, 0.16);
  --ios-orange-light: rgba(255, 149, 0, 0.16);
  --ios-red-light: rgba(255, 59, 48, 0.16);

  --ios-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --ios-shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --ios-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.7);
}

/* 大号字阅读模式 (A+ 切换支持) */
body.large-text {
  font-size: 112%;
}

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

body {
  background-color: var(--ios-system-bg);
  color: var(--ios-label-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: text;
}

/* 字体排版 */
.font-mono {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Monaco, monospace;
}
.font-title {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

/* 常用色彩与背景 */
.bg-ios-bg { background-color: var(--ios-system-bg); }
.bg-ios-card { background-color: var(--ios-card-bg); }
.bg-ios-subcard { background-color: var(--ios-subcard-bg); }
.text-ios-primary { color: var(--ios-label-primary); }
.text-ios-secondary { color: var(--ios-label-secondary); }
.text-ios-blue { color: var(--ios-blue); }
.border-ios { border-color: var(--ios-border); }

/* 容器与宽度 */
.max-w-7xl {
  max-width: 1280px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }

/* 弹性盒与栅格基础类 */
.flex { display: flex; }
.inline-flex { display: inline-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; }
.justify-around { justify-content: space-around; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:w-56 { width: 14rem; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .lg\:col-span-8 { grid-column: span 8 / span 8; }
  .lg\:col-span-4 { grid-column: span 4 / span 4; }
  .lg\:flex { display: flex; }
}

.hidden { display: none !important; }
@media (min-width: 640px) {
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
  .sm\:inline { display: inline; }
}

/* 间距 Gap */
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

/* 尺寸与高度 */
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-9 { width: 2.25rem; }
.h-9 { height: 2.25rem; }
.w-5 { width: 1.25rem; }
.h-5 { height: 1.25rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-3\.5 { width: 0.875rem; }
.h-3\.5 { height: 0.875rem; }

/* 边框与圆角 */
.border { border: 1px solid var(--ios-border); }
.border-b { border-bottom: 1px solid var(--ios-border); }
.border-t { border-top: 1px solid var(--ios-border); }
.border-l { border-left: 1px solid var(--ios-border); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-pill); }

/* 内外边距 */
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }

/* 字体排版与缩放 */
.text-xs { font-size: 0.75rem; line-height: 1.05rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* 多视图系统 (Tab View Sections) */
.tab-view-section {
  display: none;
  animation: fadeIn 0.18s ease-out;
}
.tab-view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 顶部金融滚动条 */
.market-bar {
  background-color: var(--ios-card-bg);
}
.ticker-scroll {
  display: flex;
  white-space: nowrap;
  gap: 1.25rem;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-feature-settings: "tnum";
}
.ticker-up { color: var(--ios-green); font-weight: 600; }
.ticker-down { color: var(--ios-red); font-weight: 600; }

/* iOS 毛玻璃导航栏 */
.ios-nav-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-bottom: 1px solid var(--ios-border);
  transition: background-color 0.2s ease;
}
html.dark .ios-nav-header {
  background: rgba(28, 28, 30, 0.88);
}

/* 桌面端导航链接 */
.desktop-nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ios-label-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}
.desktop-nav-link:hover {
  color: var(--ios-label-primary);
  background-color: rgba(118, 118, 128, 0.08);
}
.desktop-nav-link.active {
  color: #FFFFFF;
  background-color: var(--ios-blue);
  font-weight: 600;
}

/* iOS 分段控制器 (Segmented Control) */
.ios-segmented-wrap {
  background-color: rgba(118, 118, 128, 0.12);
  padding: 3px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
html.dark .ios-segmented-wrap {
  background-color: rgba(118, 118, 128, 0.24);
}

.ios-segment-btn {
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ios-label-secondary);
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 32px;
}
.ios-segment-btn:hover {
  color: var(--ios-label-primary);
}
.ios-segment-btn.active {
  background-color: var(--ios-card-bg);
  color: var(--ios-label-primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* 盲区雷达胶囊 (Blindspot Chips - Ground News 风格) */
.blindspot-chip {
  padding: 3.5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ios-label-secondary);
  border: 1px solid var(--ios-border);
  background-color: var(--ios-card-bg);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.blindspot-chip:hover {
  color: var(--ios-label-primary);
  border-color: var(--ios-blue);
}
.blindspot-chip.active {
  color: #FFFFFF;
  background-color: var(--ios-label-primary);
  border-color: var(--ios-label-primary);
  font-weight: 600;
}
html.dark .blindspot-chip.active {
  background-color: #FFFFFF;
  color: #000000;
  border-color: #FFFFFF;
}

/* 键盘导航聚焦高亮 (Keyboard Navigation Active Card) */
.keyboard-focused-card {
  outline: 2px solid var(--ios-blue) !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15) !important;
}

/* 事件演进时间轴 (Story Timeline) */
.timeline-step {
  position: relative;
  padding-left: 1.5rem;
  padding-bottom: 0.85rem;
}
.timeline-step:last-child {
  padding-bottom: 0;
}
.timeline-step::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 18px;
  bottom: 0;
  width: 1.5px;
  background-color: var(--ios-border);
}
.timeline-step:last-child::before {
  display: none;
}
.timeline-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--ios-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* 关联市场标的胶囊 (Market Pill) */
.market-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 7px;
  border-radius: var(--radius-pill);
  background-color: rgba(118, 118, 128, 0.08);
  color: var(--ios-label-secondary);
  font-size: 0.6875rem;
  font-weight: 500;
  border: 1px solid var(--ios-border-subtle);
}

/* iOS 按钮样式 (Apple Pill Buttons) */
.ios-btn-primary {
  background-color: var(--ios-blue);
  color: #FFFFFF;
  border-radius: var(--radius-pill);
  font-weight: 600;
  padding: 7px 16px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.12s ease, background-color 0.12s ease;
  min-height: 34px;
}
.ios-btn-primary:active {
  transform: scale(0.96);
  background-color: #0062cc;
}

.ios-btn-secondary {
  background-color: var(--ios-subcard-bg);
  color: var(--ios-label-primary);
  border-radius: var(--radius-pill);
  font-weight: 500;
  padding: 6px 14px;
  border: 1px solid var(--ios-border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.12s ease;
  min-height: 34px;
}
.ios-btn-secondary:active {
  transform: scale(0.96);
  background-color: var(--ios-border);
}

/* Apple News 风格头条聚光灯卡片 */
.apple-hero-card {
  background-color: var(--ios-card-bg);
  border: 1px solid var(--ios-border);
  border-radius: var(--radius-2xl);
  padding: 1.25rem sm:padding: 1.75rem;
  box-shadow: var(--ios-shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Apple 风格要闻导读卡盒 */
.apple-brief-box {
  background-color: var(--ios-subcard-bg);
  border: 1px solid var(--ios-border);
  border-radius: var(--radius-xl);
  padding: 1.15rem;
}

/* 媒体视角光谱条 */
.apple-perspective-bar {
  background-color: rgba(118, 118, 128, 0.15);
  border-radius: var(--radius-pill);
  height: 6px;
  overflow: hidden;
  display: flex;
  width: 100%;
}
.bar-cn { background-color: var(--ios-green); }
.bar-western { background-color: var(--ios-blue); }
.bar-south { background-color: var(--ios-orange); }

/* 普通大事件卡片 */
.apple-news-card {
  background-color: var(--ios-card-bg);
  border: 1px solid var(--ios-border);
  border-radius: var(--radius-xl);
  padding: 1.15rem;
  box-shadow: var(--ios-shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
  position: relative;
}
.apple-news-card:active {
  transform: scale(0.985);
}
@media (hover: hover) {
  .apple-news-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ios-shadow-md);
  }
}

/* 快讯条目样式 */
.apple-wire-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--ios-border-subtle);
  transition: background-color 0.12s ease;
}
.apple-wire-item:last-child {
  border-bottom: none;
}
.apple-wire-item:hover {
  background-color: rgba(118, 118, 128, 0.05);
  border-radius: 8px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* 状态角标 Pill */
.ios-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
}
.ios-badge-blue {
  background-color: var(--ios-blue-light);
  color: var(--ios-blue);
}
.ios-badge-red {
  background-color: var(--ios-red-light);
  color: var(--ios-red);
}
.ios-badge-gray {
  background-color: var(--ios-subcard-bg);
  color: var(--ios-label-secondary);
  border: 1px solid var(--ios-border);
}

/* 突发高能警报条 */
.apple-alert-banner {
  background-color: var(--ios-card-bg);
  border-bottom: 1px solid var(--ios-border);
  padding: 0.45rem 1rem;
}

/* ==========================================================================
   移动端专属底部 iOS 标签栏 (Apple Mobile TabBar)
   ========================================================================== */
.ios-mobile-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border-top: 1px solid var(--ios-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.dark .ios-mobile-tabbar {
  background: rgba(28, 28, 30, 0.92);
}

.mobile-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 52px;
  background: transparent;
  border: none;
  color: var(--ios-label-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s ease;
  min-height: 48px;
}
.mobile-tab-btn.active {
  color: var(--ios-blue);
  font-weight: 600;
}

/* ==========================================================================
   常驻音频微型播放条 (Apple Floating Mini Player)
   ========================================================================== */
.ios-audio-dock {
  position: fixed;
  bottom: 64px; /* 在移动端位于 TabBar 之上 */
  left: 12px;
  right: 12px;
  z-index: 45;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid var(--ios-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--ios-shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 768px) {
  .ios-audio-dock {
    bottom: 24px;
    left: auto;
    right: 24px;
    width: 380px;
  }
}
html.dark .ios-audio-dock {
  background: rgba(44, 44, 46, 0.94);
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.audio-wave-anim {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #FFFFFF;
  animation: wavePulse 1.4s infinite ease-in-out;
}
@keyframes wavePulse {
  0%, 100% { transform: scale(0.65); opacity: 0.5; }
  50% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   iOS Toast 悬浮胶囊通知
   ========================================================================== */
.ios-toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  opacity: 0;
  pointer-events: none;
}
.ios-toast-container.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.ios-toast-box {
  background: rgba(28, 28, 30, 0.92);
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--ios-shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 6px;
}
html.dark .ios-toast-box {
  background: rgba(255, 255, 255, 0.92);
  color: #000000;
}

/* ==========================================================================
   iOS Bottom Sheet 弹窗
   ========================================================================== */
dialog.ios-modal-sheet {
  margin: auto;
  border: 1px solid var(--ios-border);
  border-radius: var(--radius-2xl);
  background-color: var(--ios-card-bg);
  color: var(--ios-label-primary);
  box-shadow: var(--ios-shadow-lg);
  max-width: 820px;
  width: 94vw;
  overflow: hidden;
}
@media (max-width: 767px) {
  /* 移动端下作为纯正的 iOS 底部卡片 (Bottom Sheet) */
  dialog.ios-modal-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin-bottom: 0;
    width: 100vw;
    max-width: 100vw;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border-bottom: none;
    max-height: 88vh;
    animation: sheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

dialog.ios-modal-sheet::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ios-modal-grabber {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background-color: var(--ios-label-tertiary);
  margin: 10px auto 4px auto;
}

/* 滚动条隐藏与优化 */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
