/* =====================================================================
   AdaKolay AdminPortal — Tasarım sistemi
   Katman 2: Uygulama kabuğu, kenar çubuğu, paneller, giriş ekranı

   modernist.css'ten sonra yüklenir; tokenları oradan alır.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Kabuk
   --------------------------------------------------------------------- */
.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

/* ---------------------------------------------------------------------
   Kenar çubuğu
   --------------------------------------------------------------------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  border-right: 1px solid rgba(255,255,255,.07);
}

.sidebar-head { padding: var(--sp-6) var(--sp-5) var(--sp-5); }

/* Kenar çubuğundaki kelime işareti */
.wordmark { font-size: 21px; }

.sidebar .kicker { color: var(--accent); font-size: 10px; margin-top: 2px; }

.side-nav {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: var(--sp-2) var(--sp-3) var(--sp-4);
  display: flex; flex-direction: column; gap: 2px;
}

.side-group {
  padding: var(--sp-5) var(--sp-3) var(--sp-2);
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.28);
}
.side-group:first-child { padding-top: var(--sp-2); }

.side-link {
  position: relative;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3);
  border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500;
  color: var(--sidebar-fg);
  transition: background .15s var(--ease), color .15s var(--ease);
}

.side-link svg { opacity: .75; transition: opacity .15s var(--ease); }
.side-link:hover { background: var(--sidebar-hover); color: var(--sidebar-fg-str); }
.side-link:hover svg { opacity: 1; }

.side-link.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-fg-str);
  font-weight: 600;
}
.side-link.active svg { opacity: 1; color: var(--accent); }

/* Etkin bağlantının solundaki ince işaret */
.side-link.active::before {
  content: ""; position: absolute; left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.side-count {
  margin-left: auto;
  font-size: 11.5px; font-weight: 600;
  color: rgba(255,255,255,.45);
  font-variant-numeric: tabular-nums;
}

.side-foot {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255,255,255,.07);
}
.side-foot > div:nth-child(2) { min-width: 0; flex: 1; }
.side-foot .row-title {
  color: var(--sidebar-fg-str); font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-foot .row-sub { color: rgba(255,255,255,.4); font-size: 11.5px; }
.side-foot .btn-secondary {
  background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.1);
  color: var(--sidebar-fg); box-shadow: none; height: 34px; width: 34px;
}
.side-foot .btn-secondary:hover { background: rgba(255,255,255,.11); color: #fff; }

.avatar {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: grid; place-items: center; border-radius: var(--r-full);
  background: var(--accent-soft); color: var(--accent-soft-fg);
  font-size: 12.5px; font-weight: 650;
}

/* ---------------------------------------------------------------------
   Ana alan ve üst çubuk
   --------------------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-6);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }

.search {
  position: relative; display: flex; align-items: center;
  flex: 0 1 380px; min-width: 0;
}
.search svg { position: absolute; left: 12px; color: var(--fg-subtle); pointer-events: none; }
.search .input { padding-left: 38px; height: 38px; background: var(--surface); }

.stamp {
  font-size: 12.5px; color: var(--fg-subtle);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ---------------------------------------------------------------------
   Sayfa bölümleri
   --------------------------------------------------------------------- */
.section { padding: var(--sp-6); }
.section + .section { padding-top: 0; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.page-head h1 { margin-top: 2px; }

/* ---------------------------------------------------------------------
   Özet kutuları
   --------------------------------------------------------------------- */
.kpis {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
}

.kpi {
  padding: var(--sp-5);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.kpi:hover { box-shadow: var(--sh-md); transform: translateY(-1px); }

.kpi-label { font-size: 12.5px; font-weight: 550; color: var(--fg-muted); }
.kpi-value {
  margin: 6px 0 4px;
  font-size: 30px; font-weight: 680; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.kpi-note { font-size: 12.5px; color: var(--fg-subtle); }

/* ---------------------------------------------------------------------
   Paneller
   --------------------------------------------------------------------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  padding: var(--sp-5); min-width: 0;
}

.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-2);
}
.panel-head h2 { margin-top: 2px; }

/* Tabloyu panelin kenarlarına yasla */
.panel > .table-wrap { margin: var(--sp-4) calc(var(--sp-5) * -1) calc(var(--sp-5) * -1); }
.panel > .table-wrap:first-child { margin-top: calc(var(--sp-5) * -1); }
.panel > .table-wrap .table th:first-child,
.panel > .table-wrap .table td:first-child { padding-left: var(--sp-5); }
.panel > .table-wrap .table th:last-child,
.panel > .table-wrap .table td:last-child { padding-right: var(--sp-5); }

.split { display: grid; gap: var(--sp-4); grid-template-columns: 1.4fr 1fr; align-items: start; }

/* ---------------------------------------------------------------------
   Satır listeleri
   --------------------------------------------------------------------- */
.rows { display: flex; flex-direction: column; }

.row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  transition: background .12s var(--ease);
}
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-child { padding-top: var(--sp-2); }

a.row { margin: 0 calc(var(--sp-3) * -1); padding-left: var(--sp-3); padding-right: var(--sp-3); border-radius: var(--r-md); }
a.row:hover { background: var(--surface-hover); color: inherit; }

.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 13.5px; font-weight: 550; display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row-sub { font-size: 12.5px; color: var(--fg-subtle); }

/* ---------------------------------------------------------------------
   Sütun grafiği
   --------------------------------------------------------------------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 168px; padding: var(--sp-4) 0 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.chart-track { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.chart-bar {
  width: 100%; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
  transition: opacity .15s var(--ease);
}
.chart-col:hover .chart-bar { opacity: .82; }
.chart-val { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-lab { font-size: 11px; color: var(--fg-subtle); }

/* ---------------------------------------------------------------------
   Boş durum
   --------------------------------------------------------------------- */
.empty { padding: var(--sp-10) var(--sp-5); text-align: center; color: var(--fg-muted); }
.empty svg { margin: 0 auto var(--sp-3); color: var(--fg-subtle); opacity: .6; }
.empty p { font-size: 13.5px; }

/* ---------------------------------------------------------------------
   Sayfalama
   --------------------------------------------------------------------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-top: var(--sp-4); flex-wrap: wrap;
}
.pager-actions { display: flex; gap: var(--sp-2); }

/* ---------------------------------------------------------------------
   Filtre çubuğu
   --------------------------------------------------------------------- */
.filters {
  display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--sp-4);
}
.filters .search { flex: 1 1 280px; }
.filters .input { height: 38px; }
.filters select.input { width: auto; min-width: 150px; }

/* ---------------------------------------------------------------------
   Giriş ekranı
   --------------------------------------------------------------------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }

.auth-poster {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--sp-10);
  background: linear-gradient(155deg, #241C18 0%, var(--murekkep) 55%, #0E0B0A 100%);
  color: #fafafa;
}

/* Arka planda yumuşak renk bulutu */
.auth-poster::before {
  content: ""; position: absolute; inset: -30% -10% auto -20%; height: 90%;
  background: radial-gradient(closest-side, rgba(255,90,46,.55), transparent 70%);
  filter: blur(20px); pointer-events: none;
}
.auth-poster::after {
  content: ""; position: absolute; inset: auto -25% -35% 20%; height: 80%;
  background: radial-gradient(closest-side, rgba(255,145,90,.30), transparent 70%);
  filter: blur(20px); pointer-events: none;
}

.auth-brand { position: relative; display: flex; align-items: center; gap: var(--sp-3); }
.auth-brand .kicker { color: rgba(255,255,255,.55); }

.auth-copy { position: relative; }
.auth-copy h1 { font-size: 44px; letter-spacing: -.04em; margin-bottom: var(--sp-4); }
.auth-copy .brand { font-size: 56px; display: block; margin-bottom: var(--sp-4); }
.auth-copy p { color: rgba(255,255,255,.6); font-size: 15px; max-width: 42ch; }

.auth-side {
  display: flex; flex-direction: column; justify-content: center;
  gap: var(--sp-5); padding: var(--sp-10);
  background: var(--surface);
}

.auth-secure {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px; color: var(--fg-subtle);
}
.auth-secure i {
  width: 7px; height: 7px; border-radius: var(--r-full);
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft);
}

.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); max-width: 400px; width: 100%; }
.auth-form h2 { font-size: 24px; }
.auth-submit { height: 44px; margin-top: var(--sp-1); }

.auth-foot {
  display: flex; align-items: center; gap: var(--sp-4);
  font-size: 12px; color: var(--fg-subtle);
}
.auth-foot span:first-child { margin-right: auto; }

/* ---------------------------------------------------------------------
   Mobil çekmece menü
   --------------------------------------------------------------------- */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1024px) {
  .nav-toggle { display: inline-flex; }

  .shell { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 272px; max-width: 84vw;
    transform: translateX(-100%);
    transition: transform .24s var(--ease);
    box-shadow: var(--sh-lg);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }

  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: rgba(0,0,0,.5);
    opacity: 0; pointer-events: none; transition: opacity .24s var(--ease);
  }
  .shell.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

  body.nav-locked { overflow: hidden; }

  .split { grid-template-columns: 1fr; }
  .section { padding: var(--sp-4); }
  .topbar { padding: var(--sp-3) var(--sp-4); }
  .stamp { display: none; }

  .auth { grid-template-columns: 1fr; }
  .auth-poster { display: none; }
  .auth-side { padding: var(--sp-6); min-height: 100dvh; }
}

@media (max-width: 640px) {
    h1 {
        font-size: 22px;
    }

    .kpi-value {
        font-size: 26px;
    }

    .kpis {
        grid-template-columns: 1fr 1fr;
    }

    .kpi {
        padding: var(--sp-4);
    }

    .topbar .search {
        display: none;
    }

    .topbar-right .btn span {
        display: none;
    }

    .panel {
        padding: var(--sp-4);
        border-radius: var(--r-md);
    }

        .panel > .table-wrap {
            margin: var(--sp-3) calc(var(--sp-4) * -1) calc(var(--sp-4) * -1);
        }

            .panel > .table-wrap .table th:first-child,
            .panel > .table-wrap .table td:first-child {
                padding-left: var(--sp-4);
            }

    .table-wrap .table {
        min-width: 620px;
    }

    .page-head {
        align-items: flex-start;
    }

    .auth-copy h1 {
        font-size: 32px;
    }

    .auth-copy .brand {
        font-size: 40px;
    }

    /* iPhone/Safari input'a basinca zoom yapmasin */
    .input {
        font-size: 16px;
    }
}

/* Menüdeki sohbet rozeti. Sayı sıfırken gizlenir ama eleman DOM'da kalır,
   böylece JavaScript onu bulup canlı güncelleyebilir. */
.side-rozet {
  background: var(--accent); color: var(--accent-fg);
  border-radius: var(--r-full); padding: 1px 7px;
  min-width: 20px; text-align: center;
  font-size: 11px; font-weight: 700;
}
.side-rozet[hidden] { display: none !important; }
