/**
 * Baosheng Design System · components.css · v1.0
 * ============================================================================
 * 15 类核心组件 · 引用 tokens.css · 可 drop-in 任何项目
 * 用法：<link rel="stylesheet" href="tokens.css"> <link rel="stylesheet" href="components.css">
 * ============================================================================
 */

/* ===================================================================
 * 页面容器
 * =================================================================== */
.page {
  min-height: 100%;
  background: var(--color-bg-base);
  padding-top:    var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 24px);
}
.section { margin: 12px; }
.section + .section { margin-top: 0; }

/* ===================================================================
 * 1. Button
 * =================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: background 200ms var(--motion-ease-standard), color 200ms var(--motion-ease-standard);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.btn.block { width: 100%; }

.btn-sm    { height: var(--btn-h-sm);    font-size: var(--font-size-caption); }
.btn-md    { height: var(--btn-h-md);    font-size: var(--font-size-body-sm); }
.btn-lg    { height: var(--btn-h-lg);    font-size: var(--font-size-body-sm); padding: 0 24px; }
.btn-order { height: var(--btn-h-order); font-size: var(--font-size-body);    padding: 0 32px; }

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-primary-hover); }
.btn-primary:active:not(:disabled) { background: var(--brand-primary-active); }

.btn-secondary {
  background: var(--brand-accent-gold);
  color: #ffffff;
}
.btn-secondary:hover:not(:disabled) { background: var(--gold-600); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--color-border-primary);
  color: var(--color-text-primary);
}
.btn-ghost:hover:not(:disabled) { background: var(--color-bg-muted); }

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}
.btn-danger:hover:not(:disabled) { background: var(--vermilion-600); }

.btn-link {
  background: transparent;
  color: var(--brand-primary);
  padding: 0;
  height: auto;
}
.btn-link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 2px; }

/* ===================================================================
 * 2. Chip Tab（横滚 · 圆角胶囊）
 * =================================================================== */
.chip-scroller {
  display: flex; gap: 6px;
  padding: 12px 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-scroller::-webkit-scrollbar { display: none; }

.chip-tab {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  background: var(--color-bg-surface);
  border: 1px solid var(--gold-alpha-24);
  border-radius: var(--radius-pill);
  color: var(--color-text-secondary);
  font-family: inherit;
  font-size: var(--font-size-caption);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 160ms ease-out, color 160ms ease-out;
}
.chip-tab:hover { background: var(--gold-alpha-8); }
.chip-tab.active {
  background: var(--jade-500);
  color: var(--ivory-50);
  border-color: var(--gold-alpha-40);
  box-shadow: 0 0 0 1px var(--gold-alpha-40) inset;
}
.chip-count {
  font-size: var(--font-size-micro);
  padding: 1px 6px;
  background: var(--color-bg-muted);
  color: var(--color-text-tertiary);
  border-radius: var(--radius-pill);
}
.chip-tab.active .chip-count {
  background: rgba(245, 237, 224, 0.2);
  color: var(--ivory-50);
}

/* ===================================================================
 * 3. Segment Tab（4-均分方框）
 * =================================================================== */
.seg {
  margin: 12px; padding: 4px;
  background: var(--color-bg-surface);
  border: 1px solid var(--gold-alpha-24);
  border-radius: var(--radius-lg);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
}
.seg-btn {
  position: relative;
  padding: 8px 6px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--color-text-secondary);
  font-family: inherit;
  transition: all 200ms var(--motion-ease-standard);
}
.seg-btn:hover:not(.active) { background: var(--gold-alpha-16); }
.seg-btn.active {
  background: var(--jade-500);
  color: var(--ivory-50);
  box-shadow: 0 0 0 1px var(--gold-alpha-40) inset;
}
.seg-label { font-size: var(--font-size-body-sm); font-weight: 600; letter-spacing: 0.06em; }
.seg-short {
  font-family: var(--font-serif-en);
  font-style: italic;
  font-size: var(--font-size-micro);
  opacity: 0.7;
}
.seg-dot {
  position: absolute; top: 4px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--vermilion-500); color: #ffffff;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-micro); line-height: 16px; text-align: center;
}

/* ===================================================================
 * 4. Hero Section（品牌大区）
 * =================================================================== */
.hero {
  position: relative;
  margin: 12px;
  border-radius: 14px;
  overflow: hidden;
  color: var(--ivory-50);
  cursor: pointer;
  transition: transform 160ms ease-out;
  background:
    radial-gradient(circle at 88% 12%, rgba(255, 255, 255, 0.10) 0%, transparent 42%),
    linear-gradient(180deg, var(--brand-hero-start) 0%, var(--brand-hero-end) 100%);
  box-shadow:
    0 0 0 1px var(--gold-alpha-32) inset,
    0 8px 24px rgba(61, 14, 23, 0.24);
}
.hero:hover:not(.hero-guide) { transform: translateY(-1px); }
.hero.hero-guide { cursor: default; }
.hero-inner { position: relative; padding: 18px 22px 20px; }

.hero-eyebrow {
  font-family: var(--font-serif-en);
  font-style: italic;
  font-size: 11px;
  color: var(--gold-300);
  letter-spacing: 0.14em;
}
.hero-title {
  margin: 6px 0 0;
  font-family: var(--font-family-brand);
  font-size: 20px; font-weight: 600;
  letter-spacing: 0.10em;
  color: var(--ivory-50);
}
.hero-desc {
  margin: 8px 0 0;
  font-size: var(--font-size-caption);
  opacity: 0.78;
  line-height: 1.5;
  letter-spacing: 0.03em;
}
.hero-cta-row { margin-top: 14px; }
.hero-cta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: rgba(245, 237, 224, 0.14);
  border: 1px solid var(--gold-alpha-40);
  border-radius: var(--radius-pill);
  color: var(--gold-300);
  font-family: inherit;
  font-size: var(--font-size-caption);
  cursor: pointer;
}
.hero-cta:hover { background: rgba(245, 237, 224, 0.22); }

.hero-compass {
  position: absolute; right: -32px; bottom: -32px;
  width: 168px; height: 168px;
  color: var(--gold-500);
  opacity: 0.14;
  pointer-events: none;
}

/* Hero 内的 stats */
.hero-stats {
  margin-top: 14px;
  display: flex; align-items: stretch; justify-content: space-between; gap: 12px;
}
.stat { flex: 1; text-align: center; }
.stat-v {
  font-family: var(--font-family-brand);
  font-size: 18px; font-weight: 700;
  color: var(--ivory-50);
  line-height: 1;
  letter-spacing: 0.02em;
}
.stat-v.up   { color: rgb(239, 145, 122); }
.stat-v.down { color: rgb(129, 199, 132); }
.stat-k {
  margin-top: 6px;
  font-size: 11px;
  color: var(--gold-300);
  opacity: 0.78;
  letter-spacing: 0.06em;
}
.stat-sep { width: 1px; background: var(--gold-alpha-24); }

/* ===================================================================
 * 5. 折叠卡（Collapsible Card）
 * =================================================================== */
.collapse-card {
  margin: 12px 16px 0;
  background: var(--color-bg-surface);
  border: 1px solid var(--gold-alpha-16);
  border-left: 3px solid var(--gold-500);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 200ms ease-out;
}
.collapse-card.is-expanded { box-shadow: 0 2px 8px rgba(14, 94, 77, 0.06); }

.collapse-header {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 12px 14px;
  background: transparent; border: 0;
  cursor: pointer;
  text-align: left;
  color: var(--color-text-primary);
  font-family: inherit;
  transition: background 200ms;
}
.collapse-header:hover { background: color-mix(in srgb, var(--jade-500) 3%, transparent); }

.collapse-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: var(--radius-circle);
  background: color-mix(in srgb, var(--gold-500) 12%, transparent);
  color: var(--gold-500);
}
.collapse-title { flex: 1; font-size: var(--font-size-body-sm); font-weight: 600; }
.collapse-hint  { font-size: 11px; color: var(--color-text-tertiary); }
.collapse-chevron { color: var(--color-text-tertiary); transition: transform 200ms; }

.collapse-body {
  padding: 4px 14px 14px;
  border-top: 1px dashed var(--gold-alpha-16);
}

/* ===================================================================
 * 6. Alert · 4 类
 * =================================================================== */
.alert {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-caption);
  line-height: 1.6;
}
.alert-icon { flex-shrink: 0; margin-top: 2px; }

.alert-info {
  background: color-mix(in srgb, var(--jade-500) 8%, transparent);
  border-left-color: var(--jade-500);
  color: var(--jade-700);
}
.alert-warning {
  background: color-mix(in srgb, var(--gold-500) 10%, transparent);
  border-left-color: var(--gold-500);
  color: var(--color-text-secondary);
}
.alert-danger {
  background: color-mix(in srgb, var(--vermilion-500) 8%, transparent);
  border-left-color: var(--vermilion-500);
  color: #14213B;
}
.alert-success {
  background: color-mix(in srgb, var(--jade-500) 12%, transparent);
  border-left-color: var(--jade-500);
  color: var(--jade-700);
}

/* ===================================================================
 * 7. Badge / Tag
 * =================================================================== */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
}
.badge-primary { background: var(--brand-primary-soft);  color: var(--brand-primary); }
.badge-danger  { background: var(--color-quote-up-bg);   color: var(--vermilion-600); }
.badge-success { background: color-mix(in srgb, var(--jade-500) 14%, transparent); color: var(--jade-600); }
.badge-warning { background: color-mix(in srgb, var(--gold-500) 14%, transparent); color: var(--gold-700); }
.badge-neutral { background: var(--color-bg-muted); color: var(--color-text-secondary); }

/* ===================================================================
 * 8. Input
 * =================================================================== */
.vp-input {
  display: flex; align-items: center;
  height: var(--input-h-lg);
  padding: 0 12px;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-primary);
  border-radius: var(--radius-md);
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
.vp-input:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-soft);
}
.vp-input.has-error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(214, 73, 63, 0.14);
}
.vp-input input {
  flex: 1;
  background: transparent;
  border: 0; outline: 0;
  font-family: inherit;
  font-size: var(--font-size-body-sm);
  color: var(--color-text-primary);
}
.vp-input input::placeholder { color: var(--color-text-tertiary); }
.vp-input-prefix, .vp-input-suffix {
  font-size: var(--font-size-body-sm);
  color: var(--color-text-tertiary);
}

/* ===================================================================
 * 9. Stat Grid（数据 4 格）
 * =================================================================== */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 12px 0;
}
.stat-cell {
  text-align: center;
  padding: 10px 4px;
  background: color-mix(in srgb, var(--jade-500) 4%, transparent);
  border-radius: var(--radius-md);
}
.stat-cell-lbl {
  font-size: var(--font-size-micro);
  color: var(--color-text-tertiary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.stat-cell-val {
  font-size: var(--font-size-body-sm);
  font-weight: 600;
  color: var(--jade-500);
}
.stat-cell-val.mono {
  font-family: var(--font-numeric);
  font-variant-numeric: tabular-nums;
}

/* ===================================================================
 * 10. Toast（4 级别）
 * =================================================================== */
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--xt-shadow-float), var(--xt-hairline-strong);
  font-size: var(--font-size-body-sm);
}
.toast-level {
  display: inline-block;
  padding: 1px 6px;
  background: var(--color-bg-muted);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-micro);
  font-family: var(--font-numeric);
}
.toast-info    { border-left: 3px solid var(--jade-500); }
.toast-success { border-left: 3px solid var(--jade-500); }
.toast-warning { border-left: 3px solid var(--gold-500); }
.toast-danger  { border-left: 3px solid var(--vermilion-500); }

/* ===================================================================
 * 11. Modal / BottomSheet
 * =================================================================== */
.modal-mask {
  position: fixed; inset: 0;
  background: var(--mask-modal);
  z-index: calc(var(--z-app-modal) - 1);
  animation: fadeIn 200ms var(--motion-ease-enter);
}
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(90%, 480px);
  max-height: 85vh; overflow: auto;
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elev-3);
  z-index: var(--z-app-modal);
  animation: scaleIn 240ms var(--motion-ease-enter);
}

.sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-height: 85vh;
  background: var(--color-bg-surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  z-index: var(--z-app-sheet);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.16);
  animation: slideUp 240ms var(--motion-ease-standard);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ===================================================================
 * 12. Empty State（空态）
 * =================================================================== */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px;
  color: var(--color-text-tertiary);
  text-align: center;
}
.empty-state .empty-icon { color: var(--gold-500); opacity: 0.5; margin-bottom: 12px; }
.empty-title {
  margin: 0 0 4px;
  font-size: var(--font-size-body);
  color: var(--color-text-secondary);
}
.empty-desc {
  margin: 0 0 20px;
  font-size: var(--font-size-caption);
}

/* ===================================================================
 * 13. Skeleton（骨架屏）
 * =================================================================== */
.skeleton-list { padding: 12px; }
.skeleton-row {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--color-border-secondary);
}
.skeleton-avatar {
  width: 40px; height: 40px;
  border-radius: var(--radius-circle);
  flex-shrink: 0;
}
.skeleton-lines { flex: 1; }
.skeleton-line { height: 12px; border-radius: var(--radius-sm); margin-bottom: 8px; }
.skeleton-line:last-child { margin-bottom: 0; }

.shimmer {
  background: linear-gradient(90deg,
    var(--color-bg-muted) 0%,
    color-mix(in srgb, var(--color-bg-muted) 60%, var(--gold-alpha-16)) 50%,
    var(--color-bg-muted) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===================================================================
 * 14. TabBar（底部导航 · H5）
 * =================================================================== */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-bg-surface);
  border-top: 1px solid var(--color-border-secondary);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: var(--z-app-tabbar);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-micro);
  text-decoration: none;
  transition: color 200ms;
}
.tab.active { color: var(--brand-primary); }

/* ===================================================================
 * 15. List Card（通用列表卡）
 * =================================================================== */
.lc {
  margin: 8px 12px;
  padding: 14px;
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-secondary);
  border-left: 3px solid var(--gold-500);
  cursor: pointer;
  transition: box-shadow 200ms;
}
.lc:hover { box-shadow: var(--xt-shadow-card), var(--xt-hairline); }
.lc-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.lc-title { display: flex; align-items: center; gap: 8px; }
.lc-name { font-weight: 600; font-size: var(--font-size-body); }
.lc-price {
  font-family: var(--font-numeric);
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-h3);
  font-weight: 600;
}
.lc-body {
  display: flex; justify-content: space-between;
  font-size: var(--font-size-caption);
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.lc-foot {
  display: flex; justify-content: space-between;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border-secondary);
  font-size: var(--font-size-micro);
  color: var(--color-text-tertiary);
}
.lc-code {
  font-family: var(--font-numeric);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===================================================================
 * 16. Responsive · 3 断点覆盖 55 页面
 *  - Tablet   (≥768)  · 内容居中 720，字号略放大
 *  - Desktop  (≥1024) · 中间 max 900，Hero/卡片 padding 加大
 *  - Wide     (≥1440) · 中间 max 1200，字号进一步放大
 * =================================================================== */

/* ---- Tablet ≥ 768px ---- */
@media (min-width: 768px) and (min-width: 99999px) {
  .page, .xt-home, .xt-product, .xt-detail, .xt-mine, .xt-ipo-list, .xt-ipo-detail,
  .xt-ipo-apply, .xt-ipo-holdings, .xt-ipo-lottery, .xt-ipo-sell,
  .xt-confirm, .xt-sign, .xt-rc, .xt-wd, .xt-wl, .xt-mm {
    max-width: 720px;
    margin-left: auto; margin-right: auto;
  }
  .hero, .xt-hero {
    border-radius: 16px;
    margin: 16px auto;
    max-width: 720px;
  }
  .hero-inner, .xt-hero-inner { padding: 28px 32px 32px; }
  .hero-title, .xt-hero-title { font-size: 26px; }
  .stat-grid, .xt-stat-grid { gap: 12px; }
}

/* ---- Desktop ≥ 1024px ---- */
@media (min-width: 1024px) and (min-width: 99999px) {
  /* 顶部 nav 隐藏（PC 用 xt-app-shell 顶部横栏） */
  html[data-bp="desktop"] .xt-nav-bar,
  html[data-bp="wide"] .xt-nav-bar { display: none; }

  /* 底部 tabBar 隐藏（PC 用左侧菜单） */
  html[data-bp="desktop"] uni-tabbar,
  html[data-bp="wide"] uni-tabbar { display: none !important; }

  /* uniapp 内容区域：不要占满 vh */
  html[data-bp="desktop"] uni-page-body,
  html[data-bp="wide"] uni-page-body { min-height: auto !important; }

  /* 常规 page 内容居中 */
  .page, .xt-home, .xt-product, .xt-detail, .xt-mine, .xt-ipo-list, .xt-ipo-detail,
  .xt-ipo-apply, .xt-ipo-holdings, .xt-ipo-lottery, .xt-ipo-sell,
  .xt-confirm, .xt-sign, .xt-rc, .xt-wd, .xt-wl, .xt-mm, .xt-side-panel {
    max-width: 900px;
    margin-left: auto; margin-right: auto;
  }
  .hero, .xt-hero {
    border-radius: 20px;
    margin: 24px auto;
    max-width: 900px;
  }
  .hero-inner, .xt-hero-inner { padding: 40px 48px 44px; }
  .hero-title, .xt-hero-title { font-size: 32px; }
  .chip-scroller { padding: 20px 0 0; }
  .stat-grid, .xt-stat-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .lc { margin: 12px 0; }

  /* xt-app-shell 内的 tabBar 强制隐藏 */
  html[data-bp="desktop"] .xt-tabbar-space,
  html[data-bp="wide"] .xt-tabbar-space { display: none; }

  /* Hero 罗盘装饰 desktop 放大 */
  .xt-home-hero, .xt-product-hero, .xt-detail-hero, .xt-ipo-hero,
  .xt-confirm-hero, .xt-rc-hero, .xt-wd-hero, .xt-wl-hero, .xt-mm-hero,
  .xt-holdings-hero, .xt-lot-hero, .xt-sell-hero, .xt-apply-hero {
    padding: 48px 56px 40px;
    border-radius: 20px;
    margin: 20px auto;
    max-width: 900px;
  }
}

/* ---- Wide ≥ 1440px ---- */
@media (min-width: 1440px) and (min-width: 99999px) {
  .page, .xt-home, .xt-product, .xt-detail, .xt-mine, .xt-ipo-list, .xt-ipo-detail,
  .xt-ipo-apply, .xt-ipo-holdings, .xt-ipo-lottery, .xt-ipo-sell,
  .xt-confirm, .xt-sign, .xt-rc, .xt-wd, .xt-wl, .xt-mm {
    max-width: 1200px;
  }
  .hero, .xt-hero, .xt-home-hero, .xt-product-hero, .xt-detail-hero, .xt-ipo-hero,
  .xt-confirm-hero, .xt-rc-hero, .xt-wd-hero, .xt-wl-hero, .xt-mm-hero,
  .xt-holdings-hero, .xt-lot-hero, .xt-sell-hero, .xt-apply-hero {
    max-width: 1200px;
  }
  .hero-title, .xt-hero-title { font-size: 40px; }
}

/* ===================================================================
 * End of components.css · v1.0
 * =================================================================== */
