/* 状态概率柱状图样式 */

/* 主容器 */
.state-chart {
    margin-top: 20px;
    padding: 10px 4px 20px 4px;
    flex: 1 1 auto;
    min-height: 340px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;

    --state-bar-label-color: #fff;
    --state-axis-color: #fff;
    --state-axis-text-color: #fff;
    --state-tick-font-size: 15px;
    --state-tooltip-bg: #fff;
    --state-tooltip-border: rgba(0,0,0,0.12);
}

/* 布局容器 */
.state-chart-layout {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* Y轴区域 */
.state-axis-area {
    flex: 0 0 auto;
    min-width: 0;
    height: 100%;
    background: transparent;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 2;
    overflow: visible;
    padding-right: 0;
    /* axis panel width is set by JS via CSS variable */
    flex: 0 0 var(--state-axis-panel-width, 56px);
    width: var(--state-axis-panel-width, 56px);
    min-width: var(--state-axis-panel-width, 56px);
}

.state-axis-area svg {
    overflow: visible;
}

/* 图表区域 */
.state-bars-scroll {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: -3px;
    padding-bottom: var(--state-scrollbar-reserve, 14px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-gutter: stable both-edges;
}

.state-bars-track {
    display: block;
    min-width: 100%;
}

/* 使图表的滚动条样式与代码编辑器一致 */
.state-bars-scroll::-webkit-scrollbar {
    height: 10px;
    width: 8px;
}
.state-bars-scroll::-webkit-scrollbar-track {
    background: transparent !important;
}
.state-bars-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.5) !important;
    border-radius: 6px;
}
.state-bars-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}
.state-bars-scroll::-webkit-scrollbar-corner {
    background: transparent !important;
}

/* SVG样式 */
.state-chart-svg {
    display: block;
    max-width: none;
    height: auto;
}

.state-chart svg {
    max-width: none;
    height: auto;
    display: block;
}

/* 坐标轴 */
.axis path,
.axis line {
    stroke: var(--state-axis-color, #ccc);
    stroke-width: 1px;
}

.axis text {
    fill: var(--state-axis-text-color, #666);
    font-size: var(--state-tick-font-size, 12px);
    font-family: 'Alibaba PuHuiTi', 'Alibaba PuHuiTi Subset', 'Noto Sans SC', sans-serif;
}

/* X轴特殊样式 */
.x-axis text {
    text-anchor: middle;
}

.state-chart .x-axis text {
    dominant-baseline: hanging;
}

/* Y轴特殊样式 */
.y-axis text {
    font-size: 13px;
}

/* 柱状图样式 */
.state-bar {
    fill: var(--state-bar-fill, #00BEA7);
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.state-bar:hover {
    opacity: 0.8;
}

.state-chart .bar {
    fill: var(--state-bar-fill, #00BEA7);
}

/* 顶端标签 */
.bar-label {
    fill: var(--state-bar-label-color);
    font-size: 24px;
    font-family: 'Alibaba PuHuiTi', 'Alibaba PuHuiTi Subset', 'Noto Sans SC', sans-serif;
    font-weight: 600;
    text-anchor: middle;
    pointer-events: none;
}

.state-chart .bar-label {
    fill: var(--state-bar-label-color);
    font-size: 18px;
    font-weight: 600;
}

/* Alternate bar colors */
.state-chart .bar:nth-of-type(odd) {
    fill: #00BEA7;
}
.state-chart .bar:nth-of-type(even) {
    fill: #ffffff;
}

.state-chart .axis text {
    fill: var(--state-axis-color);
    font-size: var(--state-tick-font-size);
}

.state-chart .axis path,
.state-chart .axis line {
    stroke: var(--state-axis-color);
}

.state-chart .y-axis-total-label {
    fill: var(--state-axis-text-color);
    font-size: 13px;
    font-weight: 600;
}

.state-chart .state-tooltip {
    position: absolute;
    visibility: hidden;
    background: var(--state-tooltip-bg);
    border: 1px solid var(--state-tooltip-border);
    padding: 6px;
    font-size: 12px;
    pointer-events: none;
    border-radius: 4px;
}

/* Tooltip 由 JS 动态生成，基础样式已在 .state-tooltip 中定义 */
