/* ============================================================
   main.css - 全局样式
   拓界易游代练陪玩平台 H5端
   配色: 主色金黄#F5A623 辅助色深黑#1A1A1A 背景白#FFFFFF 浅灰#F5F5F5
   ============================================================ */

/* CSS变量定义 */
:root {
  --color-primary: #F5A623;
  --color-primary-dark: #E0931A;
  --color-primary-light: #FBB84D;
  --color-black: #1A1A1A;
  --color-black-light: #2D2D2D;
  --color-white: #FFFFFF;
  --color-gray-bg: #F5F5F5;
  --color-gray-border: #E8E8E8;
  --color-gray-text: #999999;
  --color-text-main: #333333;
  --color-text-secondary: #666666;
  --color-danger: #E84C3D;
  --color-success: #2ECC71;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 24px;
  --spacing-2xl: 32px;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 28px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --nav-height: 56px;
  --header-height: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* 重置样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--font-size-base);
  color: var(--color-text-main);
  background-color: var(--color-gray-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 反复制: 禁用文本选择 */
* {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; border: 0; }
button { border: none; background: none; font-family: inherit; cursor: pointer; outline: none; }
input, textarea { font-family: inherit; outline: none; border: none; background: none; }

#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background-color: var(--color-gray-bg);
}

.page-container { width: 100%; min-height: 100vh; position: relative; }

.page-content {
  width: 100%;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 10px);
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-md);
  font-weight: 500;
  transition: opacity 0.2s, transform 0.1s;
  -webkit-appearance: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: var(--color-black);
  font-weight: 600;
}
.btn-dark { background: var(--color-black); color: var(--color-primary); }
.btn-outline { background: transparent; border: 1px solid var(--color-black); color: var(--color-black); }
.btn-ghost { background: var(--color-gray-bg); color: var(--color-text-secondary); }
.btn-disabled { background: var(--color-gray-border) !important; color: var(--color-gray-text) !important; pointer-events: none; }
.btn-block { display: flex; width: 100%; }
.btn-sm { height: 32px; padding: 0 16px; font-size: var(--font-size-sm); }

/* 卡片 */
.card { background: var(--color-white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }

/* 标签组件 - 黑色背景 */
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.tag-dark { background: var(--color-black); color: var(--color-white); }
.tag-dark-active { background: var(--color-black); color: var(--color-primary); border: 1px solid var(--color-primary); }
.tag-dark-inactive { background: transparent; color: var(--color-text-secondary); border: 1px solid var(--color-gray-border); }
.tag-gold { background: var(--color-primary); color: var(--color-black); }
.tag-outline-gold { background: transparent; color: var(--color-primary); border: 1px solid var(--color-primary); }

/* 弹窗组件 */
.modal-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.modal-mask { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); animation: fadeIn 0.2s ease; }
.modal-content {
  position: relative; width: 80%; max-width: 320px;
  background: var(--color-white); border-radius: var(--radius-lg); overflow: hidden;
  z-index: 1; animation: slideUp 0.25s ease;
}
.modal-header { padding: 20px 20px 12px; text-align: center; }
.modal-title { font-size: var(--font-size-lg); font-weight: 600; color: var(--color-black); }
.modal-body { padding: 0 20px 20px; font-size: var(--font-size-base); color: var(--color-text-secondary); text-align: center; line-height: 1.6; }
.modal-footer { display: flex; border-top: 1px solid var(--color-gray-border); }
.modal-btn { flex: 1; height: 48px; font-size: var(--font-size-md); font-weight: 500; color: var(--color-text-secondary); display: flex; align-items: center; justify-content: center; transition: background 0.2s; }
.modal-btn:active { background: var(--color-gray-bg); }
.modal-btn-primary { color: var(--color-primary); font-weight: 600; }
.modal-btn + .modal-btn { border-left: 1px solid var(--color-gray-border); }
.modal-close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--color-gray-text); z-index: 2; }
.modal-close svg { width: 20px; height: 20px; }

/* Toast提示 */
.toast-container {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 2000; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.toast {
  background: rgba(26,26,26,0.9); color: var(--color-white);
  padding: 10px 20px; border-radius: var(--radius-md); font-size: var(--font-size-base);
  max-width: 260px; text-align: center; line-height: 1.5; animation: toastIn 0.25s ease; backdrop-filter: blur(10px);
}
.toast-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.toast-icon svg { width: 32px; height: 32px; }

/* 加载遮罩 */
.loading-mask {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1500; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.2);
}
.loading-spinner {
  width: 60px; height: 60px; background: rgba(26,26,26,0.85);
  border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
}

/* 底部导航栏 */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: var(--nav-height);
  background: var(--color-white); display: flex; align-items: center; justify-content: space-around;
  border-top: 1px solid var(--color-gray-border); padding-bottom: var(--safe-bottom); z-index: 100;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 100%; color: var(--color-gray-text); transition: color 0.2s; position: relative; }
.nav-item.active { color: var(--color-black); }
.nav-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 22px; height: 22px; }
.nav-label { font-size: 10px; line-height: 1; }
.nav-badge { position: absolute; top: 4px; right: 50%; margin-right: -20px; }

/* 顶部搜索栏 */
.search-bar { display: flex; align-items: center; padding: 8px 16px; background: var(--color-white); gap: 12px; }
.search-input-wrap { flex: 1; display: flex; align-items: center; background: var(--color-gray-bg); border-radius: var(--radius-full); padding: 0 14px; height: 36px; }
.search-input-wrap .search-icon { width: 16px; height: 16px; color: var(--color-gray-text); flex-shrink: 0; }
.search-input-wrap input { flex: 1; margin-left: 8px; font-size: var(--font-size-base); color: var(--color-text-main); background: transparent; }
.search-input-wrap input::placeholder { color: var(--color-gray-text); }
.search-cancel { font-size: var(--font-size-md); color: var(--color-text-secondary); flex-shrink: 0; }

/* 公告滚动条 */
.notice-bar { display: flex; align-items: center; height: 36px; background: var(--color-black); padding: 0 12px; overflow: hidden; gap: 8px; }
.notice-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-primary); }
.notice-icon svg { width: 16px; height: 16px; }
.notice-text-wrap { flex: 1; overflow: hidden; position: relative; }
.notice-text { font-size: var(--font-size-sm); color: var(--color-white); white-space: nowrap; animation: noticeScroll 15s linear infinite; }
.notice-more { font-size: var(--font-size-xs); color: var(--color-gray-text); flex-shrink: 0; }

/* 活动横滑区块 */
.activity-strip { padding: 10px 10px 0; background: var(--color-white); }
.activity-strip-header { margin-bottom: 8px; }
.activity-strip-title { display: inline-flex; align-items: center; gap: 5px; font-size: var(--font-size-md); font-weight: 700; color: var(--color-text-main); }
.activity-strip-title svg { width: 16px; height: 16px; color: var(--color-primary); }
.activity-strip-scroll { display: flex; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
.activity-strip-scroll::-webkit-scrollbar { display: none; }
.activity-card { flex-shrink: 0; width: 140px; background: var(--color-gray-bg); border-radius: var(--radius-md); overflow: hidden; cursor: pointer; transition: transform 0.15s; }
.activity-card:active { transform: scale(0.97); }
.activity-card img { width: 100%; height: 78px; object-fit: cover; display: block; }
.activity-card-title { font-size: var(--font-size-sm); color: var(--color-text-main); padding: 6px 8px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* 商品卡片网格 */
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }
.product-card { background: var(--color-white); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.product-card:active { transform: scale(0.98); }
.product-card-image { width: 100%; aspect-ratio: 1; background: var(--color-gray-bg); overflow: hidden; position: relative; }
.product-card-image img { width: 100%; height: 100%; object-fit: cover; }
.product-card-tag { position: absolute; top: 8px; left: 8px; z-index: 1; }
.product-card-fav { position: absolute; top: 8px; right: 8px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.product-card-fav svg { width: 14px; height: 14px; color: #fff; }
.product-card-fav.active { background: rgba(232,76,61,0.9); }
.product-card-fav.active svg { color: #fff; }
.product-card-info { padding: 8px 10px 10px; }
.product-card-name { font-size: var(--font-size-sm); color: var(--color-text-main); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-bottom: 6px; min-height: 38px; }
.product-card-bottom { display: flex; align-items: flex-end; justify-content: space-between; }
.product-card-price { font-size: var(--font-size-lg); font-weight: 700; color: var(--color-primary); }
.product-card-price .price-symbol { font-size: var(--font-size-xs); font-weight: 500; }
.product-card-cart { width: 28px; height: 28px; background: var(--color-black); border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.product-card-cart svg { width: 16px; height: 16px; color: var(--color-primary); }

/* 分类标签栏 - 黑色背景 */
.category-tabs { display: flex; background: var(--color-white); padding: 0 10px; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; height: 44px; align-items: center; }
.category-tabs::-webkit-scrollbar { display: none; }
.category-tab { flex-shrink: 0; padding: 6px 16px; border-radius: var(--radius-full); font-size: var(--font-size-sm); font-weight: 500; background: var(--color-black); color: rgba(255,255,255,0.6); transition: all 0.2s; white-space: nowrap; }
.category-tab.active { background: var(--color-black); color: var(--color-primary); border: 1px solid var(--color-primary); font-weight: 600; }

/* 价格样式 - 金色 */
.price { color: var(--color-primary); font-weight: 700; }
.price .price-symbol { font-size: 0.7em; font-weight: 500; }
.price .price-integer { font-size: 1em; }
.price .price-decimal { font-size: 0.8em; }
.price-original { font-size: var(--font-size-xs); color: var(--color-gray-text); text-decoration: line-through; margin-left: 4px; font-weight: 400; }

/* 底部安全区适配 */
.safe-area-bottom { padding-bottom: var(--safe-bottom); }

/* 图片预览 */
.image-preview { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center; }
.image-preview img { width: 100%; height: auto; max-height: 100%; object-fit: contain; }
.image-preview .preview-close { position: absolute; top: 20px; right: 20px; width: 36px; height: 36px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.image-preview .preview-close svg { width: 20px; height: 20px; color: var(--color-white); }

/* 空状态 */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; }
.empty-state svg { width: 64px; height: 64px; color: var(--color-gray-border); margin-bottom: 16px; }
.empty-state-text { font-size: var(--font-size-sm); color: var(--color-gray-text); }

/* 分割线 */
.divider { height: 1px; background: var(--color-gray-border); margin: 0; }
.divider-text { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--color-gray-text); font-size: var(--font-size-xs); }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--color-gray-border); }

/* 通用动画 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes noticeScroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOutRight { from { transform: translateX(0); } to { transform: translateX(100%); } }

.page-enter { animation: fadeIn 0.2s ease; }

/* 骨架屏 */
.skeleton { background: linear-gradient(90deg, var(--color-gray-bg) 25%, var(--color-gray-border) 50%, var(--color-gray-bg) 75%); background-size: 200% 100%; animation: skeletonLoading 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes skeletonLoading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-block { width: 100%; height: 100%; }

/* 列表项 */
.list-item { display: flex; align-items: center; padding: 14px 16px; background: var(--color-white); gap: 12px; transition: background 0.15s; }
.list-item:active { background: var(--color-gray-bg); }
.list-item-icon { width: 24px; height: 24px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--color-text-secondary); }
.list-item-icon svg { width: 20px; height: 20px; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-size: var(--font-size-md); color: var(--color-text-main); font-weight: 500; }
.list-item-subtitle { font-size: var(--font-size-sm); color: var(--color-gray-text); margin-top: 2px; }
.list-item-arrow { width: 16px; height: 16px; color: var(--color-gray-text); flex-shrink: 0; }
.list-item-arrow svg { width: 16px; height: 16px; }

/* 页面标题栏 */
.page-header { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); background: var(--color-white); padding: 0 12px; position: sticky; top: 0; z-index: 50; }
.page-header-title { font-size: var(--font-size-lg); font-weight: 600; color: var(--color-black); }
.page-header-back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--color-black); }
.page-header-back svg { width: 22px; height: 22px; }
.page-header-right { width: 32px; height: 32px; display: flex; align-items: center; justify-content: flex-end; color: var(--color-black); }
.page-header-right svg { width: 22px; height: 22px; }

/* 红点 */
.badge-dot { position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--color-danger); color: var(--color-white); font-size: 10px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; line-height: 1; }

.hidden { display: none !important; }
