/* Grafik kitaplığı (js/charts.js) stilleri. Renkler app.css belirteçlerinden türetilir. */

:root {
  --chart-grid: #edf1f6;
  --chart-axis: #cbd5e1;
  --chart-text: #64748b;
  --chart-surface: var(--surface, #ffffff);
  --chart-hover: rgba(37, 99, 235, .06);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.chart { position: relative; min-width: 0; }
.chart-plot { position: relative; width: 100%; }
.chart-plot svg { display: block; overflow: visible; touch-action: pan-y; }
.chart svg:focus { outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
.chart text { font-family: var(--font); }
.chart svg.is-clickable { cursor: pointer; }

/* Chrome: hairline grid, recessive axis, muted labels */
.chart-tick { font-size: 11.5px; fill: var(--chart-text); font-variant-numeric: tabular-nums; }
.chart-cat { font-size: 12.5px; fill: var(--text-2); }
.chart-value { font-size: 11.5px; font-weight: 600; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.chart-value-sm { font-size: 11px; font-weight: 550; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart-hover { fill: var(--chart-hover); pointer-events: none; }
.chart-crosshair { stroke: var(--chart-axis); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }

/* Marks */
.chart-bar { pointer-events: none; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; pointer-events: none; }
.chart-area { fill-opacity: .1; stroke: none; pointer-events: none; }
.chart-dot { stroke: var(--chart-surface); stroke-width: 2; pointer-events: none; }
.chart-seg { transition: opacity .12s; }
.chart-seg.has-gap { stroke: var(--chart-surface); stroke-width: 2; stroke-linejoin: round; }
.chart-seg.is-dim { opacity: .28; }
.chart-center-value { font-weight: 700; fill: var(--text); }
.chart-center-label { font-size: 11.5px; fill: var(--chart-text); }

/* Empty state */
.chart-is-empty {
  display: grid; place-items: center; color: var(--faint); font-size: 13px; font-weight: 500;
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.chart-spark-empty { color: var(--faint); font-size: 12px; }

/* Legend */
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chart-legend-label { min-width: 0; }
.chart-legend-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-key { display: inline-block; flex: none; }
.chart-key-rect { width: 10px; height: 10px; border-radius: 3px; }
.chart-key-line { width: 14px; height: 3px; border-radius: 2px; }
.chart-key-dot { width: 9px; height: 9px; border-radius: 50%; }

/* Donut */
.chart-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.chart-donut .chart-plot { flex: 0 0 auto; margin: 0 auto; }
.chart-donut-list { list-style: none; margin: 0; padding: 0; flex: 1 1 170px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chart-donut-item {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 7px; font-size: 13px;
}
.chart-donut-item.is-active { background: var(--surface-3); }
.chart-donut-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.chart-donut-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-donut-pct { color: var(--muted); font-size: 12px; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* Table view toggle */
.chart-tool {
  position: absolute; top: -8px; right: -6px; z-index: 2; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 7px;
  display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .12s, color .12s;
}
.chart:hover .chart-tool, .chart-tool:focus-visible, .chart-tool.active { opacity: 1; }
.chart-tool:hover { color: var(--text); }
.chart-tool:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chart-tool.active { color: var(--primary); border-color: var(--primary); background: var(--primary-50); }
@media (hover: none) { .chart-tool { opacity: .9; } }
.chart-table { max-height: 340px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.chart-data-table th, .chart-data-table td { padding: 7px 10px; font-size: 12.5px; }
.chart-data-table th { position: sticky; top: 0; z-index: 1; }

/* Tooltip (one shared element, position: fixed) */
.chart-tooltip {
  position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; max-width: 300px;
  background: #0f172a; color: #fff; border-radius: 8px; padding: 8px 11px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .08s;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip-title { font-size: 12px; color: #cbd5e1; margin-bottom: 3px; font-weight: 550; }
.chart-tooltip-row { display: flex; align-items: center; gap: 8px; line-height: 1.65; white-space: nowrap; }
.chart-tooltip-row strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-tooltip-row.muted { border-top: 1px solid rgba(255, 255, 255, .14); margin-top: 3px; padding-top: 3px; }
.chart-tooltip-name { color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; }
.chart-tooltip-key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-tooltip-key.is-line { width: 12px; height: 3px; border-radius: 2px; }
.chart-tooltip-key.is-none { background: transparent; }

@media print {
  .chart-tool { display: none; }
}
@media (forced-colors: active) {
  .chart-bar, .chart-seg, .chart-area { forced-color-adjust: none; }
}
