/* ==========================================================================
   STITCH v2 — Bileşen Katmanı (Faz 39)
   --------------------------------------------------------------------------
   Stitch (Material 3) tasarımlarını build'siz vanilla app'e taşıyan paylaşılan
   sınıflar. TÜM renkler mevcut Aurora token'larından (tokens.css) türetilir —
   sabit hex YOK → tenant --primary ile white-label + dark/light otomatik korunur.
   tokens.css + style.css + components.css'ten SONRA yüklenir.
   ========================================================================== */

/* ---- Material 3 rol köprüsü (Stitch isimleri → Aurora token; sabit hex yok) ---- */
.v2-scope, .v2-shell {
  --m3-primary: var(--primary-600);
  --m3-primary-container: var(--primary-100);
  --m3-on-primary: var(--on-primary, #fff);
  --m3-surface: var(--surface-1);
  --m3-surface-low: var(--surface-2);
  --m3-surface-lowest: var(--surface-1);
  --m3-bg: var(--background);
  --m3-tertiary: var(--success);
  --m3-secondary: var(--accent);
}

/* ---- Uygulama kabuğu: sidenav + içerik ---- */
.v2-shell { display: flex; min-height: 100dvh; background: var(--background); color: var(--text-1); }

/* ---- Sol navigasyon (masaüstü sabit, mobilde gizli) ---- */
.v2-sidenav {
  width: 256px; flex: none; position: sticky; top: 0; align-self: flex-start;
  height: 100dvh; display: flex; flex-direction: column;
  background: var(--surface-1); border-right: 1px solid var(--border-1); z-index: var(--z-nav);
}
.v2-sidenav__brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border-1); }
.v2-sidenav__logo { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--aurora-gradient);
  display: grid; place-items: center; color: #fff; font-weight: var(--weight-extra); font-size: 1.1rem; box-shadow: var(--aurora-glow); }
.v2-sidenav__title { font-weight: var(--weight-extra); font-size: var(--text-lg); color: var(--text-1); letter-spacing: -.02em; line-height: 1.1; }
.v2-sidenav__sub { font-size: var(--text-xs); color: var(--text-2); }
.v2-sidenav__nav { flex: 1; overflow-y: auto; padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); }
.v2-navlink { display: flex; align-items: center; gap: var(--space-3); padding: .7rem var(--space-4); border-radius: var(--radius-md);
  color: var(--text-2); font-weight: var(--weight-semibold); font-size: var(--text-sm); text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.v2-navlink i { width: 1.25rem; text-align: center; font-size: 1.05rem; }
.v2-navlink:hover { background: var(--surface-2); color: var(--text-1); }
.v2-navlink.is-active { background: var(--primary-100); color: var(--primary-700); }
body:not(.light-theme) .v2-navlink.is-active { background: rgba(var(--primary-rgb), .18); color: var(--primary-300); }
.v2-sidenav__cta { padding: var(--space-4); border-top: 1px solid var(--border-1); }

/* ---- Ana içerik + üst bar ---- */
.v2-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.v2-topbar { position: sticky; top: 0; z-index: var(--z-raised);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  height: 64px; padding: 0 var(--space-6);
  background: var(--glass-bg); -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)); border-bottom: 1px solid var(--glass-border); }
.v2-topbar__title { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-1); }
.v2-iconbtn { width: 40px; height: 40px; border-radius: var(--radius-full); border: none; background: transparent;
  color: var(--text-2); display: grid; place-items: center; cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.v2-iconbtn:hover { background: var(--surface-2); color: var(--text-1); }
.v2-avatar { width: 40px; height: 40px; border-radius: var(--radius-full); object-fit: cover; border: 2px solid var(--surface-1);
  background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); font-weight: var(--weight-bold); }

/* ---- Sayfa gövdesi ---- */
.v2-page { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-6); }
.v2-page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.v2-page-head h1 { font-size: var(--text-2xl); font-weight: var(--weight-extra); color: var(--text-1); line-height: var(--leading-tight); letter-spacing: -.02em; }
.v2-page-head p { color: var(--text-2); margin-top: .2rem; }
.v2-page-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---- Bento ızgara + kart ---- */
.v2-bento { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.v2-card { background: var(--surface-1); border: 1px solid var(--border-1); border-radius: var(--radius-xl, 1.25rem);
  box-shadow: var(--elev-card); padding: var(--space-5); }
.v2-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.v2-card__title { font-size: var(--text-lg); font-weight: var(--weight-bold); color: var(--text-1); display: flex; align-items: center; gap: .5rem; }

/* ---- Metrik kartı ---- */
.v2-metric { --mc: var(--primary); background: var(--surface-1); border: 1px solid var(--border-1);
  border-radius: var(--radius-xl, 1.25rem); box-shadow: var(--elev-card); padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-4); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out); }
.v2-metric:hover { transform: translateY(-2px); box-shadow: var(--elev-3); }
.v2-metric__top { display: flex; align-items: flex-start; justify-content: space-between; }
.v2-metric__icon { width: 48px; height: 48px; border-radius: var(--radius-full); display: grid; place-items: center;
  font-size: 1.3rem; color: var(--mc); background: color-mix(in srgb, var(--mc) 14%, transparent); }
.v2-metric__delta { display: inline-flex; align-items: center; gap: .25rem; font-size: var(--text-xs); font-weight: var(--weight-bold);
  padding: .2rem .5rem; border-radius: var(--radius-sm); }
.v2-metric__delta.up { color: var(--success-fg); background: var(--success-bg); }
.v2-metric__delta.down { color: var(--danger-fg); background: var(--danger-bg); }
.v2-metric__delta.flat { color: var(--text-2); background: var(--surface-2); }
.v2-metric__label { font-size: var(--text-sm); color: var(--text-2); font-weight: var(--weight-semibold); }
.v2-metric__value { font-size: var(--text-2xl); font-weight: var(--weight-extra); color: var(--text-1); line-height: 1.1; margin-top: .15rem; }

/* ---- CSS bar grafik (bağımlılıksız) ---- */
.v2-bars { display: flex; align-items: flex-end; justify-content: space-around; gap: var(--space-2); height: 260px; padding-top: var(--space-4); }
.v2-bars__col { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); flex: 1; max-width: 48px; }
.v2-bars__pair { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 200px; }
.v2-bars__bar { flex: 1; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: height var(--dur-slow) var(--ease-out); }
.v2-bars__bar.cur { background: var(--primary); }
.v2-bars__bar.prev { background: var(--surface-3); }
.v2-bars__x { font-size: var(--text-xs); color: var(--text-2); font-weight: var(--weight-semibold); }
.v2-legend { display: flex; justify-content: center; gap: var(--space-5); margin-top: var(--space-4); font-size: var(--text-sm); color: var(--text-2); }
.v2-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.v2-legend i { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; }

/* ---- Canlı aktivite akışı ---- */
.v2-feed { display: flex; flex-direction: column; }
.v2-feed-item { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-2); border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease-out); }
.v2-feed-item:hover { background: var(--surface-2); }
.v2-feed-item + .v2-feed-item { border-top: 1px solid var(--border-1); }
.v2-feed__icon { --fc: var(--primary); width: 40px; height: 40px; flex: none; border-radius: var(--radius-full);
  display: grid; place-items: center; color: var(--fc); background: color-mix(in srgb, var(--fc) 14%, transparent); }
.v2-feed__body { min-width: 0; }
.v2-feed__meta { display: flex; align-items: center; gap: .5rem; margin-top: .25rem; font-size: var(--text-xs); color: var(--text-2); }
.v2-live-dot { position: relative; width: 10px; height: 10px; }
.v2-live-dot::before, .v2-live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--success); }
.v2-live-dot::before { animation: v2-ping 1.4s cubic-bezier(0,0,.2,1) infinite; }
@keyframes v2-ping { 75%, 100% { transform: scale(2.2); opacity: 0; } }

/* ---- Veri tablosu ---- */
.v2-table-wrap { overflow-x: auto; border: 1px solid var(--border-1); border-radius: var(--radius-lg); }
.v2-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.v2-table th { text-align: left; padding: var(--space-3) var(--space-4); background: var(--surface-2); color: var(--text-2);
  font-weight: var(--weight-bold); position: sticky; top: 0; white-space: nowrap; }
.v2-table td { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border-1); color: var(--text-1); }
.v2-table tbody tr:hover { background: var(--surface-2); }
.v2-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Segment/sekme şeridi ---- */
.v2-tabs { display: inline-flex; gap: .25rem; background: var(--surface-2); padding: .3rem; border-radius: var(--radius-full); }
.v2-tab { border: none; background: transparent; padding: .5rem 1rem; border-radius: var(--radius-full); cursor: pointer;
  font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--text-2); }
.v2-tab.is-active { background: var(--surface-1); color: var(--primary-700); box-shadow: var(--elev-1); }

/* ---- Mobil: sidenav gizlenir, içerik tam genişlik ---- */
@media (max-width: 768px) {
  .v2-sidenav { display: none; }
  .v2-page { padding: var(--space-4); }
  .v2-topbar { padding: 0 var(--space-4); }
}
