/* ===== 设计Token ===== */
:root {
  --primary: #1677ff;
  --primary-light: #e6f4ff;
  --primary-dark: #0958d9;
  --success: #52c41a;
  --success-dark: #389e0d;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1677ff;
  --wechat: #07c160;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-placeholder: #999999;
  --border: #e8e8e8;
  --bg-page: #f5f7fa;
  --bg-card: #ffffff;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-xxl: 24px;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== 通用组件 ===== */

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 var(--spacing-lg);
  border-radius: 8px;
  font-size: var(--font-size-md);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:active {
  background: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:active {
  background: var(--primary-light);
}

.btn-large {
  width: 100%;
  height: 48px;
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* 卡片 */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

/* 输入框 */
.input {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--primary);
}

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

/* 标签 */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  line-height: 1.6;
}

.tag-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.tag-success {
  background: #f6ffed;
  color: var(--success);
}

.tag-warning {
  background: #fffbe6;
  color: var(--warning);
}

.tag-danger {
  background: #fff2f0;
  color: var(--danger);
}

/* Tab栏 */
.tab-bar {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) 0;
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: color 0.2s;
}

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

.tab-item .tab-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 10px;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-item .nav-icon {
  font-size: 22px;
  margin-bottom: 2px;
}

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

/* 页面容器 */
.page-content {
  padding-bottom: 72px;
}

/* 公告横幅 */
.notice-bar {
  display: flex;
  align-items: center;
  height: 36px;
  background: #fffbe6;
  padding: 0 var(--spacing-md);
  font-size: var(--font-size-xs);
  color: #ad6800;
  overflow: hidden;
}

.notice-bar .notice-icon {
  margin-right: var(--spacing-sm);
  font-size: 16px;
}

.notice-bar .notice-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* 搜索框 */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  padding: var(--spacing-sm) var(--spacing-md);
}

.search-bar .search-input {
  flex: 1;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg-page);
  padding: 0 var(--spacing-md);
  font-size: var(--font-size-sm);
  outline: none;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--text-placeholder);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: var(--spacing-sm);
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  padding: 0 4px;
}

/* 分割线 */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--spacing-md) 0;
}

/* 倒计时样式 */
.countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.countdown-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--text-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.countdown-sep {
  color: var(--text-primary);
  font-weight: 600;
}

/* 浮窗按钮 */
.float-btn {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.4);
  cursor: pointer;
  z-index: 999;
  transition: transform 0.2s;
}

.float-btn:active {
  transform: scale(0.9);
}

/* 弹窗遮罩 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--spacing-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
}

.modal-close:active {
  background: var(--bg-page);
}

/* 表单样式 */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.form-label .required {
  color: var(--danger);
}

.form-select {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  background: var(--bg-card);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-select:focus {
  border-color: var(--primary);
}

/* 头像 */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-md);
  color: var(--primary);
  flex-shrink: 0;
}

/* 安全区域适配 */
.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* 响应式隐藏 */
@media (min-width: 768px) {
  body {
    max-width: 414px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  }
}

/* ===== AI客服样式 ===== */
.ai-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-start;
}
.ai-msg.user {
  flex-direction: row-reverse;
}
.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.ai-bubble {
  max-width: 75%;
  background: var(--bg-page);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-primary);
}
.ai-msg.user .ai-bubble {
  background: var(--primary);
  color: #fff;
}
.quick-q {
  display: inline-block;
  padding: 6px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all 0.2s;
}
.quick-q:active {
  background: var(--primary);
  color: #fff;
}

/* ===== 骨架屏 ===== */
@keyframes skeletonShimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 37%, #f0f0f0 63%);
  background-size: 400px 100%;
  animation: skeletonShimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 22px;
  width: 40%;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-banner {
  height: 120px;
  border-radius: 0;
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.skeleton-btn {
  height: 48px;
  border-radius: var(--radius-md);
}

/* 骨架屏容器 */
.skeleton-wrap {
  padding: var(--spacing-md);
}

/* 骨架屏隐藏 */
body.loaded .skeleton-screen {
  display: none !important;
}

body:not(.loaded) .real-content {
  visibility: hidden;
  height: 0;
  overflow: hidden;
}

body.loaded .real-content {
  visibility: visible;
  height: auto;
  overflow: visible;
}

/* ===== Toast提示 ===== */
@keyframes toastSlideIn {
  from { transform: translate(-50%, -100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translate(-50%, 0); opacity: 1; }
  to { transform: translate(-50%, -100%); opacity: 0; }
}

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  z-index: 10000;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  animation: toastSlideIn 0.3s ease forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast.toast-out {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast.toast-success {
  background: var(--success);
  color: #fff;
}

.toast.toast-error {
  background: var(--danger);
  color: #fff;
}

.toast.toast-info {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
}

/* ===== 预约回电浮窗按钮 ===== */
.float-callback-btn {
  position: fixed;
  left: 16px;
  bottom: 80px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
  cursor: pointer;
  z-index: 998;
  transition: transform 0.2s;
  border: none;
}

.float-callback-btn:active {
  transform: scale(0.9);
}

/* ===== 微信悬浮按钮 ===== */
.float-wechat-btn {
  position: fixed;
  right: 16px;
  bottom: 140px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--wechat);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.4);
  cursor: pointer;
  z-index: 998;
  transition: transform 0.2s;
  border: none;
}

.float-wechat-btn:active {
  transform: scale(0.9);
}

/* ===== 微信二维码弹窗 ===== */
.wechat-qr-wrap {
  text-align: center;
  padding: var(--spacing-md) 0;
}

.wechat-qr-placeholder {
  width: 200px;
  height: 200px;
  margin: 0 auto var(--spacing-md);
  background: #f0f0f0;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-placeholder);
  font-size: var(--font-size-sm);
}

.wechat-id-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-page);
  border-radius: var(--radius-md);
}

.wechat-id-row .wechat-id-text {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.wechat-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  background: var(--wechat);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.wechat-copy-btn:active {
  opacity: 0.8;
}

/* ===== 优惠券横幅 ===== */
.promo-banner {
  background: linear-gradient(135deg, #ff7875, #ff4d4f);
  color: #fff;
  padding: 10px var(--spacing-md);
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.promo-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
}

.promo-banner .promo-code {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin: 0 4px;
  font-family: monospace;
  letter-spacing: 1px;
}

/* ===== 优惠券输入区 ===== */
.promo-input-wrap {
  display: flex;
  gap: var(--spacing-sm);
  align-items: flex-start;
}

.promo-input-wrap .input {
  flex: 1;
  height: 38px;
  font-size: var(--font-size-xs);
}

.promo-verify-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: var(--font-size-xs);
  cursor: pointer;
  white-space: nowrap;
}

.promo-verify-btn:active {
  background: var(--primary-dark);
}

.promo-msg {
  font-size: var(--font-size-xs);
  margin-top: 4px;
  display: none;
}

.promo-msg.success {
  color: var(--success);
  display: block;
}

.promo-msg.error {
  color: var(--danger);
  display: block;
}

/* 价格显示 */
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-page);
  border-radius: var(--radius-md);
  margin-top: var(--spacing-sm);
}

.price-original {
  font-size: var(--font-size-sm);
  color: var(--text-placeholder);
  text-decoration: line-through;
}

.price-current {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--danger);
}

.price-discount {
  font-size: var(--font-size-xs);
  color: var(--success);
  background: #f6ffed;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
