/* 51.la 风格现代化网站统计工具 CSS */
:root {
    --primary: #185adb;
    --primary-dark: #0f3ba1;
    --primary-light: #e8f0fe;
    --accent: #00d26a;
    --danger: #f43f5e;
    --warning: #f59e0b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    font-size: 14px;
}

/* 顶部经典 51.la 蓝导航条 */
.header {
    background: linear-gradient(135deg, #0b3060 0%, #154c9e 100%);
    color: #fff;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(11, 48, 96, 0.25);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo-badge {
    background: #00d26a;
    color: #0b3060;
    font-weight: 800;
    font-size: 15px;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.header-sub {
    font-size: 12px;
    opacity: 0.75;
    background: rgba(255,255,255,0.15);
    padding: 2px 8px;
    border-radius: 12px;
}

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

.online-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 210, 106, 0.15);
    border: 1px solid rgba(0, 210, 106, 0.4);
    color: #4ade80;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #00d26a;
    border-radius: 50%;
    box-shadow: 0 0 8px #00d26a;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 210, 106, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(0, 210, 106, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 210, 106, 0); }
}

/* 按钮通用 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
}
.btn-outline:hover {
    background: rgba(255,255,255,0.15);
}

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

.btn-success {
    background: #10b981;
    color: #fff;
}
.btn-success:hover {
    background: #059669;
}

/* 标签栏二级导航 */
.subnav {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-tabs {
    display: flex;
    list-style: none;
    gap: 4px;
    overflow-x: auto;
}

.nav-tab-item {
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-tab-item:hover {
    color: var(--primary);
}

.nav-tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* 主体容器 */
.container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}

/* 核心指标卡片栅格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.card-uv::before { background: #10b981; }
.stat-card.card-ip::before { background: #8b5cf6; }
.stat-card.card-online::before { background: #f59e0b; }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-val {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
    margin-bottom: 8px;
}

.stat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-up {
    background: #ecfdf5;
    color: #059669;
}
.badge-down {
    background: #fef2f2;
    color: #dc2626;
}

/* 经典 51.la 最近7日对照模块 */
.section-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f294d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-icon {
    color: var(--primary);
}

.table-responsive {
    overflow-x: auto;
}

/* 经典 51.la 对照表格 */
.la-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.la-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.la-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
    white-space: nowrap;
}

.la-table tr:hover td {
    background: #f8fafc;
}

.la-table tr.row-today td {
    background: #eff6ff;
    font-weight: 600;
}

.la-table tr.row-avg td {
    background: #f1f5f9;
    font-weight: 600;
    border-top: 2px solid #cbd5e1;
}

.metric-num {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* 双列栅格 */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* 进度条与占比 */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.progress-bar-bg {
    flex: 1;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-bar-fill.accent { background: #10b981; }
.progress-bar-fill.purple { background: #8b5cf6; }
.progress-bar-fill.orange { background: #f97316; }

.share-text {
    width: 48px;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
}

/* 来源分布徽章 */
.source-pill {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.source-search { background: #e0f2fe; color: #0284c7; }
.source-external { background: #fef3c7; color: #b45309; }
.source-direct { background: #f3f4f6; color: #4b5563; }

/* 代码片段与复制 */
.code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 14px 16px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    overflow-x: auto;
    position: relative;
    margin: 10px 0;
}

/* 提示弹窗 Toast */
#toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}
#toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* 底部 */
.footer {
    text-align: center;
    padding: 24px 0 40px;
    color: var(--text-muted);
    font-size: 12px;
}
