/* ─────────────────────────────────────────────────────────────────────────
 * Zyron CRM — Site Trafik Sayfası
 *
 * Modern dashboard estetiği:
 *   · Sticky header + canlı pulse rozet
 *   · KPI rowu (5 chip)
 *   · İçerik: chart (2/3) + donut+source list (1/3)
 *   · Canlı ziyaretçi listesi (card row stili)
 *   · Top sayfa + referrer rank listeleri
 *
 * Sayfa kendi `.st-*` namespace'ini kullanır, projenin başka modüllerini
 * etkilemez. Tema değişkenlerine (var(--surface-1), var(--text-*) vs.)
 * dayanır; dark/light theme uyumludur.
 * ───────────────────────────────────────────────────────────────────────── */

.st-page {
  --st-radius: 14px;
  --st-radius-sm: 10px;
  --st-border: rgba(255,255,255,0.06);
  --st-border-strong: rgba(255,255,255,0.12);
  --st-surface: var(--color-surface-1, #141415);
  --st-surface-2: var(--color-surface-2, rgba(255,255,255,0.025));
  --st-text-muted: var(--color-text-muted);
  --st-success: #10b981;
  --st-primary: #D7263D;
  --st-info: #3b82f6;
  --st-warn: #f59e0b;
  --st-purple: #a78bfa;
  --st-cyan: #06b6d4;
  --st-pink: #ec4899;

  padding-bottom: 32px;
}

[data-theme="light"] .st-page {
  --st-border: rgba(15,23,42,0.08);
  --st-border-strong: rgba(15,23,42,0.14);
  --st-surface: #ffffff;
  --st-surface-2: rgba(15,23,42,0.02);
  --st-text-muted: rgba(15,23,42,0.55);
}

/* ─── HEADER ──────────────────────────────────────────────────────────── */
.st-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 4px 0 18px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--st-border);
  flex-wrap: wrap;
}
.st-header__left {
  display: flex; align-items: center; gap: 14px;
}
.st-header__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.st-header__sub {
  margin: 2px 0 0 0;
  font-size: 12.5px;
  color: var(--st-text-muted);
}
.st-header__right {
  display: flex; align-items: center; gap: 8px;
}

/* Pulse badge — "CANLI" */
.st-live-pulse {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px 6px 9px;
  background: linear-gradient(135deg, rgba(16,185,129,0.18), rgba(16,185,129,0.06));
  border: 1px solid rgba(16,185,129,0.35);
  border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  color: var(--st-success);
}
.st-live-pulse__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--st-success);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.7);
  animation: stPulse 1.8s ease-out infinite;
}
@keyframes stPulse {
  0%   { box-shadow: 0 0 0 0   rgba(16,185,129,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(16,185,129,0);   }
  100% { box-shadow: 0 0 0 0   rgba(16,185,129,0);   }
}

/* Range tabs */
.st-range {
  display: inline-flex;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.st-range__btn {
  background: transparent; border: 0;
  color: var(--st-text-muted);
  padding: 6px 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.4px;
  cursor: pointer;
  border-radius: 7px;
  transition: background 0.18s, color 0.18s;
}
.st-range__btn:hover { color: var(--color-text-primary); }
.st-range__btn.is-active {
  background: var(--st-primary);
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(215,38,61,0.5);
}

/* Icon button (refresh) */
.st-icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: 10px;
  color: var(--st-text-muted);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.18s, color 0.18s, transform 0.4s;
}
.st-icon-btn:hover { color: var(--color-text-primary); background: var(--st-surface); }
.st-icon-btn:active i { transform: rotate(180deg); }

/* ─── KPI ROW ─────────────────────────────────────────────────────────── */
.st-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 1180px) { .st-kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .st-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 440px)  { .st-kpi-row { grid-template-columns: 1fr; } }

.st-kpi {
  --ico: var(--st-primary);
  display: flex; align-items: center; gap: 12px;
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.st-kpi::before {
  content: '';
  position: absolute; inset: 0 auto auto 0;
  width: 3px; height: 100%;
  background: var(--ico);
  opacity: 0.6;
}
.st-kpi:hover {
  transform: translateY(-2px);
  border-color: var(--st-border-strong);
  box-shadow: 0 10px 30px -12px rgba(0,0,0,0.5);
}
.st-kpi__icon {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ico) 14%, transparent);
  color: var(--ico);
  border-radius: 10px;
  font-size: 20px;
  flex-shrink: 0;
}
.st-kpi__body { min-width: 0; flex: 1; }
.st-kpi__label {
  font-size: 11.5px;
  color: var(--st-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
  margin-bottom: 2px;
}
.st-kpi__value {
  font-size: 24px; font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}
.st-kpi__sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--st-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.st-kpi--live {
  --ico: var(--st-success);
  background: linear-gradient(135deg, var(--st-surface), color-mix(in srgb, var(--st-success) 7%, var(--st-surface)));
}
.st-kpi--live .st-kpi__value { color: var(--st-success); }

/* ─── ROW LAYOUTS ─────────────────────────────────────────────────────── */
.st-row {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.st-row--3-2 {
  grid-template-columns: 2fr 1fr;
}
.st-row--1-1 {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 1100px) {
  .st-row--3-2,
  .st-row--1-1 { grid-template-columns: 1fr; }
}

/* ─── CARD ────────────────────────────────────────────────────────────── */
.st-card {
  background: var(--st-surface);
  border: 1px solid var(--st-border);
  border-radius: var(--st-radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.st-card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--st-border);
  gap: 12px;
  background: var(--st-surface-2);
}
.st-card__title {
  margin: 0;
  font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.2px;
}
.st-card__title i { color: var(--st-primary); font-size: 17px; }
.st-card__count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px;
  padding: 0 7px;
  background: var(--st-primary);
  color: #fff;
  font-size: 11px; font-weight: 700;
  border-radius: 999px;
  margin-left: 6px;
}
.st-card__hint {
  font-size: 11.5px;
  color: var(--st-text-muted);
}
.st-card__legend {
  display: flex; gap: 14px;
  font-size: 11.5px;
  color: var(--st-text-muted);
}
.st-card__legend span {
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.st-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c, var(--st-primary));
  display: inline-block;
}
.st-card__body { padding: 18px; flex: 1; }
.st-card__body--scroll { padding: 6px 0; max-height: 380px; overflow-y: auto; }
.st-card__body--list   { padding: 0; }

/* "Live" yanındaki canlı nokta (card title içinde) */
.st-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--st-success);
  display: inline-block;
  margin-right: 4px;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.2);
  animation: stPulse 1.8s ease-out infinite;
}

/* ─── CHART ───────────────────────────────────────────────────────────── */
.st-card--chart .st-card__body { padding: 14px 12px 12px 12px; }
.st-chart-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}
.st-chart-wrap canvas { width: 100%; height: 100%; display: block; }

.st-chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(20,20,22,0.96);
  border: 1px solid var(--st-border-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 11.5px;
  color: #f1f5f9;
  white-space: nowrap;
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 5;
}
.st-chart-tooltip.is-visible { opacity: 1; }
.st-chart-tooltip__day {
  font-weight: 700; color: #fff;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.st-chart-tooltip__row {
  display: flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.st-chart-tooltip__row b { color: #fff; }

.st-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--st-text-muted);
  font-size: 13px;
  gap: 8px;
}
.st-empty i { font-size: 36px; opacity: 0.35; }
.st-empty p { margin: 0; }

/* ─── DONUT + SOURCE LIST ─────────────────────────────────────────────── */
.st-donut-wrap {
  position: relative;
  width: 180px; height: 180px;
  margin: 0 auto 16px auto;
}
.st-donut-wrap canvas { display: block; }
.st-donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.st-donut-center__val {
  font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.st-donut-center__lbl {
  font-size: 11px;
  color: var(--st-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-top: 4px;
}

.st-source-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.st-source-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 10px;
  padding: 8px 10px;
  background: var(--st-surface-2);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.st-source-row:hover {
  background: var(--st-surface);
  border-color: var(--st-border);
}
.st-source-row__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.st-source-row__main {
  min-width: 0;
}
.st-source-row__lbl {
  font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.st-source-row__sub {
  font-size: 11px;
  color: var(--st-text-muted);
  margin-top: 1px;
}
.st-source-row__val {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.st-source-row__val b {
  font-size: 13px;
}
.st-source-row__val small {
  display: block;
  font-size: 10.5px;
  color: var(--st-text-muted);
  margin-top: 1px;
}

/* ─── LIVE VISITORS LIST (card row stili, tablo değil) ────────────────── */
.st-live-list {
  display: flex; flex-direction: column;
}
.st-live-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  align-items: center;
  column-gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--st-border);
  transition: background 0.15s;
}
.st-live-row:last-child { border-bottom: 0; }
.st-live-row:hover { background: var(--st-surface-2); }
@media (max-width: 900px) {
  .st-live-row {
    grid-template-columns: auto 1fr auto;
    row-gap: 4px;
  }
  .st-live-row__source,
  .st-live-row__device,
  .st-live-row__time { grid-column: 2; justify-self: start; }
}

.st-live-row__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  position: relative;
}
.st-live-row__avatar--cust {
  background: linear-gradient(135deg, var(--st-primary), #FF4D6D);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(215,38,61,0.55);
}
.st-live-row__avatar--guest {
  background: var(--st-surface-2);
  color: var(--st-text-muted);
  border: 1px solid var(--st-border);
}
.st-live-row__avatar--bot {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.st-live-row__avatar--bot::after {
  background: #f59e0b !important;
}
.st-bot-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.2px;
}
.st-live-row__avatar::after {
  content: '';
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px;
  background: var(--st-success);
  border-radius: 50%;
  border: 2px solid var(--st-surface);
}

.st-live-row__who {
  display: flex; flex-direction: column;
  min-width: 0;
}
.st-live-row__name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-live-row__name a {
  color: var(--color-text-primary);
  text-decoration: none;
}
.st-live-row__name a:hover { color: var(--st-primary); }
.st-live-row__name .st-conv-pill {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: 6px;
  padding: 1px 7px;
  background: rgba(16,185,129,0.15);
  color: var(--st-success);
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
}
.st-live-row__path {
  font-size: 11.5px;
  color: var(--st-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
  font-family: ui-monospace, monospace;
}

.st-live-row__source,
.st-live-row__device,
.st-live-row__time {
  font-size: 11.5px;
  color: var(--st-text-muted);
}
.st-live-row__time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.st-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  color: var(--st-text-muted);
  white-space: nowrap;
}
.st-pill--direct   { background: color-mix(in srgb, #9ca3af 14%, transparent); color: #d1d5db; border-color: transparent; }
.st-pill--organic  { background: color-mix(in srgb, var(--st-success) 14%, transparent); color: var(--st-success); border-color: transparent; }
.st-pill--social   { background: color-mix(in srgb, var(--st-info)    14%, transparent); color: var(--st-info);    border-color: transparent; }
.st-pill--paid     { background: color-mix(in srgb, var(--st-warn)    14%, transparent); color: var(--st-warn);    border-color: transparent; }
.st-pill--email    { background: color-mix(in srgb, var(--st-purple)  14%, transparent); color: var(--st-purple);  border-color: transparent; }
.st-pill--campaign { background: color-mix(in srgb, var(--st-pink)    14%, transparent); color: var(--st-pink);    border-color: transparent; }
.st-pill--referral { background: color-mix(in srgb, var(--st-cyan)    14%, transparent); color: var(--st-cyan);    border-color: transparent; }

.st-live-row__action {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--st-text-muted);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.st-live-row__action:hover {
  background: var(--st-surface);
  color: var(--color-text-primary);
  border-color: var(--st-border);
}

.st-live-empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--st-text-muted);
}
.st-live-empty i { font-size: 40px; opacity: 0.3; display: block; margin-bottom: 10px; }
.st-live-empty p { margin: 4px 0; font-size: 13px; }
.st-live-empty p.text-sm { font-size: 11.5px; opacity: 0.7; }

/* ─── RANK LIST (top paths + referrers) ──────────────────────────────── */
.st-rank-list {
  list-style: none; margin: 0; padding: 0;
}
.st-rank-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 12px;
  padding: 9px 18px;
  border-bottom: 1px solid var(--st-border);
  transition: background 0.12s;
}
.st-rank-row:last-child { border-bottom: 0; }
.st-rank-row:hover { background: var(--st-surface-2); }
.st-rank-row__num {
  width: 22px; text-align: center;
  font-size: 11px; font-weight: 700;
  color: var(--st-text-muted);
  font-variant-numeric: tabular-nums;
}
.st-rank-row__main { min-width: 0; }
.st-rank-row__main a {
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: 13px;
  font-family: ui-monospace, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}
.st-rank-row__main a:hover { color: var(--st-primary); }
.st-rank-row__main b {
  font-size: 13px; font-weight: 600;
  display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.st-rank-row__sub {
  font-size: 11px;
  color: var(--st-text-muted);
  margin-top: 1px;
}
.st-rank-row__val {
  font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 600;
  text-align: right;
  min-width: 50px;
}

.st-rank-bar {
  height: 3px;
  margin-top: 5px;
  background: var(--st-surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.st-rank-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--st-primary), #FF4D6D);
  border-radius: 999px;
  transition: width 0.4s ease-out;
}

/* ─── Empty state for cards ───────────────────────────────────────────── */
.st-rank-empty,
.st-source-empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--st-text-muted);
  font-size: 12.5px;
}

/* ─── Faz 1B hint stripe ──────────────────────────────────────────────── */
.st-faz-hint {
  margin-top: 14px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(66,133,244,0.06), rgba(234,67,53,0.04));
  border: 1px dashed var(--st-border-strong);
  border-radius: 10px;
  font-size: 12.5px;
}
.st-faz-hint i {
  font-size: 22px;
  color: #ea4335;
  flex-shrink: 0;
}
.st-faz-hint > div { display: flex; flex-direction: column; gap: 2px; }
.st-faz-hint strong { font-size: 13px; }
.st-faz-hint .text-muted { font-size: 11.5px; }
.st-faz-hint a { color: var(--st-primary); }

/* ─── Session detail modal ───────────────────────────────────────────── */
.st-session-meta {
  background: var(--st-surface-2);
  border: 1px solid var(--st-border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.st-session-meta__row {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.st-session-meta__row .label {
  color: var(--st-text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 70px;
}
.st-session-meta__row code {
  background: rgba(0,0,0,0.3);
  padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
}

.st-session-section {
  margin-top: 18px;
  font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}
.st-session-section i { color: var(--st-primary); }

.st-journey {
  margin-top: 12px;
  list-style: none; padding: 0;
  position: relative;
}
.st-journey::before {
  content: '';
  position: absolute;
  left: 8px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--st-border);
}
.st-journey-item {
  position: relative;
  padding: 6px 0 12px 28px;
  font-size: 12.5px;
}
.st-journey-item::before {
  content: '';
  position: absolute;
  left: 5px; top: 11px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--st-primary);
  box-shadow: 0 0 0 3px var(--st-surface);
}
.st-journey-time {
  font-variant-numeric: tabular-nums;
  color: var(--st-text-muted);
  font-size: 11px;
}
.st-journey-path {
  font-weight: 600;
  font-family: ui-monospace, monospace;
}
.st-journey-title {
  color: var(--st-text-muted);
  font-size: 11.5px;
}
.st-journey-dur {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--st-surface-2);
  border-radius: 4px;
  font-size: 10.5px;
  color: var(--st-text-muted);
}

/* ─── Sidebar badge tweak ─────────────────────────────────────────────── */
.nav-item[data-page="site-traffic"] .count-badge {
  background: var(--st-success);
  color: #fff;
}
.nav-item[data-page="site-traffic"] .count-badge:empty { display: none; }
