/* =============================================================
   Trendmetrik · Grafik Paneli Sistemi
   KPI kartlarıyla aynı dil — donut, alan-çizgi, çubuk, canlı, gauge
   ============================================================= */

:root {
  --ch-line: #e7ebf1;
  --ch-line-2: #eef1f6;
  --ch-ink: #0f172a;
  --ch-ink-2: #475569;
  --ch-mute: #94a3b8;
  --ch-faint: #cbd5e1;
  --ch-c1: #0175e4;
  --ch-c2: #fd751f;
  --ch-c3: #16a34a;
  --ch-c4: #73b7fe;
  --ch-c5: #8b5cf6;
  --ch-c6: #f59e0b;
  --ch-c7: #dc2626;
}

/* ===== Stage / shell (shared with KPI page) ===== */
.ch-stage {
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f4f6fa 240px), #f4f6fa;
  background-attachment: fixed;
}
.ch-shell { max-width: 1320px; margin: 0 auto; padding: 30px 28px 64px; }

.ch-topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.ch-brand { display: flex; align-items: center; gap: 11px; }
.ch-brand img { width: 30px; height: 30px; }
.ch-brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--ch-ink); }
.ch-kicker { font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-size: 15px; color: var(--ch-ink-2); margin-bottom: 1px; }
.ch-title { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; color: var(--ch-ink); line-height: 1.1; }

.ch-tabs { display: inline-flex; padding: 3px; gap: 2px; background: #eef1f6; border: 1px solid var(--ch-line); border-radius: 10px; }
.ch-tab { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border: 0; background: transparent; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ch-ink-2); letter-spacing: -0.01em; transition: color 150ms ease; }
.ch-tab i { width: 15px; height: 15px; }
.ch-tab:hover { color: var(--ch-ink); }
.ch-tab.active { background: #fff; color: var(--ch-ink); box-shadow: 0 1px 2px rgba(15,23,42,0.06); }
.ch-tab.active.live { color: var(--color-primary-hover); }
.ch-tab .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ch-c7); }
.ch-tab.active.live .live-dot { animation: chPulse 1.4s ease-in-out infinite; }

/* ===== Grid ===== */
.ch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: start; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }

/* ===== Panel chassis ===== */
.ch-panel {
  background: #fff;
  border: 1px solid var(--ch-line);
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  display: flex; flex-direction: column;
  min-width: 0;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}
.ch-panel:hover { box-shadow: 0 6px 20px rgba(15,23,42,0.07); border-color: #dbe5ef; }
.ch-panel.enter { opacity: 1; }

.ch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ch-head-l { min-width: 0; }
.ch-h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--ch-ink); display: flex; align-items: center; gap: 8px; }
.ch-h3 .live-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 7px;
  border-radius: 999px; background: #fee2e2; color: #b91c1c;
  font-family: "JetBrains Mono", monospace; font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em;
}
.ch-h3 .live-badge .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ch-c7); animation: chPulse 1.4s ease-in-out infinite; }
.ch-sub { font-size: 12px; color: var(--ch-mute); margin-top: 3px; }
.ch-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ch-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 7px;
  padding: 5px 9px; font-size: 12px; font-weight: 500; color: var(--ch-ink-2);
  transition: all 150ms ease;
}
.ch-chip:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--ch-ink); }
.ch-chip.active { background: var(--color-primary-soft); border-color: #bfdcff; color: var(--color-primary-hover); }
.ch-chip i { width: 12px; height: 12px; }
.ch-seg { display: inline-flex; background: #f1f5f9; border-radius: 7px; padding: 2px; gap: 2px; }
.ch-seg button { border: 0; background: transparent; padding: 4px 9px; border-radius: 5px; font-size: 11.5px; font-weight: 600; color: var(--ch-ink-2); transition: all 130ms ease; }
.ch-seg button.on { background: #fff; color: var(--ch-ink); box-shadow: 0 1px 2px rgba(15,23,42,0.08); }

.numeric { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

@keyframes chPulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .4; transform: scale(.7);} }

/* ===== Chart body shared ===== */
.ch-body { position: relative; }
.ch-svg { display: block; width: 100%; overflow: visible; }
.ch-grid-line { stroke: var(--ch-line); stroke-width: 1; }
.ch-grid-line.zero { stroke: #dbe5ef; }
.ch-axis-x text, .ch-axis-y text { font-family: "Inter", sans-serif; font-size: 11px; fill: var(--ch-mute); }
.ch-axis-y text { font-family: "JetBrains Mono", monospace; }

/* tooltip */
.ch-tip {
  position: absolute; transform: translate(-50%, -100%);
  background: #0f172a; color: #fff; padding: 8px 10px; border-radius: 8px;
  pointer-events: none; z-index: 8; white-space: nowrap;
  box-shadow: 0 8px 24px rgba(15,23,42,0.22);
  opacity: 0; transition: opacity 110ms ease;
}
.ch-body.hovering .ch-tip { opacity: 1; }
.ch-tip::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #0f172a; border-bottom: 0; }
.ch-tip-t { font-size: 10.5px; color: rgba(255,255,255,0.6); font-weight: 500; margin-bottom: 3px; letter-spacing: 0.02em; }
.ch-tip-rows { display: flex; flex-direction: column; gap: 3px; }
.ch-tip-row { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.ch-tip-row .dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.ch-tip-row .k { color: rgba(255,255,255,0.78); }
.ch-tip-row .v { font-family: "JetBrains Mono", monospace; font-weight: 600; margin-left: auto; padding-left: 12px; }
.ch-cross { stroke: var(--ch-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.ch-cross-dot { stroke: #fff; stroke-width: 2; }

/* ===== Legend ===== */
.ch-legend { list-style: none; display: flex; flex-direction: column; gap: 9px; margin: 0; padding: 0; }
.ch-legend.row { flex-direction: row; flex-wrap: wrap; gap: 10px 18px; }
.ch-legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; cursor: default; transition: opacity 130ms ease; min-width: 0; }
.ch-legend.row li { display: inline-flex; gap: 7px; }
.ch-legend li.dim { opacity: 0.35; }
.ch-legend .dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.ch-legend .nm { font-size: 13px; color: #1e293b; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-legend .vl { font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 600; color: var(--ch-ink); }
.ch-legend .sh { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ch-mute); width: 52px; text-align: right; }

/* ===== Donut ===== */
.ch-donut-wrap { display: flex; align-items: center; gap: 22px; min-width: 0; }
.ch-donut-wrap .ch-legend { min-width: 0; }
.ch-donut { flex-shrink: 0; }
.ch-donut-seg { transition: opacity 130ms ease, stroke-width 130ms ease; cursor: pointer; }
.ch-donut-seg.dim { opacity: 0.25; }
.ch-donut-center-v { font-family: "JetBrains Mono", monospace; font-weight: 600; fill: var(--ch-ink); }
.ch-donut-center-l { font-family: "Inter", sans-serif; font-weight: 500; fill: var(--ch-mute); }

/* ===== Bars ===== */
.ch-bar { transition: opacity 130ms ease; cursor: pointer; }
.ch-bar-col:hover .ch-bar { opacity: 0.85; }
.ch-bar-val { font-family: "JetBrains Mono", monospace; font-size: 11px; fill: var(--ch-ink-2); font-weight: 600; }
.ch-bar-xlabel { font-family: "Inter", sans-serif; font-size: 11px; fill: var(--ch-mute); }

/* ===== Ranking (horizontal) ===== */
.ch-rank { display: flex; flex-direction: column; gap: 13px; }
.ch-rank-row { display: grid; grid-template-columns: 20px 1fr; gap: 11px; align-items: center; }
.ch-rank-no { font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 600; color: var(--ch-mute); text-align: right; }
.ch-rank-main { min-width: 0; }
.ch-rank-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.ch-rank-nm { font-size: 13px; font-weight: 500; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-rank-vl { font-family: "JetBrains Mono", monospace; font-size: 12.5px; font-weight: 600; color: var(--ch-ink); flex-shrink: 0; }
.ch-rank-track { height: 8px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.ch-rank-fill { height: 100%; border-radius: 999px; transition: width 900ms cubic-bezier(.22,1,.36,1); }

/* ===== Gauge ===== */
.ch-gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.ch-gauge-v { font-family: "JetBrains Mono", monospace; font-weight: 600; fill: var(--ch-ink); }
.ch-gauge-l { font-family: "Inter", sans-serif; font-weight: 500; fill: var(--ch-mute); }

/* ===== Live stream extras ===== */
.ch-live-dot-end { filter: drop-shadow(0 0 0 rgba(1,117,228,0.4)); }
.ch-stat-row { display: flex; gap: 22px; margin-top: 4px; }
.ch-stat { display: flex; flex-direction: column; gap: 2px; }
.ch-stat .l { font-size: 11px; color: var(--ch-mute); font-weight: 500; }
.ch-stat .v { font-family: "JetBrains Mono", monospace; font-size: 17px; font-weight: 600; color: var(--ch-ink); }
.ch-stat .v.up { color: var(--ch-c3); }
.ch-stat .v.down { color: var(--ch-c7); }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .ch-grid { grid-template-columns: repeat(2, 1fr); }
  .span-6, .span-4, .span-3, .span-2 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .ch-shell { padding: 22px 16px 48px; }
  .ch-grid { grid-template-columns: 1fr; }
  .span-6, .span-4, .span-3, .span-2 { grid-column: span 1; }
}
