/* 通用图表样式 - 适用于GB5和GB6 */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #050505;
    color: #e0e0e0;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* --- 导航按钮样式 --- */
.nav-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
}

.nav-link svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}

.header {
    text-align: center;
    margin-bottom: 25px;
    width: 100%; 
}

h2 { 
    font-weight: 600; 
    font-size: 28px; 
    margin: 0; 
    color: #fff;
    letter-spacing: 0.5px;
}

.subtitle { 
    color: #666; 
    font-size: 13px; 
    margin-top: 8px; 
    font-weight: 300;
}

.chart-container {
    position: relative;
    height: 600px;
    width: 100%;
    max-width: 1200px;
    background-color: #0a0a0a;
    padding: 15px 20px;
    border-radius: 16px;
    border: 1px solid #1f1f1f;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* --- 底部控制按钮区域 --- */
.control-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: flex-start; 
    margin-top: 20px; 
    margin-bottom: 5px; 
    padding-left: 5px; 
}

.toggle-btn {
    background-color: #1a1a1a;
    color: #ccc;
    border: 1px solid #333;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-btn:hover {
    background-color: #333;
    color: #fff;
    border-color: #666;
}

.toggle-btn:active {
    transform: scale(0.98);
}

/* --- 图例区域样式 (横向Grid) --- */
#customLegend {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 20px; 
    margin-top: 15px;
}

.manufacturer-section {
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

.manufacturer-title {
    font-size: 14px;
    color: #888;
    border-left: 4px solid #444;
    padding-left: 10px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.manufacturer-title[data-type="Qualcomm"] { border-color: #FFC107; color: #ffe082; }
.manufacturer-title[data-type="MediaTek"] { border-color: #3F51B5; color: #7986cb; }
.manufacturer-title[data-type="Samsung"] { border-color: #E91E63; color: #F48FB1; }

.legend-grid {
    width: 100%;
}

.legend-group {
    width: 100%;
    max-width: none;
    background-color: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.group-title { display: none; }

.legend-items {
    display: flex;
    flex-direction: row; 
    flex-wrap: wrap;     
    gap: 10px;           
    width: 100%;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    cursor: pointer;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
    user-select: none;
    background-color: #111;
    border: 1px solid #222;
    min-width: 100px;
}

.legend-item:hover {
    background-color: #222;
    border-color: #444;
}

.legend-header {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 2px;
}

.legend-color-box {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.legend-text {
    font-weight: 500;
    color: #eee;
}

.legend-range {
    font-size: 11px;
    color: #666;
    margin-left: 18px; 
}

.legend-item.hidden {
    opacity: 0.4;
    background-color: #0a0a0a;
    border-color: #1a1a1a;
}

.legend-item.hidden .legend-range {
    text-decoration: none;
}

.footer-info {
    margin-top: auto;
    padding-top: 40px;
    color: #444;
    font-size: 12px;
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .chart-container { height: 450px; }
    h2 { font-size: 22px; }
    
    .nav-container {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        display: flex;
        justify-content: flex-end;
        margin-bottom: 10px;
    }
    .control-container {
        justify-content: center;
        padding-left: 0;
    }
    
    .legend-item {
        padding: 6px 10px;
        min-width: auto;
        flex: 1 1 45%; 
    }
}

/* 分段控制器容器 */
.segment-control-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px; /* 与图表拉开距离 */
    margin-top: -10px;   /* 稍微靠近标题 */
}

/* 控制器槽位背景 */
.segment-control {
    background-color: #f1f3f5; /* 浅灰底色 */
    padding: 4px;
    border-radius: 12px;
    display: inline-flex;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

/* 单个选项样式 */
.segment-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #6c757d;
    text-decoration: none;
    border-radius: 9px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent; /* 预留边框位置防止跳动 */
}

/* 鼠标悬停 */
.segment-item:hover {
    color: #495057;
    background-color: rgba(0,0,0,0.02);
}

/* 激活状态 (核心样式) */
.segment-item.active {
    background-color: #ffffff;
    color: #228be6; /* 使用了GeekBench蓝，你可以改成你喜欢的主题色 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.04);
}

/* 激活状态下的图标颜色 */
.segment-item.active svg {
    stroke: #228be6;
}

/* 适配深色模式 (如果你的网站有的话) */
@media (prefers-color-scheme: dark) {
    .segment-control { background-color: #2c2e33; }
    .segment-item { color: #a5a5a5; }
    .segment-item:hover { background-color: rgba(255,255,255,0.05); }
    .segment-item.active { 
        background-color: #373a40; 
        color: #4dabf7; 
        border-color: #4dabf7;
    }
    .segment-item.active svg { stroke: #4dabf7; }
}

/* 左上角胶囊容器 */
.left-nav-capsule {
    position: absolute; /* 或者用 fixed 让它随屏幕滚动固定 */
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px); /* 磨砂玻璃效果 */
    border-radius: 30px; /* 胶囊圆角 */
    padding: 5px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000; /* 保证在最上层 */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 鼠标悬停整体效果 */
.left-nav-capsule:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

/* 单个按钮样式 */
.nav-capsule-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #555;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.nav-capsule-item:hover {
    background-color: #f0f0f0;
    color: #228be6; /* 悬停变为主题蓝色 */
}

/* 中间的分隔线 */
.nav-capsule-line {
    width: 1px;
    height: 16px;
    background-color: #ddd;
    margin: 0 4px;
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .left-nav-capsule {
        background: rgba(44, 46, 51, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    .nav-capsule-item { color: #aaa; }
    .nav-capsule-item:hover { 
        background-color: rgba(255, 255, 255, 0.1); 
        color: #4dabf7;
    }
    .nav-capsule-line { background-color: #444; }
}