/* ==========================================================================
   Türkiye Deprem Kataloğu (M.Ö. 2100 - 2006) - İnteraktif Harita Stilleri
   Veriler: Onur Tan, M. Cengiz Tapırdamaz, Ahmet Yörük (TÜBİTAK MAM)
   Haritalayan: Sabri Karadoğan
   ========================================================================== */

:root {
  --bg-primary: #0a0f18;
  --bg-card: rgba(15, 23, 42, 0.88);
  --bg-card-solid: #0f172a;
  --bg-input: #1e293b;
  --border: rgba(148, 163, 184, 0.18);
  --border-focus: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.35);
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(12px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ================== ÜST MENÜ (HEADER) ================== */
.app-header {
  height: 56px;
  min-height: 56px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ef4444, #f59e0b);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.brand-titles h1 {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-size: 10px;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.brand-attribution {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.brand-attribution b {
  color: #e2e8f0;
}

.author-pill {
  color: #38bdf8;
  font-weight: 600;
}

.carto-pill {
  color: #f59e0b;
  font-weight: 600;
}

/* Üst Özet Sayaçları */
.header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-chip {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stat-chip b {
  color: #38bdf8;
}

.stat-chip.alert b {
  color: #ef4444;
}

/* Üst Araçlar */
.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-tool {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
}

.btn-tool:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(148, 163, 184, 0.35);
  transform: translateY(-1px);
}

.btn-tool.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.45);
}

.btn-tool.active.faults-active {
  background: #dc2626;
  border-color: #f87171;
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.5);
}

.btn-tool.active.heat-active {
  background: #d97706;
  border-color: #fbbf24;
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.5);
}

/* ================== ANA İÇERİK DÜZENİ ================== */
.main-container {
  flex: 1;
  position: relative;
  display: flex;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: #070b12;
  z-index: 1;
}

/* ================== SOL YAN PANEL (SIDEBAR) ================== */
.sidebar {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  transform: translateX(-370px);
}

.sidebar-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
}

.sidebar-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
}

.sidebar-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
}

.sidebar-close-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-tab {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 999;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-toggle-tab:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: var(--accent);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Filtre Bölümleri */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-label .val-tag {
  color: #38bdf8;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: none;
}

/* Dönem Butonları */
.period-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.period-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.period-btn span {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: normal;
}

.period-btn:hover {
  background: rgba(51, 65, 85, 0.8);
}

.period-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Zaman Çizelgesi & Oynatıcı */
.timeline-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-years-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}

.timeline-years-display span {
  background: #1e293b;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: #38bdf8;
}

.range-slider-wrap {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}

.range-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

/* Animasyon Kontrolü */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.btn-play {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none;
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease;
}

.btn-play:hover {
  transform: scale(1.02);
}

.player-status {
  font-size: 11px;
  color: var(--text-muted);
}

/* Büyüklük Hızlı Butonları */
.mag-quick-btns {
  display: flex;
  gap: 5px;
}

.mag-btn {
  flex: 1;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 5px 0;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.mag-btn:hover {
  background: rgba(51, 65, 85, 0.8);
}

.mag-btn.active {
  background: #ef4444;
  border-color: #f87171;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* Derinlik Seçenekleri */
.depth-options {
  display: flex;
  gap: 6px;
}

.depth-chip {
  flex: 1;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  user-select: none;
}

.depth-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.depth-chip.active {
  border-color: #ffffff;
  background: rgba(51, 65, 85, 0.9);
}

/* Renklendirme Modu */
.color-mode-select {
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.color-mode-select:focus {
  border-color: var(--accent);
}

/* Referans Seçimi */
.ref-select {
  width: 100%;
  background: #1e293b;
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

/* Checkbox Grupları */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-wrap input[type="checkbox"] {
  accent-color: #38bdf8;
  cursor: pointer;
}

/* Sıfırlama Butonu */
.btn-reset {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  margin-top: 4px;
}

.btn-reset:hover {
  background: rgba(239, 68, 68, 0.22);
}

/* ================== SAĞ ÇEKMECE (BÜYÜK DEPREMLER) ================== */
.drawer {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 330px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.drawer.collapsed {
  transform: translateX(360px);
}

.drawer-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
}

.drawer-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quake-card-item {
  background: rgba(30, 41, 59, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quake-card-item:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: #38bdf8;
  transform: translateX(-2px);
}

.quake-mag-badge {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  background: #dc2626;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.45);
}

.quake-card-info {
  flex: 1;
  overflow: hidden;
}

.quake-card-name {
  font-size: 12.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quake-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ================== DETAYLI TIKLAMA KARTI (INSPECTION CARD) ================== */
.info-card-popup {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 1002;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.info-card-popup.hidden {
  display: none;
}

.info-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.info-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.info-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(15, 23, 42, 0.5);
  padding: 8px;
  border-radius: 8px;
}

.info-item .k {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.info-item .v {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

/* ================== LEJAND (LEGEND) ================== */
.map-legend {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  z-index: 998;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11.5px;
}

.legend-title {
  font-weight: 700;
  color: #ffffff;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: #ef4444;
}

/* ================== MODALLER (MODAL) ================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-window {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalScale 0.22s ease-out;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.4);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 6px;
}

.modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body h3 {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 4px;
}

.modal-body p {
  color: #cbd5e1;
}

.modal-body ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-body code {
  background: #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  font-size: 12px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(30, 41, 59, 0.2);
}

/* Grafik Çerçevesi */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.chart-tab-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.chart-tab-btn.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

/* ================== ANİMASYONLAR ================== */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Pulsing Epicenter Animation */
.leaflet-popup-content-wrapper {
  background: var(--bg-card-solid) !important;
  color: #ffffff !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.leaflet-popup-tip {
  background: var(--bg-card-solid) !important;
}

/* Mobil Uyum */
@media (max-width: 768px) {
  .brand-attribution {
    display: none;
  }
  .header-stats .stat-chip:not(:first-child) {
    display: none;
  }
  .sidebar {
    width: calc(100vw - 24px);
  }
  .drawer {
    width: calc(100vw - 24px);
  }
  .map-legend {
    display: none;
  }
}
