/* ========== 全局变量 ========== */
:root {
  --bg-dark: #0a0c0f;
  --bg-card: rgba(20, 25, 30, 0.7);
  --bg-card-solid: #1a1e24;
  --primary: #00f5ff;
  --primary-glow: 0 0 15px rgba(0, 245, 255, 0.5);
  --text-title: #ffffff;
  --text-body: #cccccc;
  --text-muted: #888888;
  --border-light: rgba(255, 255, 255, 0.08);
  --border-glow: 1px solid rgba(0, 245, 255, 0.2);
  --radius-card: 16px;
  --radius-btn: 12px;
  --shadow-card: 0 8px 20px rgba(0, 0, 0, 0.6);
  --font-main: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body,
.app {
  background: linear-gradient(135deg, #0a0c0f, #0f1215);
  color: var(--text-body);
  font: var(--font-main);
  min-height: 100vh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

/* ========== 布局容器 ========== */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: transparent;
}

.view {
  padding: 16px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ========== 顶部栏 ========== */
.topbar {
  background: rgba(10, 12, 15, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 245, 255, 0.15);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-title);
  font-size: 18px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .title {
  color: var(--text-title);
}

.topbar .back-btn,
.topbar .right-btn {
  color: var(--primary);
  font-size: 24px;
  cursor: pointer;
}

/* ========== 底部导航栏 ========== */
.tabbar,
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 12, 15, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 245, 255, 0.2);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1000;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.tabbar .tab,
.tabbar .tab-item,
.bottom-nav .nav-item {
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
  text-decoration: none;
  transition: color 0.2s;
  flex: 1;
  cursor: pointer;
}

.tabbar .tab.active,
.tabbar .tab-item.active,
.bottom-nav .nav-item.active {
  color: var(--primary);
}

.tabbar .tab-item i,
.tabbar .tab-item .icon,
.bottom-nav .nav-item i {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.bottom-nav .nav-item span {
  display: block;
}

/* ========== 卡片 ========== */
.glass-card,
.card,
.order-card,
.profile-card,
.zone-card,
.product-card,
.dialog-content,
.item,
.list-item {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--border-glow);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card), inset 0 0 20px rgba(0, 245, 255, 0.05);
  padding: 16px;
  transition: transform 0.2s, border-color 0.2s;
}

.glass-card:hover,
.order-card:active,
.product-card:active {
  border-color: var(--primary);
  box-shadow: var(--primary-glow);
}

.title {
  color: var(--text-title);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* 订单卡片特有样式 */
.order-card {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.order-card .product-image,
.order-image {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  background: #2a2e34;
}

.order-card .info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.order-card .title,
.order-title {
  font-weight: 600;
  color: var(--text-title);
}

.order-card .price,
.order-value,
.product-price,
.zone-rate,
.text-primary {
  color: var(--primary);
  font-weight: 600;
}

.order-card .status,
.order-label,
.text-muted,
.muted,
.section-note {
  font-size: 12px;
  color: var(--text-muted);
}

/* 产品卡片（网格） */
.product-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card .product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  object-fit: cover;
  background: #2a2e34;
}

.product-card .product-name,
.zone-name,
.shop-title,
.account-name {
  font-weight: 600;
  color: var(--text-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 专区卡片（横向） */
.zone-card {
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ========== 按钮 ========== */
.btn-main,
.btn-primary,
.btn,
.btn-dark {
  background: linear-gradient(135deg, var(--primary), #7b2cff);
  border: none;
  border-radius: var(--radius-btn);
  color: white;
  font-weight: 600;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: inline-block;
  width: 100%;
}

.btn-main.is-loading,
.btn-primary.is-loading,
.btn.is-loading,
.btn-dark.is-loading,
.btn-secondary.is-loading {
  position: relative;
  opacity: 0.82;
  pointer-events: none;
}

.btn-main.is-loading::after,
.btn-primary.is-loading::after,
.btn.is-loading::after,
.btn-dark.is-loading::after,
.btn-secondary.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

.btn-main:active,
.btn-primary:active,
.btn:active,
.btn-dark:active {
  transform: scale(0.98);
  box-shadow: var(--primary-glow);
}

.btn-secondary,
.btn-light,
.sub-back-btn {
  background: transparent;
  border: var(--border-glow);
  border-radius: var(--radius-btn);
  color: var(--primary);
  padding: 12px 24px;
  cursor: pointer;
  text-align: center;
  display: inline-block;
  width: 100%;
}

.btn-small {
  padding: 8px 16px;
  font-size: 12px;
}

/* ========== 输入框 ========== */
.field,
.input-field {
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glow);
  border-radius: 12px;
  color: white;
  padding: 12px 16px;
  width: 100%;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select.field,
select.input-field {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-title) 50%),
    linear-gradient(135deg, var(--text-title) 50%, transparent 50%);
  background-position:
    calc(100% - 24px) calc(50% - 3px),
    calc(100% - 16px) calc(50% - 3px);
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

select.field option,
select.input-field option {
  color: #111827;
  background: #ffffff;
}

.field:focus,
.input-field:focus {
  border-color: var(--primary);
  box-shadow: var(--primary-glow);
}

.field::placeholder,
.input-field::placeholder {
  color: var(--text-muted);
}

/* ========== 登录页 ========== */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg-dark);
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-topbar,
.login-links,
.topbar-row,
.topbar-actions,
.topbar-meta,
.row,
.order-head,
.order-actions,
.subpage-header,
.tabs-filter {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-topbar,
.topbar-row,
.topbar-actions,
.row,
.order-head,
.subpage-header {
  justify-content: space-between;
}

.login-banner {
  margin-bottom: 16px;
}

.login-banner-image {
  width: 100%;
  border-radius: 20px;
}

.login-panel {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: var(--border-glow);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card), inset 0 0 20px rgba(0, 245, 255, 0.05);
  padding: 24px;
}

.login-panel-brand {
  color: var(--primary);
  margin-bottom: 8px;
}

.login-screen h2,
.login-panel h1 {
  text-align: center;
  margin-bottom: 24px;
  color: var(--text-title);
}

.login-links {
  justify-content: center;
  flex-wrap: wrap;
}

.link-btn {
  color: var(--primary);
  cursor: pointer;
}

.login-links-sep,
.login-divider {
  color: var(--text-muted);
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal-content,
.dialog-content {
  background: var(--bg-card-solid);
  border: var(--border-glow);
  border-radius: 20px;
  box-shadow: var(--shadow-card), inset 0 0 30px rgba(0, 245, 255, 0.1);
  padding: 24px;
  max-width: 360px;
  width: 90%;
}

.modal-content .title,
.dialog-content .title {
  color: var(--text-title);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-content .message {
  color: var(--text-body);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

.dialog {
  border: 0;
  background: transparent;
  color: inherit;
  width: min(92vw, 420px);
  margin: auto;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* ========== 提示条 ========== */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 245, 255, 0.9);
  color: #000;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 600;
  box-shadow: var(--primary-glow);
  z-index: 3000;
  animation: fadeInOut 3s ease forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, 20px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  90% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* ========== 工具类 ========== */
.text-title { color: var(--text-title); font-size: 18px; font-weight: 600; }
.text-body { color: var(--text-body); font-size: 14px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.grid-2,
.profile-grid,
.shop-grid,
.zone-grid,
.sub-grid,
.order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.page-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 16px;
}

.page-hero::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -52px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 245, 255, 0.24), rgba(123, 44, 255, 0.02) 70%);
  pointer-events: none;
}

.page-kicker {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  color: var(--text-title);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 8px;
}

.page-subtitle {
  color: var(--text-body);
  margin-top: 10px;
}

.hero-actions,
.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.metric-chip {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.metric-chip strong {
  display: block;
  color: var(--text-title);
  font-size: 18px;
  margin-top: 6px;
}

.section-stack > * + * {
  margin-top: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-header .section-title {
  color: var(--text-title);
  font-size: 18px;
  font-weight: 600;
}

.surface-note {
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid rgba(0, 245, 255, 0.18);
  color: var(--text-body);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-body);
  font-size: 12px;
}

.empty-state {
  padding: 22px 16px;
  text-align: center;
  color: var(--text-muted);
}

.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  cursor: pointer;
}

.amount-btn.active {
  border-color: rgba(0, 245, 255, 0.45);
  box-shadow: var(--primary-glow);
  color: #fff;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ========== 兼容旧类名 ========== */
.container,
.content {
  padding: 16px;
}

.list {
  display: grid;
  gap: 12px;
}

.subpage {
  display: grid;
  gap: 16px;
}

.sub-headings {
  display: grid;
  gap: 6px;
}

.sub-link {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 12px;
  border: var(--border-glow);
  text-align: left;
}

.sub-link.danger {
  border-color: rgba(255, 80, 80, 0.25);
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glow);
  border-radius: 999px;
  color: var(--text-body);
  padding: 8px 14px;
  cursor: pointer;
}

.chip.active {
  color: var(--primary);
}

.hidden {
  display: none !important;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: var(--border-glow);
  cursor: pointer;
}

.lang-menu {
  position: absolute;
  right: 16px;
  top: 60px;
  background: var(--bg-card-solid);
  border: var(--border-glow);
  border-radius: 16px;
  padding: 8px;
  z-index: 1001;
}

.lang-item {
  width: 100%;
  text-align: left;
  color: var(--text-body);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.lang-item.active,
.lang-item:hover {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.05);
}

.time-box {
  background: rgba(255, 255, 255, 0.04);
  border: var(--border-glow);
  border-radius: 12px;
  padding: 8px 12px;
}

.time-label,
.time-sync {
  color: var(--text-muted);
  font-size: 12px;
}

.time-value {
  color: var(--text-title);
  font-weight: 600;
}

.winner-list,
.winner-track,
.winner-row {
  display: grid;
  gap: 10px;
}

.winner-row {
  grid-template-columns: 1fr auto auto;
  align-items: center;
}

.winner-left,
.winner-mid,
.winner-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.winner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-title);
}

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

hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 12px 0;
}

@media (max-width: 480px) {
  .grid-2,
  .profile-grid,
  .shop-grid,
  .zone-grid,
  .sub-grid,
  .order-grid {
    grid-template-columns: 1fr;
  }
}
