/* Graph Maker フロントエンドスタイル */

.graph-maker-container {
    margin: 20px 0;
    padding: 10px;
    background: #fff;
}

.graph-maker-title {
    margin: 0 0 20px 0;
    padding: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    text-align: center;
    display: block;
}

.graph-maker-canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 300px; /* 最小高さを設定 */
}

.graph-maker-canvas-wrapper canvas {
    max-width: 100%;
    height: auto !important; /* 棒グラフでは高さを自動調整 */
}

/* HTML凡例 */
.graph-maker-html-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    margin: 0 0 10px 0;
}

.graph-maker-html-legend-item {
    display: inline-flex;
    align-items: center;
    white-space: nowrap; /* ラベル途中での改行を防ぐ */
    font-size: 12px;
    color: #333;
}

.graph-maker-html-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.graph-maker-html-legend-label {
    line-height: 1.4;
}

.graph-error {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    margin: 20px 0;
}

/* 凡例の折り返し対応 */
.graph-maker-container canvas {
    max-width: 100%;
}

/* Chart.js凡例の折り返しを強制 */
.graph-maker-container {
    overflow: visible;
}

.graph-maker-canvas-wrapper {
    overflow: visible;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .graph-maker-container {
        padding: 15px;
        margin: 20px 0;
    }
    
    .graph-maker-title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .graph-maker-canvas-wrapper {
        padding: 10px;
        min-height: 250px; /* モバイルでは最小高さを小さく */
    }
}

/* 棒グラフのレスポンシブ対応 */
.graph-maker-canvas-wrapper canvas[data-graph-type="bar"],
.graph-maker-canvas-wrapper canvas[data-graph-type="horizontalBar"] {
    width: 100% !important;
    height: auto !important;
}
