/* ============================================================
   BÖLGEMİZ — panel verisiyle sürülen kısımlar
   (bkz. app/Views/partials/bolgemiz_bolumu.php + js/custom/bolgemiz.js)

   Bölümün yerleşimi ve temel görünümü daka.css'teki .bz-* kurallarından
   gelir; burada YALNIZCA veriye bağlı davranış tanımlanır:
   choropleth boyama, paletler, arama paneli ve animasyonlar.

   Panelde veri yokken hiçbir kural devreye girmez — iller SVG'deki kendi
   renklerini korur.
   ============================================================ */

/* ---- Paletler: aranan göstergenin birimine göre ----
   Renk hesabı CSS'te; JS yalnız --yogunluk değerini yazar. Böylece palet
   değişimi tek sınıfla olur ve fill geçişiyle kendiliğinden yumuşar. */
.bz-section.palet-miktar { --ton-acik: #cfe9ec; --ton-koyu: #0f6d78; }
.bz-section.palet-oran   { --ton-acik: #fde8c9; --ton-koyu: #d9730d; }
.bz-section.palet-genel  { --ton-acik: #e5dcf5; --ton-koyu: #5b21b6; }

/* ---- Choropleth ----
   CSS kuralı, path'teki fill ÖZNİTELİĞİNİ ezer; sınıf kalkınca il
   kendi özgün rengine geri döner. */
.bz-il .bz-sekil path {
  transition: fill .55s cubic-bezier(.22, .61, .36, 1), opacity .55s ease;
}

.bz-il.veri-var .bz-sekil path {
  fill: color-mix(in oklab,
        var(--ton-acik, #cfe9ec) calc((1 - var(--yogunluk, 0)) * 100%),
        var(--ton-koyu, #0f6d78) calc(var(--yogunluk, 0) * 100%));
}

/* color-mix yoksa PHP/JS'in hesapladığı hazır ton kullanılır */
@supports not (color: color-mix(in oklab, red 50%, blue)) {
  .bz-il.veri-var .bz-sekil path { fill: var(--ton-hesaplanan, #0f6d78); }
}

/* Arama yapıldı ama bu ilde veri yok: soluk kalsın */
.bz-section.bz-arama-var .bz-il:not(.veri-var) .bz-sekil path { opacity: .45; }

/* Sonuç satırı/öne çıkan kart üzerine gelince ilgili il vurgulanır */
.bz-il.vurgu .bz-sekil,
.bz-il.secili .bz-sekil {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35));
}

/* Harita güncellendi nabzı — transform-box ZORUNLU, yoksa şekil
   SVG kökenine göre ölçeklenip ekrandan uçar */
@keyframes bz-il-nabiz {
  0%   { transform: none }
  45%  { transform: scale(1.035) }
  100% { transform: none }
}

.bz-il .bz-sekil {
  transform-box: fill-box;
  transform-origin: center;
}

.bz-il.guncellendi .bz-sekil { animation: bz-il-nabiz .5s ease both; }

/* ---- Kart eklentileri (panel türleri) ---- */
.bz-stat-ikon {
  font-size: 30px;
  line-height: 1;
  color: var(--bz-tur-renk, #2A8F82);
}

.bz-stat-adet {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  color: var(--bz-tur-renk, #2A8F82);
  opacity: .85;
}

.bz-stat-card { position: relative; }

/* ---- Otomatik tamamlama ---- */
.bz-search { position: relative; }

.bz-oneri {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(8, 20, 45, .22);
}

.bz-oneri[hidden] { display: none; }

.bz-oneri li { margin: 0; }

.bz-oneri button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #24323c;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.bz-oneri button:hover,
.bz-oneri button[aria-selected="true"] { background: #eef5f6; }

.bz-oneri button span {
  flex-shrink: 0;
  font-size: 11.5px;
  color: #6b7b86;
}

/* ---- Ölçek (legend) ---- */
.bz-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, .9);
}

.bz-legend[hidden] { display: none; }

.bz-legend-serit {
  flex: 1 1 auto;
  min-width: 90px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--ton-acik, #cfe9ec), var(--ton-koyu, #0f6d78));
}

.bz-legend-birim { opacity: .8; }

/* ---- Arama sonuç paneli ---- */
.bz-panel {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(8, 20, 45, .18);
  color: #24323c;
}

.bz-panel[hidden] { display: none; }

.bz-sonuc-ozet { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.bz-sonuc-bos  { color: #6b7b86; font-weight: 500; }

.bz-sonuc-liste {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bz-sonuc-satir a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f7f8;
  color: inherit;
  text-decoration: none;
  transition: background .2s ease, transform .2s ease;
}

.bz-sonuc-satir a:hover { background: #e7eff1; transform: translateY(-1px); }
.bz-sonuc-satir strong  { display: block; font-size: 14px; line-height: 1.35; }

.bz-sonuc-kunye {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: #6b7b86;
}

/* ---- Öneri çipleri (sonuçsuz arama) ---- */
.bz-oneri-cipler {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.bz-cip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid #d6e0e3;
  border-radius: 999px;
  background: #ffffff;
  color: #24323c;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}

.bz-cip:hover { background: #eef5f6; border-color: #b9cdd2; }
.bz-cip span  { font-size: 11px; color: #6b7b86; }

/* ---- İl paneli (haritada bir il tıklanınca) ---- */
.bz-il-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid #e2eaec; }

.bz-il-panel-bas {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bz-il-panel-bas h3 { margin: 0; font-size: 16px; font-weight: 700; }

.bz-il-panel-kapat {
  margin-left: auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #eef2f4;
  color: #24323c;
  cursor: pointer;
}

.bz-gosterge-liste {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.bz-gosterge {
  padding: 9px 11px;
  border-radius: 10px;
  background: #f4f7f8;
}

.bz-gosterge-ad    { display: block; font-size: 12px; color: #6b7b86; }
.bz-gosterge-deger { display: block; font-size: 18px; font-weight: 700; line-height: 1.2; }
.bz-gosterge-birim { font-size: 12px; font-weight: 500; color: #6b7b86; }

/* ---- Öne çıkan çalışmalar ---- */
.bz-one-cikan {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.bz-oc-kart {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, .94);
  color: #24323c;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(8, 20, 45, .16);
  transition: transform .25s ease, box-shadow .25s ease;
}

.bz-oc-kart:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(8, 20, 45, .24); }

.bz-oc-gorsel { display: block; line-height: 0; }
.bz-oc-gorsel img { width: 100%; height: 110px; object-fit: cover; display: block; }

/* Kapak yoksa tür rengiyle düz yer tutucu (kırık görsel basılmaz) */
.bz-oc-gorsel--bos { height: 110px; background: var(--bz-tur-renk, #2A8F82); opacity: .85; }

.bz-oc-govde { display: block; padding: 11px 13px 14px; }

.bz-oc-rozet {
  display: inline-block;
  margin-bottom: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bz-tur-renk, #2A8F82);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
}

.bz-oc-baslik { display: block; font-size: 14px; line-height: 1.35; }
.bz-oc-kunye  { display: block; margin-top: 4px; font-size: 12px; color: #6b7b86; }

/* ---- Bölüm belirme animasyonu ---- */
@keyframes bz-belir {
  from { opacity: 0; transform: translateY(24px) }
  to   { opacity: 1; transform: none }
}

@keyframes bz-il-belir {
  from { opacity: 0; transform: scale(.94) }
  to   { opacity: 1; transform: none }
}

.bz-section.gorunur .bz-il .bz-sekil {
  animation: bz-il-belir .6s cubic-bezier(.22, .61, .36, 1) both;
}

.bz-section.gorunur #mus     .bz-sekil { animation-delay: .05s }
.bz-section.gorunur #bitlis  .bz-sekil { animation-delay: .13s }
.bz-section.gorunur #van     .bz-sekil { animation-delay: .21s }
.bz-section.gorunur #hakkari .bz-sekil { animation-delay: .29s }

.bz-section.gorunur .bz-panel:not([hidden]),
.bz-section.gorunur .bz-one-cikan {
  animation: bz-belir .7s cubic-bezier(.22, .61, .36, 1) both;
}

/* ---- Hareket azaltma ---- */
@media (prefers-reduced-motion: reduce) {
  .bz-section *,
  .bz-il .bz-sekil,
  .bz-il .bz-sekil path {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 767.98px) {
  .bz-panel { padding: 14px; }
  .bz-legend { font-size: 11px; }
}
