/* =============================================
   AI Store - 极简现代风格
   深浅主题无缝切换
   ============================================= */

/* ========== 字体 ========== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ========== CSS 变量 ========== */
:root {
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-elevated: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.08);
    --success: #16a34a;
    --warning: #ca8a04;
    --error: #dc2626;
    --hover-bg: #f1f5f9;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.dark {
    --bg: #09090b;
    --bg-secondary: #18181b;
    --bg-elevated: #1c1c1e;
    --text: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #27272a;
    --border-hover: #3f3f46;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.12);
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;
    --hover-bg: #27272a;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

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

html {
    scroll-behavior: smooth;
    color-scheme: light;
}

html.dark {
    color-scheme: dark;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========== 顶部导航 ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo:hover {
    opacity: 0.85;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.logo-dot {
    color: #6366f1;
}

/* 导航标签 */
.header-center {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.nav-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--text);
    background: var(--bg);
}

.nav-tab.active {
    color: #6366f1 !important;
    background: var(--bg) !important;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* 右侧按钮 */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--hover-bg);
    color: var(--text);
    border-color: var(--border-hover);
}

/* ========== 主内容 ========== */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* ========== 搜索栏 ========== */
.search-bar {
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

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

/* ========== 商品区标题 ========== */
.products-header {
    margin-bottom: 20px;
}

.products-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

/* ========== 商品网格 ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ========== 商品卡片 ========== */
.product-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12);
    transform: translateY(-2px);
}

.product-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 4px;
}

.product-card-icon.google { background: rgba(66, 133, 244, 0.1); }
.product-card-icon.openai { background: rgba(16, 163, 74, 0.1); }
.product-card-icon.grok { background: rgba(0, 0, 0, 0.05); }
.dark .product-card-icon.grok { background: rgba(255, 255, 255, 0.08); }

.product-card-category {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.product-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.product-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.product-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.product-card-price-unit {
    font-size: 13px;
    font-weight: 500;
    margin-right: 2px;
}

/* ========== 加载状态 ========== */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-muted);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* ========== 空状态 ========== */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-text {
    color: var(--text-muted);
    font-size: 14px;
}

/* ========== 订单查询 ========== */
.order-section {
    margin-top: 48px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.order-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.order-form {
    display: flex;
    gap: 12px;
    max-width: 500px;
}

.order-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
}

.order-input:focus {
    outline: none;
    border-color: var(--accent);
}

.order-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.order-btn:hover {
    background: var(--accent-hover);
}

.order-result {
    margin-top: 16px;
    display: none;
}

.order-result.show {
    display: block;
}

/* ========== 弹窗 ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    background: var(--bg-elevated);
    border-radius: 20px;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

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

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    border-radius: 0 0 20px 20px;
}

.modal-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.modal-price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.modal-price-unit {
    font-size: 14px;
    color: var(--text-muted);
}

.btn-primary {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--hover-bg);
}

/* ========== 表单 ========== */
.modal-product-info {
    margin-bottom: 20px;
}

.modal-product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.modal-product-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ========== 支付 ========== */
.pay-info {
    text-align: center;
    margin-bottom: 20px;
}

.pay-order-num {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.pay-amount {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.pay-methods {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.pay-method {
    flex: 1;
    cursor: pointer;
}

.pay-method input {
    display: none;
}

.pay-method-content {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s;
}

.pay-method input:checked + .pay-method-content {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.pay-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.pay-icon.alipay { background: #1677ff; }
.pay-icon.wechat { background: #07c160; }

.pay-btn-full {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pay-btn-full:hover {
    background: var(--accent-hover);
}

.pay-result {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    display: none;
}

.pay-result.show { display: block; }
.pay-result.success { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.pay-result.error { background: rgba(220, 38, 38, 0.1); color: var(--error); }

/* ========== 成功弹窗 ========== */
.success-dialog {
    text-align: center;
    padding: 32px 24px;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: rgba(22, 163, 74, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--success);
}

.success-dialog h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.success-info {
    margin-bottom: 16px;
}

.success-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.success-row:last-child {
    border-bottom: none;
}

.success-row-label {
    color: var(--text-muted);
    font-size: 13px;
}

.success-row-value {
    font-weight: 500;
    font-size: 13px;
}

.success-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.success-card-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.success-card-key {
    font-size: 16px;
    font-weight: 600;
    font-family: monospace;
    color: var(--accent);
    word-break: break-all;
}

.success-tip {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ========== 复制按钮 ========== */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 8px;
}

.copy-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.copy-btn.copied {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

/* ========== 订单结果 ========== */
.order-result-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.order-result-label {
    color: var(--text-muted);
    font-size: 13px;
}

.order-result-value {
    font-weight: 500;
    font-size: 13px;
}

.order-result-card {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.order-card-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.order-card-key {
    font-size: 14px;
    font-weight: 600;
    font-family: monospace;
    color: var(--accent);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
        height: 56px;
    }
    
    .header-center {
        display: none;
    }
    
    .main {
        padding: 20px 16px 60px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card {
        padding: 16px;
    }
    
    .order-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}
