/* =========================================
   Sakarya Harita Sayfası Stilleri
   ========================================= */

:root {
  --map-primary: #04243c;
  --map-accent: #0d6efd;
  --map-gold: #c8a84b;
  --map-listing: #0d6efd;
  --map-demand: #e83e6c;
  --map-panel-bg: rgba(255,255,255,0.97);
  --map-panel-border: rgba(4,36,60,0.1);
}

/* Layout */
.map-page-wrapper {
  position: relative;
  width: 100%;
  height: calc(100vh - 85px);
  overflow: hidden;
}

#sakaryaMap {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* =========================================
   Kontrol Paneli
   ========================================= */
.map-controls-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 234px;
  background: var(--map-panel-bg);
  border: 1px solid var(--map-panel-border);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(4,36,60,0.16);
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.map-controls-panel.collapsed {
  transform: translateX(-260px);
  opacity: 0;
  pointer-events: none;
}

.map-controls-header {
  display: flex;
  align-items: center;
  padding: 13px 14px;
  background: var(--map-primary);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
}

.map-controls-header i { color: var(--map-gold); }
.map-controls-header span { flex: 1; }

.map-controls-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background 0.2s;
  font-size: 12px;
}
.map-controls-toggle:hover { background: rgba(255,255,255,0.15); color: #fff; }

.map-controls-open {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  background: var(--map-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 12px rgba(4,36,60,0.3);
  cursor: pointer;
  transition: background 0.2s;
}
.map-controls-open:hover { background: #0a3d61; }

/* İstatistikler */
.map-stats-row {
  display: flex;
  justify-content: space-around;
  padding: 11px 8px 10px;
  border-bottom: 1px solid var(--map-panel-border);
  background: #f8fafc;
}

.map-stat-item { text-align: center; }

.map-stat-count {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--map-primary);
  line-height: 1;
}

.map-stat-label {
  font-size: 10px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.map-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 14px 5px;
}

/* Tip grid */
.map-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--map-panel-border);
}

.map-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px;
  border: 1.5px solid var(--map-panel-border);
  background: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: all 0.18s;
  line-height: 1;
}

.map-type-btn i {
  font-size: 13px;
  color: #888;
  transition: color 0.18s;
}

.map-type-btn span { font-size: 10px; }

.map-type-btn.active,
.map-type-btn:hover {
  background: var(--map-primary);
  border-color: var(--map-primary);
  color: #fff;
}
.map-type-btn.active i,
.map-type-btn:hover i { color: var(--map-gold); }

/* Toggle switch */
.map-toggle-item {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 0 14px;
  margin: 0;
}

.map-toggle-item input { display: none; }

.map-toggle-track {
  width: 32px;
  height: 17px;
  background: #ccc;
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.map-toggle-track::after {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.map-toggle-item input:checked + .map-toggle-track { background: var(--map-primary); }
.map-toggle-item input:checked + .map-toggle-track::after { left: 17px; }

.map-toggle-label {
  font-size: 12px;
  color: #333;
  font-weight: 500;
}
.map-toggle-label i { color: var(--map-primary); width: 14px; text-align: center; margin-right: 2px; }

/* İlçe select */
.map-district-select {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 12px;
  padding: 7px 10px;
  border: 1.5px solid var(--map-panel-border);
  border-radius: 8px;
  font-size: 12px;
  color: #333;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.map-district-select:focus { border-color: var(--map-primary); }

/* Legend */
.map-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 0;
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #555;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.listing-dot { background: var(--map-listing); }
.demand-dot { background: var(--map-demand); }

/* Choropleth legend */
.map-choropleth-legend {
  padding: 6px 14px 14px;
  transition: opacity 0.2s;
}
.choropleth-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.choropleth-label-left,
.choropleth-label-right {
  font-size: 9px;
  color: #888;
  white-space: nowrap;
}
.choropleth-gradient {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right,
    rgba(13,110,253,0.08),
    rgba(13,110,253,0.22),
    rgba(13,110,253,0.38),
    rgba(13,110,253,0.55),
    rgba(13,110,253,0.72)
  );
}

/* =========================================
   Leaflet özelleştirme
   ========================================= */
.leaflet-control-zoom a {
  background-color: var(--map-primary) !important;
  color: #fff !important;
  border: none !important;
  font-size: 16px !important;
}
.leaflet-control-zoom a:hover { background-color: #0a3d61 !important; }

/* İlçe tooltip */
.district-label-tooltip {
  background: rgba(4,36,60,0.85) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 3px 8px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}
.district-label-tooltip::before { display: none !important; }

/* Popup */
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.14) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content { margin: 0 !important; min-width: 200px; }
.leaflet-popup-tip-container { margin-top: -1px; }

.skb-popup { font-family: 'Inter', sans-serif; }

.skb-popup-header {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
}
.skb-popup-header.listing { background: var(--map-primary); }
.skb-popup-header.demand { background: var(--map-demand); }
.skb-popup-header.district { background: var(--map-primary); }

.skb-popup-body { padding: 10px 14px 4px; }
.skb-popup-body p { margin: 3px 0; font-size: 12px; color: #444; }

.skb-popup-footer { padding: 8px 14px 12px; }
.skb-popup-footer a {
  display: block;
  width: 100%;
  text-align: center;
  padding: 7px 0;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  background: var(--map-primary);
  color: #fff;
  transition: background 0.2s;
}
.skb-popup-footer a:hover { background: #0a3d61; }

/* Yükleme */
.map-loading {
  position: absolute;
  inset: 0;
  z-index: 2000;
  background: rgba(4,36,60,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.map-loading-inner { text-align: center; color: #fff; }
.map-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,0.25);
  border-top-color: var(--map-gold);
  border-radius: 50%;
  animation: mapSpin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes mapSpin { to { transform: rotate(360deg); } }
.map-loading p { font-size: 14px; font-weight: 500; margin: 0; opacity: 0.9; }

/* Mobil */
@media (max-width: 576px) {
  .map-controls-panel { width: 210px; top: 8px; left: 8px; }
  .map-page-wrapper { height: calc(100vh - 65px); }
}
