/* 黄金价格管理后台样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
}

#app { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h1 { font-size: 18px; font-weight: 600; }
.sidebar-header h1 span { font-size: 13px; color: #a0a0c0; font-weight: 400; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 24px; color: #b0b0d0; text-decoration: none;
    transition: all 0.2s; border-left: 3px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: rgba(255,215,0,0.1); border-left-color: #ffd700; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 12px; color: #707090; }

/* 主内容 */
.main-content { flex: 1; margin-left: 220px; padding: 24px; }

.page { display: none; }
.page.active { display: block; }

.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.page-header h2 { font-size: 22px; font-weight: 600; }

/* 统计卡片 */
.stats-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px; margin-bottom: 20px;
}
.stat-card {
    background: #fff; border-radius: 12px; padding: 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.stat-blue { background: #e6f7ff; }
.stat-green { background: #f6ffed; }
.stat-orange { background: #fff7e6; }
.stat-purple { background: #f9f0ff; }
.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 13px; color: #999; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; color: #333; }

/* 卡片 */
.card {
    background: #fff; border-radius: 12px; padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); margin-bottom: 20px;
}
.card h3 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.dashboard-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;
}
@media (max-width: 900px) { .dashboard-row { grid-template-columns: 1fr; } }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px; background: #fafafa;
    font-weight: 600; font-size: 13px; color: #666;
    border-bottom: 2px solid #f0f0f0; white-space: nowrap;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover td { background: #fafbfc; }
.text-center { text-align: center; }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: 6px;
    cursor: pointer; font-size: 14px; transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background: #1677ff; color: #fff; }
.btn-primary:hover { background: #0958d9; }
.btn-default { background: #f0f0f0; color: #333; }
.btn-default:hover { background: #e0e0e0; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #d9363e; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 状态标签 */
.tag {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 12px; font-weight: 500;
}
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-error { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.tag-info { background: #e6f7ff; color: #1677ff; border: 1px solid #91d5ff; }
.tag-warning { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }

.price-up { color: #f5222d; font-weight: 600; }
.price-down { color: #52c41a; font-weight: 600; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-input {
    width: 100%; padding: 8px 12px; border: 1px solid #d9d9d9;
    border-radius: 6px; font-size: 14px; transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,0.1); }
.form-group small { display: block; margin-top: 4px; color: #999; font-size: 12px; }

/* 弹窗 */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: #fff; border-radius: 12px; width: 500px; max-width: 90%;
    max-height: 90vh; overflow-y: auto;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 { font-size: 18px; }
.modal-close {
    background: none; border: none; font-size: 18px; cursor: pointer;
    color: #999; padding: 4px 8px;
}
#ad-form { padding: 20px; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 16px; border-top: 1px solid #f0f0f0; margin-top: 16px;
}

/* 系统概况 */
.system-stats { display: flex; flex-direction: column; gap: 12px; }
.system-stats .stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: #fafafa; border-radius: 8px;
}
.system-stats .stat-row span:first-child { color: #666; }
.system-stats .stat-row span:last-child { font-weight: 600; font-size: 18px; color: #1677ff; }

.last-fetch-info { display: flex; flex-direction: column; gap: 8px; }
.last-fetch-info p { padding: 8px 16px; background: #fafafa; border-radius: 6px; }

/* 广告统计卡片 */
.ad-stats-cards {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px;
}
@media (max-width: 700px) { .ad-stats-cards { grid-template-columns: 1fr; } }
.ad-stat-card {
    background: #fff; border-radius: 12px; padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center;
}
.ad-stat-card .ad-type { font-size: 14px; color: #999; margin-bottom: 8px; }
.ad-stat-card .ad-counts { display: flex; justify-content: center; gap: 20px; }
.ad-stat-card .ad-count { text-align: center; }
.ad-stat-card .ad-count-num { font-size: 24px; font-weight: 700; color: #333; }
.ad-stat-card .ad-count-label { font-size: 12px; color: #999; }

/* 图表 */
.chart-container { width: 100%; height: 220px; position: relative; }

/* API文档 */
.api-doc h4 { margin: 12px 0 8px; font-size: 14px; color: #333; }
.api-doc code { background: #f5f5f5; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.api-doc pre { background: #1e1e1e; color: #d4d4d4; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 8px 0; }
.api-doc pre code { background: none; color: inherit; padding: 0; }
