/* ═══════════════════════════════════════════
   主题变量 — 暗色（默认）
   ═══════════════════════════════════════════ */
:root {
    --bg:           #0f0f0f;
    --bg-card:      #1a1a1a;
    --bg-secondary: #242424;
    --bg-hover:     #2a2a2a;
    --border:       #2e2e2e;
    --text:         #e5e5e5;
    --text-secondary:#999;
    --text-muted:   #666;
    --accent:       #3b82f6;
    --accent-hover: #60a5fa;
    --accent-bg:    rgba(59,130,246,.12);
    --price:        #f87171;
    --green:        #4ade80;
    --green-bg:     rgba(74,222,128,.12);
    --warning-bg:   rgba(251,191,36,.1);
    --warning-border:rgba(251,191,36,.25);
    --warning-text: #fbbf24;
    --banner-from:  #1d4ed8;
    --banner-to:    #2563eb;
    --shadow:       rgba(0,0,0,.4);
    --scrollbar-bg: #1a1a1a;
    --scrollbar-thumb:#444;
    --overlay:      rgba(0,0,0,.85);
}

/* ═══════════════════════════════════════════
   亮色主题
   ═══════════════════════════════════════════ */
[data-theme="light"] {
    --bg:           #f5f5f5;
    --bg-card:      #ffffff;
    --bg-secondary: #fafafa;
    --bg-hover:     #f0f0f0;
    --border:       #e0e0e0;
    --text:         #333333;
    --text-secondary:#666666;
    --text-muted:   #999999;
    --accent:       #1890ff;
    --accent-hover: #40a9ff;
    --accent-bg:    #e6f7ff;
    --price:        #ff4d4f;
    --green:        #52c41a;
    --green-bg:     rgba(82,196,26,.08);
    --warning-bg:   #fff7e6;
    --warning-border:#ffd591;
    --warning-text: #d46b08;
    --banner-from:  #00d4ff;
    --banner-to:    #0099ff;
    --shadow:       rgba(0,0,0,.08);
    --scrollbar-bg: #f1f1f1;
    --scrollbar-thumb:#888;
    --overlay:      rgba(255,255,255,.92);
}

/* ═══════════════════════════════════════════
   基础
   ═══════════════════════════════════════════ */
* { 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;
    background: var(--bg);
    color: var(--text);
    transition: background .3s, color .3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-card);
    min-height: 100vh;
    transition: background .3s;
}

/* ═══════════════════════════════════════════
   头部
   ═══════════════════════════════════════════ */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border);
}

.logo { font-size: 24px; }

nav { display: flex; align-items: center; gap: 6px; }

nav a {
    margin-left: 14px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color .2s;
}
nav a:hover { color: var(--accent); }

/* 购物车 badge */
.cart-badge {
    display: inline-block;
    background: var(--price); color: #fff;
    font-size: 11px; font-weight: 700;
    min-width: 18px; height: 18px; line-height: 18px;
    text-align: center; border-radius: 10px;
    margin-left: 4px; padding: 0 5px;
    transition: transform .2s;
}
.cart-add-btn {
    width: 42px !important; flex: none !important;
    font-size: 16px; padding: 8px !important;
}

/* 主题切换按钮 */
.theme-toggle {
    margin-left: 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s;
    flex-shrink: 0;
}
.theme-toggle:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

/* ═══════════════════════════════════════════
   页面切换
   ═══════════════════════════════════════════ */
.page { display: none; }
.page.active { display: block; animation: fadeIn .3s ease; }

/* Banner */
.banner {
    background: linear-gradient(135deg, var(--banner-from), var(--banner-to));
    color: white;
    padding: 20px;
    margin: 20px;
    border-radius: 8px;
    font-size: 14px;
}

/* ═══════════════════════════════════════════
   分类标签
   ═══════════════════════════════════════════ */
.category-tabs {
    display: flex;
    gap: 10px;
    padding: 20px;
    overflow-x: auto;
}

.tab {
    padding: 15px 25px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all .3s;
    white-space: nowrap;
}
.tab:hover { background: var(--bg-hover); }
.tab.active {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}
.tab span { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════
   商品网格
   ═══════════════════════════════════════════ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.product-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all .3s;
    background: var(--bg-card);
}
.product-card:hover {
    box-shadow: 0 4px 16px var(--shadow);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.product-image {
    width: 100%; height: 180px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 90px; font-weight: bold;
    margin-bottom: 15px;
    overflow: hidden;
}
.product-image-photo {
    background: #000;
    padding: 0;
}
.product-image-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.product-card h3 {
    font-size: 16px; margin: 10px 0; color: var(--text);
}

.price {
    color: var(--price); font-size: 20px; font-weight: bold; margin: 10px 0;
}

.buy-btn {
    width: 100%; padding: 10px;
    background: var(--green); color: #fff;
    border: none; border-radius: 4px;
    cursor: pointer; font-size: 14px;
    transition: opacity .2s;
}
.buy-btn:hover { opacity: .85; }

/* ═══════════════════════════════════════════
   商品详情
   ═══════════════════════════════════════════ */
.breadcrumb { padding: 15px 20px; color: var(--text-secondary); font-size: 14px; }

.detail-container { padding: 20px; }

.product-main {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.detail-image-wrap {
    position: relative;
    width: 300px;
    flex-shrink: 0;
}
.product-image-large {
    width: 300px; height: 300px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 140px; font-weight: bold;
    overflow: hidden;
    transition: opacity .2s;
}
.product-image-large.has-photo {
    background: #000;
}
.product-image-large.has-photo img {
    width: 100%; height: 100%;
    object-fit: contain;
    display: block;
}
/* 轮播圆点 */
.carousel-dots {
    display: none;
    justify-content: center;
    gap: 8px;
    padding: 10px 0;
}
.carousel-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: all .2s;
}
.carousel-dots .dot.active {
    background: var(--accent);
    transform: scale(1.2);
}

.product-info h2 { font-size: 24px; margin-bottom: 15px; color: var(--text); }

.badge {
    background: var(--accent); color: white;
    padding: 2px 8px; border-radius: 4px; font-size: 12px;
}

.price-large {
    color: var(--price); font-size: 32px; font-weight: bold; margin-bottom: 20px;
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: var(--text-secondary); }
.form-group input {
    width: 100%; padding: 10px;
    border: 1px solid var(--border); border-radius: 4px;
    font-size: 14px;
    background: var(--bg-secondary); color: var(--text);
    transition: border-color .2s;
}
.form-group input:focus { border-color: var(--accent); outline: none; }
.form-group span { color: var(--text-secondary); }

.quantity-control { display: flex; gap: 10px; align-items: center; }
.quantity-control button {
    width: 32px; height: 32px;
    border: 1px solid var(--border); background: var(--bg-secondary);
    color: var(--text); cursor: pointer; border-radius: 4px;
}
.quantity-control input { width: 60px; text-align: center; }

.notice {
    background: var(--warning-bg); border: 1px solid var(--warning-border);
    padding: 12px; border-radius: 4px;
    font-size: 13px; color: var(--warning-text); margin-bottom: 20px;
}

.verify-btn {
    padding: 10px 20px; background: var(--accent); color: white;
    border: none; border-radius: 4px; cursor: pointer; margin-left: 10px;
}

.submit-btn {
    width: 100%; padding: 15px;
    background: var(--accent); color: white;
    border: none; border-radius: 4px;
    font-size: 16px; cursor: pointer; margin-top: 20px;
    transition: background .2s;
}
.submit-btn:hover { background: var(--accent-hover); }

.product-description {
    background: var(--bg-secondary); padding: 20px; border-radius: 8px;
}
.product-description h3 { margin-bottom: 15px; color: var(--text); }
.product-description p { margin-bottom: 10px; line-height: 1.6; color: var(--text-secondary); }

/* ═══════════════════════════════════════════
   视频预览区域
   ═══════════════════════════════════════════ */
.video-preview {
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-secondary);
    padding-bottom: 20px;
}
.video-preview h3 {
    padding: 16px 20px 0;
    margin-bottom: 12px;
    color: var(--text);
}
/* 内嵌 iframe 视频 */
.video-embed-wrap {
    position: relative;
    width: 100%;
    padding: 0 20px;
}
.video-embed-wrap iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    display: block;
    background: #000;
}
/* 缩略图跳转模式 */
.video-thumb-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    margin: 0 20px;
    padding: 40px 20px;
    text-decoration: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    transition: all .3s;
}
[data-theme="light"] .video-thumb-wrap {
    background: linear-gradient(135deg, #e8eaf6, #c5cae9);
}
.video-thumb-wrap:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 24px rgba(59,130,246,.25);
}
.video-thumb-wrap img {
    width: 100%;
    border-radius: 8px;
    display: block;
    aspect-ratio: 16/9;
    object-fit: contain;
    background: #000;
}
.video-play-btn {
    width: 68px; height: 68px;
    background: rgba(59,130,246,.85);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: all .3s;
    box-shadow: 0 4px 20px rgba(59,130,246,.4);
}
.video-play-btn::after {
    content: '';
    display: block;
    width: 0; height: 0;
    border-style: solid;
    border-width: 13px 0 13px 24px;
    border-color: transparent transparent transparent #fff;
    margin-left: 5px;
}
.video-thumb-wrap:hover .video-play-btn {
    background: rgba(59,130,246,1);
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(59,130,246,.55);
}
.video-link-hint {
    color: rgba(255,255,255,.7);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .3px;
}
[data-theme="light"] .video-link-hint { color: rgba(0,0,0,.5); }

/* ═══════════════════════════════════════════
   商品元信息 & 库存
   ═══════════════════════════════════════════ */
.product-meta {
    display: flex; gap: 20px; margin-bottom: 20px;
    font-size: 14px; color: var(--text-secondary);
}
.product-meta strong { color: var(--price); }
.stock-info { font-size: 12px; color: var(--green); margin: 5px 0; }

/* ═══════════════════════════════════════════
   支付页面 & 订单
   ═══════════════════════════════════════════ */
.payment-container { max-width: 600px; margin: 40px auto; padding: 20px; }

.payment-header {
    background: linear-gradient(135deg, var(--banner-from), var(--banner-to));
    color: white; padding: 30px; border-radius: 8px;
    text-align: center; margin-bottom: 30px;
}
.order-number { font-size: 14px; margin-bottom: 10px; }
.order-amount { font-size: 48px; font-weight: bold; margin: 15px 0; }
.order-status { display: flex; gap: 10px; justify-content: center; }
.status-badge { background: rgba(255,255,255,.3); padding: 4px 12px; border-radius: 12px; font-size: 12px; }

.payment-methods h3 { margin-bottom: 20px; }
.payment-options { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 30px; }
.payment-option {
    border: 2px solid var(--border); border-radius: 8px;
    padding: 20px; text-align: center; cursor: pointer; transition: all .3s;
}
.payment-option.active { border-color: var(--accent); background: var(--accent-bg); }
.payment-icon { font-size: 48px; margin-bottom: 10px; }
.payment-name { font-weight: bold; margin-bottom: 5px; }
.payment-desc { font-size: 12px; color: var(--text-muted); }

.security-notice {
    display: flex; gap: 15px; background: var(--bg-secondary);
    padding: 20px; border-radius: 8px; margin-bottom: 30px;
}
.security-icon { font-size: 48px; }
.security-text strong { display: block; margin-bottom: 5px; }
.security-text p { font-size: 13px; color: var(--text-secondary); }

.payment-actions { display: flex; gap: 15px; }
.confirm-payment-btn {
    flex: 1; padding: 15px; background: var(--accent); color: white;
    border: none; border-radius: 4px; font-size: 16px; cursor: pointer;
}
.confirm-payment-btn:hover { background: var(--accent-hover); }
.cancel-btn {
    padding: 15px 30px; background: var(--bg-card); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
}
.cancel-btn:hover { color: var(--accent); border-color: var(--accent); }

/* 购物车页 */
.cart-container { max-width: 600px; margin: 40px auto; padding: 20px; }
.cart-container h2 { text-align: center; margin-bottom: 30px; color: var(--text); }
.cart-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0; border-top: 1px solid var(--border); margin-bottom: 16px;
}

/* 底部 */
footer {
    text-align: center; padding: 20px;
    color: var(--text-muted); font-size: 12px;
    border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   订单查询
   ═══════════════════════════════════════════ */
.search-container { max-width: 600px; margin: 40px auto; padding: 20px; }
.search-container h2 { text-align: center; margin-bottom: 30px; color: var(--text); }
.search-form {
    background: var(--bg-secondary); padding: 30px;
    border-radius: 8px; margin-bottom: 30px;
}
.order-result { margin-top: 30px; }
.no-result { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 16px; }

.order-list { display: flex; flex-direction: column; gap: 20px; }
.order-item {
    border: 1px solid var(--border); border-radius: 8px;
    overflow: hidden; background: var(--bg-card); transition: all .3s;
}
.order-item:hover { box-shadow: 0 4px 12px var(--shadow); }
.order-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.order-id { font-size: 14px; color: var(--text-secondary); }
.order-status { padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: bold; }
.status-paid { background: var(--green-bg); color: var(--green); border: 1px solid var(--green); }
.status-pending { background: var(--warning-bg); color: var(--warning-text); border: 1px solid var(--warning-border); }

.order-body { padding: 20px; }
.order-info-row {
    display: flex; justify-content: space-between; padding: 8px 0;
    font-size: 14px; border-bottom: 1px dashed var(--border);
}
.order-info-row:last-child { border-bottom: none; }
.order-info-row span:first-child { color: var(--text-muted); }
.order-amount { color: var(--price); font-weight: bold; font-size: 16px; }

/* ═══════════════════════════════════════════
   动画 & 通用
   ═══════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 50%; animation: spin 1s linear infinite;
}

button:disabled { opacity: .6; cursor: not-allowed; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { opacity: .7; }

/* ═══════════════════════════════════════════
   响应式
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    header { padding: 10px 15px; }
    nav a { margin-left: 10px; font-size: 12px; }
    .banner { margin: 10px; padding: 15px; font-size: 12px; }
    .category-tabs { padding: 10px; }
    .tab { padding: 10px 15px; font-size: 12px; }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px; padding: 10px;
    }
    .product-card { padding: 15px; }
    .product-image { height: 120px; font-size: 60px; }
    .detail-image-wrap { width: 100%; }
    .product-image-large { width: 100%; height: 260px; font-size: 100px; }
    .product-card h3 { font-size: 14px; }
    .price { font-size: 16px; }
    .product-main { grid-template-columns: 1fr; }
    .payment-options { grid-template-columns: 1fr; }
    .payment-actions { flex-direction: column; }
    .search-container, .payment-container { padding: 10px; margin: 20px auto; }
}

@media print {
    header, footer, .payment-actions, .cancel-btn, .theme-toggle, .qq-float { display: none; }
    .payment-container { max-width: 100%; }
}

/* ═══════════════════════════════════════════
   QQ 悬浮联系按钮
   ═══════════════════════════════════════════ */
.qq-float {
    position: fixed;
    right: 20px;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 999;
}
.qq-float-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 24px;
    border: none;
    text-decoration: none;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    transition: transform .2s, box-shadow .2s;
    white-space: nowrap;
}
.qq-float-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.qq-float-icon { font-size: 18px; }
.qq-group  { background: linear-gradient(135deg, #12b7f5, #0d8ecf); }
.qq-person { background: linear-gradient(135deg, #4ade80, #22c55e); }

@media (max-width: 768px) {
    .qq-float { right: 12px; bottom: 60px; }
    .qq-float-label { display: none; }
    .qq-float-btn { padding: 12px; border-radius: 50%; }
}

/* ═══════════════════════════════════════════
   QQ 弹窗
   ═══════════════════════════════════════════ */
.qq-popup-overlay {
    display: none;
    position: fixed; inset: 0;
    background: var(--overlay);
    z-index: 10000;
    align-items: center; justify-content: center;
}
.qq-popup-overlay.active { display: flex; }

.qq-popup {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 380px; max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    animation: fadeIn .2s ease;
}
.qq-popup-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 16px; font-weight: 600; color: var(--text);
}
.qq-popup-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px;
}
.qq-popup-close:hover { color: var(--text); }

.qq-popup-body { padding: 24px 20px; text-align: center; }

.qq-popup-number {
    font-size: 28px; font-weight: 700; color: var(--accent);
    letter-spacing: 1px; margin-bottom: 20px;
    user-select: all;
}

.qq-popup-actions { display: flex; gap: 10px; }

.qq-popup-copy-btn {
    flex: 1; padding: 12px;
    background: var(--bg-secondary); color: var(--text);
    border: 1px solid var(--border); border-radius: 6px;
    cursor: pointer; font-size: 14px;
    transition: border-color .2s;
}
.qq-popup-copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.qq-popup-go-btn {
    flex: 1; padding: 12px;
    background: var(--accent); color: #fff;
    border-radius: 6px; text-decoration: none;
    font-size: 14px; font-weight: 500; text-align: center;
    transition: background .2s;
}
.qq-popup-go-btn:hover { background: var(--accent-hover); }
