/* ==========================================================================
   AI会员与代理系统 - 现代科技响应式设计规范 (纯中文注释)
   ========================================================================== */

:root {
    --bg-main: #0a0f1d;
    --bg-card: #131b2e;
    --bg-card-hover: #1c2742;
    --border-color: #233152;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #10b981;
    --accent-gold: #f59e0b;
    --danger: #ef4444;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #60a5fa;
}

/* 顶部导航条 */
.navbar {
    background: rgba(19, 27, 46, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.brand-badge {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    list-style: none;
}

.nav-item {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-item:hover, .nav-item.active {
    color: #fff;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.88rem;
}

.balance-tag {
    color: var(--accent);
    font-weight: 700;
}

.role-tag {
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}
.role-admin { background: #ef4444; color: #fff; }
.role-agent { background: #f59e0b; color: #000; font-weight: 700; }
.role-user { background: #3b82f6; color: #fff; }

/* 按钮通用 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.92rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background: #059669;
}

.btn-gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}
.btn-gold:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
}

/* 主容器 */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto 3rem;
    padding: 0 1.2rem;
    flex: 1;
}

/* 欢迎横幅 */
.hero-banner {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.hero-banner::after {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 0.6rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 700px;
    margin-bottom: 1.2rem;
}

.notice-box {
    background: rgba(59, 130, 246, 0.08);
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #bfdbfe;
}

/* 分类筛选与搜索 */
.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.8rem;
}

.category-tab {
    padding: 0.45rem 1.1rem;
    border-radius: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tab:hover, .category-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* 商品卡片网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    position: relative;
}

.product-card:hover {
    border-color: #3b82f6;
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.product-cat {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.07);
    color: #94a3b8;
    padding: 2px 8px;
    border-radius: 4px;
}

.product-stock {
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.product-stock.out-of-stock {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.product-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

/* 商品卡片摘要与操作区 */
.product-card .product-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    min-height: 2.6rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.product-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 0.5rem;
}

/* 商品详情大弹窗 */
.modal-content.modal-lg {
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.modal-body-scroll {
    overflow-y: auto;
    padding-right: 6px;
    margin: 1rem 0;
    flex: 1;
}

.modal-body-scroll::-webkit-scrollbar {
    width: 6px;
}
.modal-body-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* 富文本商品详情排版 */
.detail-rich-text {
    background: rgba(10, 15, 29, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2rem;
    color: #cbd5e1;
    font-size: 0.92rem;
    line-height: 1.7;
    word-break: break-word;
}

.detail-rich-text p {
    margin-bottom: 0.8rem;
}

.detail-rich-text p:last-child {
    margin-bottom: 0;
}

.detail-rich-text strong, .detail-rich-text b {
    color: #fff;
    font-weight: 700;
}

.detail-rich-text ul, .detail-rich-text ol {
    margin: 0.6rem 0 0.8rem 1.4rem;
}

.detail-rich-text li {
    margin-bottom: 0.3rem;
}

.detail-rich-text code {
    background: #1e293b;
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.detail-rich-text hr {
    border: 0;
    border-top: 1px dashed var(--border-color);
    margin: 1rem 0;
}

/* 价格区域 */
.price-box {
    margin-bottom: 0.9rem;
}

.price-locked {
    color: var(--accent-gold);
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.price-amount {
    font-size: 1.45rem;
    font-weight: 800;
    color: #38bdf8;
}

.price-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.agent-discount-pill {
    margin-top: 4px;
    font-size: 0.78rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* 表单卡片 (登录/注册/后台) */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    background: rgba(10, 15, 29, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.form-tip {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 模态弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    padding: 1.8rem;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #fff;
}

/* 提示弹信封 / Toast */
#toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: rgba(19, 27, 46, 0.95);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    display: none;
    z-index: 2000;
    font-size: 0.95rem;
}

/* 仪表盘统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
}

/* 表格通用 */
.table-responsive {
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.custom-table th, .custom-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.custom-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
}

.custom-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* 页脚 */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    background: var(--bg-main);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 0.8rem;
    }
    .product-grid {
        grid-template-columns: 1fr;
    }
    .hero-banner {
        padding: 1.4rem;
    }
    .hero-title {
        font-size: 1.4rem;
    }
}
