/* ========================================
   ISP-WiFi Afet Doluluk Sistemi — Demo
   ======================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-primary: #0a0f1a;
  --bg-panel: #0d1320;
  --bg-card: #111827;
  --border: #1e293b;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-label: #475569;

  --isp-turk-telekom: #22c55e;
  --isp-superonline: #3b82f6;
  --isp-vodafone: #ef4444;

  --color-green: #22c55e;
  --color-blue: #3b82f6;
  --color-orange: #f59e0b;
  --color-red: #ef4444;
  --color-yellow: #eab308;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Top Bar ---------- */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(20, 10, 10, 0.85) 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid rgba(239, 68, 68, 0.15);
  flex-shrink: 0;
}

.top-bar__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-red);
  animation: pulseDot 1.2s ease-in-out infinite;
  box-shadow: 0 0 6px var(--color-red);
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.top-bar__earthquake {
  font-size: 13px;
  font-weight: 600;
  color: #fca5a5;
  letter-spacing: 0.5px;
}

.top-bar__right {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ---------- Main Container ---------- */
#main-container {
  display: flex;
  height: calc(100% - 40px);
}

/* ---------- Left Panel ---------- */
#left-panel {
  width: 272px;
  min-width: 272px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

#left-panel::-webkit-scrollbar {
  width: 4px;
}
#left-panel::-webkit-scrollbar-track {
  background: transparent;
}
#left-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* --- ISP Cards Section --- */
#isp-cards {
  padding: 14px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.isp-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 12px 12px 12px 16px;
  position: relative;
  border: 1px solid var(--border);
  transition: border-color 0.3s;
}

.isp-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--isp-color);
}

.isp-card--active {
  border-color: rgba(255, 255, 255, 0.06);
}

.isp-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.isp-card__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--isp-color);
}

.isp-card__status {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-label);
}

.isp-card__status--transferring {
  background: rgba(234, 179, 8, 0.12);
  color: var(--color-yellow);
  animation: blinkStatus 1s ease-in-out infinite;
}

@keyframes blinkStatus {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.isp-card__status--done {
  background: rgba(34, 197, 94, 0.12);
  color: var(--color-green);
  animation: none;
}

.isp-card__stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.isp-card__stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.isp-card__stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-label);
}

.isp-card__stat-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Progress Bar */
.progress-bar {
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--isp-color);
  transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- Summary Section --- */
#summary-section {
  padding: 14px 12px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.summary__title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-label);
  margin-bottom: 12px;
}

.summary__stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.summary__stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary__stat-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.summary__stat-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.summary__stat-value--highlight {
  color: var(--color-green);
  font-size: 18px;
  font-weight: 700;
}

.summary__progress {
  height: 5px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.summary__progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Legend Section --- */
#legend-section {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.legend__title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-label);
  margin-bottom: 10px;
}

.legend__items {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}

.legend__dot--green  { background: var(--color-green); box-shadow: 0 0 4px rgba(34, 197, 94, 0.35); }
.legend__dot--blue   { background: var(--color-blue); box-shadow: 0 0 4px rgba(59, 130, 246, 0.35); }
.legend__dot--orange { background: var(--color-orange); box-shadow: 0 0 4px rgba(245, 158, 11, 0.35); }
.legend__dot--red    { background: var(--color-red); box-shadow: 0 0 4px rgba(239, 68, 68, 0.35); }

.legend__label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* ---------- Map Container ---------- */
#map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* Leaflet overrides for dark theme */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-panel) !important;
}

/* ---------- Building Markers ---------- */
.building-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  animation: popIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: scale(0);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.building-marker:hover {
  transform: scale(1.15) !important;
  z-index: 9999 !important;
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- Building Popup ---------- */
#building-popup {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(13, 19, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 24px;
  min-width: 280px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

#building-popup.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.popup__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.popup__close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.popup__address {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding-right: 24px;
}

.popup__flats {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.popup__count-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-label);
  margin-bottom: 2px;
}

.popup__count-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Leaflet attribution override ---------- */
.leaflet-control-attribution {
  background: rgba(10, 15, 26, 0.7) !important;
  color: var(--text-label) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* ---------- Cluster Markers ---------- */
.cluster-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 700;
  color: #fff;
  border: 2.5px solid rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: scale(0);
}

.cluster-marker:hover {
  transform: scale(1.1) !important;
}

/* Hide default markercluster styles */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: none !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: none !important;
}
