/* グラフ表示用CSS */

.chart-container {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    height: 100vh;
    overflow-y: auto;
}

.chart-container h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    font-size: 1.3rem;
    border-bottom: 2px solid #17a2b8;
    padding-bottom: 0.5rem;
}

.chart-section {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-section h4 {
    margin: 0 0 1rem 0;
    color: #555;
    font-size: 1rem;
}

.chart {
    min-height: 120px;
}

/* 棒グラフ */
.bar-chart {
    display: flex;
    align-items: end;
    gap: 8px;
    height: 120px;
    padding: 10px 0;
}

.bar-chart.small {
    height: 80px;
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bar {
    background: linear-gradient(to top, #17a2b8, #20c997);
    border-radius: 3px 3px 0 0;
    min-height: 4px;
    width: 100%;
    transition: all 0.3s ease;
}

.bar:hover {
    opacity: 0.8;
}

.feedback-bar {
    background: linear-gradient(to top, #fd7e14, #ffc107);
}

.bar-label {
    font-size: 0.7rem;
    color: #666;
    text-align: center;
}

.bar-value {
    font-size: 0.8rem;
    font-weight: bold;
    color: #333;
}

/* 円グラフ風 */
.pie-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1rem;
}

.pie-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.pie-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.chat-color {
    background: #007bff;
}

.bot-color {
    background: #6f42c1;
}

.pie-visual {
    height: 60px;
    background: linear-gradient(to right, #007bff 0%, #007bff 65%, #6f42c1 65%, #6f42c1 100%);
    border-radius: 30px;
    position: relative;
    overflow: hidden;
}

/* 線グラフ風 */
.line-chart {
    display: flex;
    align-items: end;
    gap: 4px;
    height: 100px;
    padding: 10px 0;
}

.line-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.line-bar {
    background: linear-gradient(to top, #28a745, #20c997);
    border-radius: 2px;
    width: 8px;
    min-height: 2px;
}

.line-label {
    font-size: 0.6rem;
    color: #666;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

/* 解決率グラフ */
.resolution-chart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.resolution-bar {
    display: flex;
    height: 40px;
    border-radius: 20px;
    overflow: hidden;
    background: #e9ecef;
}

.resolved-bar {
    background: linear-gradient(to right, #28a745, #20c997);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.not-resolved-bar {
    background: linear-gradient(to right, #dc3545, #fd7e14);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.resolution-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.resolved-color {
    background: #28a745;
}

.not-resolved-color {
    background: #dc3545;
}

/* 理由チャート */
.reason-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reason-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #17a2b8;
}

.reason-name {
    font-size: 0.8rem;
    color: #333;
}

.reason-count {
    font-weight: bold;
    color: #17a2b8;
    font-size: 0.9rem;
}

/* 人気FAQランキング */
.top-faq-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.rank-number {
    background: #17a2b8;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.faq-question {
    flex: 1;
    font-size: 0.8rem;
    color: #333;
}

.faq-count {
    font-weight: bold;
    color: #17a2b8;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* トレンドチャート */
.trend-chart {
    display: flex;
    align-items: end;
    gap: 6px;
    height: 100px;
    padding: 10px 0;
}

.trend-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.trend-bar {
    background: linear-gradient(to top, #6f42c1, #e83e8c);
    border-radius: 3px 3px 0 0;
    width: 100%;
    min-height: 4px;
}

.trend-label {
    font-size: 0.7rem;
    color: #666;
}

.trend-value {
    font-size: 0.7rem;
    font-weight: bold;
    color: #333;
}

/* カテゴリチャート */
.category-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-name {
    font-size: 0.8rem;
    color: #333;
    font-weight: 500;
}

.category-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-bar {
    background: linear-gradient(to right, #fd7e14, #ffc107);
    height: 20px;
    border-radius: 10px;
    min-width: 20px;
    transition: all 0.3s ease;
}

.category-count {
    font-size: 0.8rem;
    font-weight: bold;
    color: #333;
    min-width: 30px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .chart-container {
        height: auto;
        max-height: 70vh;
    }
    
    .bar-chart {
        height: 80px;
    }
    
    .line-chart {
        height: 60px;
    }
    
    .trend-chart {
        height: 60px;
    }
}

/* KPIカード */
.kpi-row{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:16px}
.kpi-card{background:#fff;border-radius:14px;padding:18px;box-shadow:0 1px 4px rgba(0,0,0,.04);position:relative}
.kpi-label{font-size:11px;color:#9ca3af;font-weight:500}
.kpi-val{font-size:28px;font-weight:800;color:#111827;margin:2px 0}
.kpi-sub{font-size:11px;color:#9ca3af}
.kpi-bar{height:3px;background:#f1f5f9;border-radius:2px;margin-top:10px;overflow:hidden}
.kpi-bar-fill{height:100%;border-radius:2px}
.kpi-donut{display:flex;align-items:center;gap:14px}
.kpi-donut-info{flex:1}
.kpi-legend{display:flex;flex-direction:column;gap:3px;margin-top:6px}
.kpi-legend-item{display:flex;align-items:center;gap:5px;font-size:10px;color:#6b7280}
.kpi-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}
.kpi-help{position:absolute;top:12px;right:12px;width:18px;height:18px;border-radius:50%;background:#f1f5f9;display:flex;align-items:center;justify-content:center;cursor:help;font-size:10px;color:#9ca3af;font-weight:700;transition:background .15s}
.kpi-help:hover{background:#e2e8f0;color:#475569}
.kpi-tip{display:none;position:absolute;top:24px;right:0;background:#1e293b;color:#f1f5f9;font-size:11px;font-weight:400;padding:8px 12px;border-radius:8px;width:220px;line-height:1.5;box-shadow:0 4px 12px rgba(0,0,0,.15);z-index:10}
.kpi-tip::before{content:'';position:absolute;top:-5px;right:6px;width:10px;height:10px;background:#1e293b;transform:rotate(45deg)}
.kpi-help:hover .kpi-tip{display:block}
