/* ============================================================
 * AI超市 - 共用样式（变量 / Reset / 导航 / 卡片 / Modal / Footer）
 * ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f6f9fc;
    --bg-card: #ffffff;
    --text-primary: #0b1a2f;
    --text-secondary: #4a5a6e;
    --text-light: #8a9bb0;
    --border-light: #e8edf4;
    --shadow-sm: 0 4px 16px rgba(0, 20, 40, 0.06);
    --shadow-hover: 0 12px 40px rgba(0, 20, 40, 0.12);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.2, 0, 0, 1);
    --brand-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --brand-primary: #6366f1;
    --brand-secondary: #8b5cf6;
    --tag-tool: #0ea5e9;
    --tag-skill: #22c55e;
    --tag-custom: #f59e0b;

    --type-official: #3b82f6;
    --type-opensource: #22c55e;
    --type-thirdparty: #f59e0b;
    --type-optimized: #8b5cf6;

    --tokens-low: #22c55e;
    --tokens-medium: #f59e0b;
    --tokens-high: #ef4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    padding: 0 24px 60px;
    min-height: 100vh;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 12px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.container { max-width: 1360px; margin: 0 auto; }

/* ---------- 导航 ---------- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0 14px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 16px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 24px;
    letter-spacing: -0.5px;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
}
.navbar-brand i {
    font-size: 28px;
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.navbar-brand span {
    font-weight: 300;
    -webkit-text-fill-color: var(--text-secondary);
    background: none;
    color: var(--text-secondary);
}

.navbar-search {
    flex: 1 1 360px;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 60px;
    padding: 0 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.navbar-search:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
.navbar-search i { color: var(--text-light); font-size: 15px; }
.navbar-search input {
    border: none;
    background: transparent;
    padding: 12px 14px;
    font-size: 15px;
    width: 100%;
    outline: none;
    color: var(--text-primary);
}
.navbar-search input::placeholder { color: var(--text-light); }

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.navbar-actions .btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 60px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.navbar-actions .btn-icon:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}
.avatar {
    width: 42px;
    height: 42px;
    border-radius: 60px;
    background: var(--brand-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.avatar:hover { transform: scale(1.04); box-shadow: var(--shadow-hover); }

.btn-client-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: 60px;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    letter-spacing: 0.2px;
}
.btn-client-download:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); opacity: 0.92; }
.btn-client-download i { font-size: 16px; }

/* ---------- 页面切换动画 ---------- */
.page { animation: fadePage 0.35s ease; }
@keyframes fadePage {
    0% { opacity: 0; transform: translateY(14px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---------- 二级页面头部 ---------- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin: 28px 0 24px;
}
.page-header h2 {
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}
.page-header h2 i { font-size: 26px; color: var(--brand-primary); }
.page-header .subtitle { color: var(--text-secondary); font-weight: 400; font-size: 16px; }
.back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 60px;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}
.back-home:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* ---------- 商品卡片 ---------- */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 20px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}
.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(99, 102, 241, 0.20);
}

.type-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 60px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
}
.type-badge i { font-size: 11px; }
.type-badge.official { background: var(--type-official); }
.type-badge.opensource { background: var(--type-opensource); }
.type-badge.thirdparty { background: var(--type-thirdparty); }
.type-badge.optimized { background: var(--type-optimized); }

.product-card .hot-badge {
    position: absolute;
    top: 14px;
    left: 80px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 60px;
    background: #fee2e2;
    color: #b91c1c;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 2;
}
.product-card .hot-badge.new { background: #dbeafe; color: #1e40af; }
.product-card:not(.has-type) .hot-badge { left: 14px; }

.product-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 60px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: #f1f5f9;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 2;
}
.product-badge.tool { background: #e0f2fe; color: #0369a1; }
.product-badge.skill { background: #dcfce7; color: #15803d; }
.product-badge.custom { background: #fef3c7; color: #b45309; }

.product-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-top: 8px;
    margin-bottom: 14px;
    background: #f1f5f9;
    color: var(--brand-primary);
}
.product-icon.tool-icon { background: #e0f2fe; color: #0ea5e9; }
.product-icon.skill-icon { background: #dcfce7; color: #22c55e; }
.product-icon.custom-icon { background: #fef3c7; color: #f59e0b; }

.product-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.product-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; flex: 1; line-height: 1.5; }

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-light);
    padding-top: 14px;
    margin-top: 4px;
    flex-wrap: wrap;
    gap: 8px;
}
.product-meta .stats {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--text-light);
}
.product-meta .stats i { margin-right: 4px; }
.product-meta .stats span { display: flex; align-items: center; }

/* tokens 消耗 */
.tokens-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px 2px 6px;
    border-radius: 60px;
    background: #f1f5f9;
    line-height: 1.4;
}
.tokens-indicator .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.tokens-indicator .dot.filled { background: currentColor; }
.tokens-indicator .dot.empty { background: #d1d5db; }
.tokens-indicator .label { margin-left: 2px; font-size: 11px; font-weight: 500; }
.tokens-indicator.low { color: var(--tokens-low); }
.tokens-indicator.medium { color: var(--tokens-medium); }
.tokens-indicator.high { color: var(--tokens-high); }
.tokens-indicator.low .label { color: var(--tokens-low); }
.tokens-indicator.medium .label { color: var(--tokens-medium); }
.tokens-indicator.high .label { color: var(--tokens-high); }

.product-actions { display: flex; gap: 8px; }
.product-actions .btn-sm {
    padding: 5px 14px;
    border-radius: 60px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: var(--text-secondary);
}
.product-actions .btn-sm:hover {
    background: var(--brand-primary);
    color: #fff;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.product-actions .btn-sm.primary { background: var(--brand-gradient); color: #fff; }
.product-actions .btn-sm.primary:hover { box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35); transform: scale(1.02); }
.product-actions .btn-sm i { font-size: 13px; }

/* ---------- 底部 ---------- */
.footer {
    margin-top: 60px;
    padding-top: 28px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--text-light);
    font-size: 14px;
}
.footer a { color: var(--text-secondary); text-decoration: none; transition: var(--transition); }
.footer a:hover { color: var(--brand-primary); }
.footer .links { display: flex; gap: 24px; }

/* ---------- 分类图标颜色 ---------- */
.text-tool { color: var(--tag-tool); }
.text-skill { color: var(--tag-skill); }
.text-custom { color: var(--tag-custom); }

/* ---------- 下载弹窗 ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.40);
    backdrop-filter: blur(4px);
    z-index: 999;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    max-width: 540px;
    width: 90%;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.20);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    0% { opacity: 0; transform: scale(0.94) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-box h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 10px; }
.modal-box h3 i { color: var(--tag-skill); }
.modal-box .modal-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.modal-box .modal-client-tip {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    background: #f1f5f9;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--brand-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.modal-box .modal-client-tip a {
    color: var(--brand-primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.modal-box .modal-client-tip a:hover { text-decoration: underline; }
.modal-box .download-link-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    border: 1px solid var(--border-light);
}
.modal-box .download-link-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: 'Inter', monospace;
    color: var(--text-primary);
    outline: none;
    padding: 6px 0;
    width: 100%;
}
.modal-box .download-link-wrap input::selection { background: var(--brand-primary); color: #fff; }
.modal-box .copy-btn {
    background: var(--brand-gradient);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 60px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.modal-box .copy-btn:hover { opacity: 0.85; transform: scale(1.02); }
.modal-box .close-modal-btn {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 24px;
    border-radius: 60px;
    border: 1px solid var(--border-light);
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.modal-box .close-modal-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.modal-box .install-method {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color, #eee);
}
.modal-box .install-method:first-of-type {
    margin-top: 10px;
    padding-top: 0;
    border-top: none;
}
.modal-box .install-method-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin-bottom: 8px;
}
.modal-box .btn-deep-link {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 60px;
    background: var(--brand-gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}
.modal-box .btn-deep-link:hover { opacity: 0.9; transform: translateY(-2px); }
.modal-box .btn-deep-link:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.modal-box .actions-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* ---------- 空状态 / 加载 ---------- */
.empty-state, .loading-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-light);
    padding: 40px 0;
    font-size: 14px;
}
.loading-state i { animation: spin 1s linear infinite; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
    body { padding: 0 16px 40px; }
    .navbar { flex-direction: column; align-items: stretch; }
    .navbar-search { flex: 1 1 auto; }
    .navbar-actions { align-self: flex-end; }
    .page-header { flex-direction: column; align-items: stretch; }
    .back-home { align-self: flex-start; }
    .footer { flex-direction: column; align-items: center; text-align: center; }
    .footer .links { flex-wrap: wrap; justify-content: center; }
    .product-card .hot-badge { left: 80px; }
}
