/* ════════════════════════════════════════════════
   RESPONSIVE  –  Mobile / Tablet Breakpoints
   ≥ 1024px : desktop (default, this file has no effect)
   768–1023px: tablet
   < 768px  : mobile
   < 480px  : small phone
════════════════════════════════════════════════ */

/* ────────────────────────────────────────────────
   Hamburger & Sidebar-close  (desktop'ta gizli)
──────────────────────────────────────────────── */
.btn-menu {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--clr-text);
  font-size: 16px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background .15s;
  flex-shrink: 0;
}
.btn-menu:hover { background: var(--clr-raised); }

.btn-sidebar-close {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--clr-sub);
  font-size: 16px;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-sidebar-close:hover { color: var(--clr-text); background: var(--clr-raised); }

/* Karartma overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .52);
  z-index: 340;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  cursor: pointer;
}
.sidebar-overlay.is-open { display: block; }


/* ════════════════════════════════════════════════
   TABLET + MOBILE  ≤ 1023px
   Sidebar → slide-in drawer, sayfa scroll modu
════════════════════════════════════════════════ */
@media (max-width: 1023px) {

  /* Hamburger & kapat butonu göster */
  .btn-menu          { display: flex; align-items: center; }
  .btn-sidebar-close { display: flex; }

  /* Navbar: sticky & merkez başlık gizle */
  .navbar {
    position: sticky;
    top: 0;
    z-index: 1100;
  }
  .navbar__title { display: none; }

  /* ── Sayfa scroll moduna geç ── */
  body {
    height: auto !important;
    min-height: 100vh;
    overflow-y: auto !important;
    overflow-x: hidden;
  }

  /* app-layout → block: sidebar artık tam olarak akıştan çıkar */
  .app-layout {
    display: block !important;
    overflow: visible;
    min-height: calc(100vh - var(--h-nav));
  }
  .content   { display: block; overflow: visible; width: 100%; }
  .dash-body { display: flex; flex-direction: column; overflow: visible;
               height: auto; flex: none; padding-bottom: 28px; }

  /* ── Sidebar: tam anlamıyla fixed çekmece ──────────
     - z-index 1200: navbar (1100) ve Leaflet (~700)'in üstünde
     - visibility toggle: transform animasyonu bitmeden görünmez
  ───────────────────────────────────────────── */
  .sidebar {
    position: fixed;
    top: var(--h-nav);
    left: 0;
    bottom: 0;
    z-index: 1200;
    width: 280px;
    /* İç flex zinciri çalışsın, dış kutu scroll etmesin */
    overflow: hidden;
    /* Kapalıyken tamamen gizli */
    transform: translateX(-110%);
    visibility: hidden;
    /* Kapanış: önce slide, sonra visibility */
    transition: transform .3s cubic-bezier(.4, 0, .2, 1),
                visibility 0s linear .3s;
    box-shadow: 6px 0 32px rgba(0, 0, 0, .6);
  }
  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    /* Açılış: visibility anında aktif, sonra slide */
    transition: transform .3s cubic-bezier(.4, 0, .2, 1),
                visibility 0s;
  }

  /* Overlay da navbar'ın altında ama içeriğin üstünde */
  .sidebar-overlay { z-index: 1050; }

  /* ── Sidebar iç düzeni ── */
  .sidebar__header {
    padding: 14px 16px 12px;
    flex-shrink: 0;
  }

  /* Filtre listesi: SADECE bu alan scroll eder */
  .sidebar__body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
  }

  /* Buton alanı: her zaman altta sabit */
  .sidebar__footer {
    flex-shrink: 0;
    padding: 12px 16px 16px;
    gap: 8px;
    background: var(--clr-surface);
    border-top: 1px solid var(--clr-border);
  }

  /* ── Dokunma hedefleri: min 44 px ── */
  .filter-group__select {
    padding: 11px 30px 11px 12px;
    font-size: 13px;
    min-height: 44px;
  }
  .filter-group__label {
    font-size: 10px;
    letter-spacing: .5px;
    margin-bottom: 2px;
  }
  .sidebar__footer .btn--primary {
    padding: 12px 14px;
    font-size: 13px;
    min-height: 44px;
  }
  .sidebar__footer .btn--ghost {
    padding: 11px 14px;
    font-size: 13px;
    min-height: 42px;
  }

  /* Stats: 2 sütun */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Map + charts: dikey yığma */
  .map-charts-section {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .map-card   { height: 400px; min-height: 400px; }
  .charts-col { display: grid; grid-template-columns: 1fr 1fr;
                height: 230px; flex: none; }
  .chart-card { flex: none; height: 100%; min-height: 0; }
}


/* ════════════════════════════════════════════════
   MOBILE  < 768px
════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* Sidebar: ekran genişliğinin %85'i (300px'ten fazla olmaz) */
  .sidebar { width: min(85vw, 300px); }

  /* Navbar: kompakt */
  .navbar { padding: 0 10px; gap: 5px; }
  .navbar__brand { padding-right: 10px; gap: 7px; }
  .navbar__brand-sub  { display: none; }
  .navbar__brand-name { font-size: 12px; }

  /* Harita yüksekliği */
  .map-card { height: 300px; min-height: 300px; }

  /* Grafikler: dikey yığma */
  .charts-col         { grid-template-columns: 1fr; height: auto; }
  .chart-card         { height: 210px; }

  /* Tablo araç çubuğu */
  .table-card__toolbar { flex-wrap: wrap; gap: 7px; }
  .table-info          { margin-left: 0; }
  .search-box          { flex: 1; min-width: 0; }
  .search-box__input   { width: auto; flex: 1; min-width: 0; }

  /* Harita toolbar */
  .map-card__toolbar { flex-wrap: wrap; gap: 6px; padding: 6px 9px; }

  /* Lejant küçük ekranda gizle */
  .legend { display: none; }

  /* Popup genişliği */
  .leaflet-popup-content {
    min-width: 220px !important;
    max-width: 280px !important;
  }
}


/* ════════════════════════════════════════════════
   KÜÇÜK TELEFON  < 480px
════════════════════════════════════════════════ */
@media (max-width: 479px) {

  /* Sidebar: neredeyse tam genişlik */
  .sidebar { width: min(92vw, 320px); }

  /* Stats: tek sütun */
  .stats-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Harita */
  .map-card { height: 250px; min-height: 250px; }

  /* View tab kompakt */
  .view-tab        { font-size: 10px; padding: 3px 8px; }
  .section-label   { font-size: 9px; letter-spacing: .5px; }
  .page-btn        { padding: 3px 7px; font-size: 10px; }
}
