/* ==========================================================================
   TÜRKİYE CANLI & YÜZYILLIK ALETTSEL DEPREM ATLASI (1923 — GÜNÜMÜZ)
   CSS Stilleri & Arayüz Mimarisi
   Haritalayan: Sabri Karadoğan
   ========================================================================== */

:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #0f172a;
  --bg-panel: rgba(15, 23, 42, 0.94);
  --bg-card: rgba(30, 41, 59, 0.75);
  --border-color: rgba(51, 65, 85, 0.85);
  --border-active: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-amber: #f59e0b;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
}

/* ==================== ÜST ÇUBUK (HEADER) ==================== */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.4);
  flex-shrink: 0;
  animation: pulse-glow 2.5s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 22px rgba(239, 68, 68, 0.7); }
}

.brand-titles {
  display: flex;
  flex-col;
  flex-direction: column;
  min-width: 0;
}

.brand-titles h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-badge {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 9999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.brand-badge .live-dot {
  width: 6px;
  height: 6px;
  background-color: #ef4444;
  border-radius: 50%;
  animation: blink 1.2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

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

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

.author-pill {
  color: #38bdf8 !important;
}

.carto-pill {
  color: #f59e0b !important;
}

/* Üst Sayaç Rozetleri */
.header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

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

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

.stat-chip.live-chip {
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  cursor: pointer;
}

.stat-chip.live-chip b {
  color: #6ee7b7;
}

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

/* En Son Deprem Flaş Kartı */
.latest-quake-flash {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.latest-quake-flash:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
}

.latest-quake-flash .flash-mag {
  background: #dc2626;
  color: white;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 10.5px;
}

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

.btn-tool {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 11px;
  border-radius: 7px;
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  font-weight: 500;
  text-decoration: none;
}

.btn-tool:hover {
  background: #334155;
  border-color: #64748b;
  transform: translateY(-1px);
}

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

.btn-tool.faults-active {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}

.btn-tool.hist-link {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.btn-tool.hist-link:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
}

/* ==================== HARİTA ALANI ==================== */
.main-container {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  background: #090d16;
}

/* ==================== SOL YAN PANEL (FİLTRELER) ==================== */
.sidebar {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 330px;
  max-height: calc(100% - 28px);
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-main);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  transform: translateX(-360px);
  opacity: 0;
  pointer-events: none;
}

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

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

.sidebar-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 7px;
  font-size: 14px;
  border-radius: 5px;
  transition: all 0.2s;
}

.sidebar-close-btn:hover {
  background: #334155;
  color: white;
}

.sidebar-content {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.sidebar-content::-webkit-scrollbar {
  width: 5px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* Filtre Başlıkları */
.filter-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

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

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

.period-btn {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  padding: 7px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

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

.period-btn:hover {
  background: #334155;
  border-color: #64748b;
  color: white;
}

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

.period-btn.active span {
  color: #7dd3fc;
}

.period-btn.live-active {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #fca5a5;
}

.period-btn.live-active span {
  color: #fca5a5;
}

/* Şehir Arama Kutusu */
.search-box-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 6px 10px 6px 30px;
  color: var(--text-main);
  font-size: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-dim);
  pointer-events: none;
}

/* Magnitüd Hızlı Seçim Butonları */
.mag-quick-btns {
  display: flex;
  gap: 4px;
}

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

.mag-btn:hover {
  background: #334155;
  color: white;
}

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

/* Derinlik Filtreleri */
.depth-options {
  display: flex;
  gap: 5px;
}

.depth-chip {
  flex: 1;
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-color);
  padding: 6px 4px;
  border-radius: 6px;
  font-size: 10.5px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #94a3b8;
}

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

.depth-chip.active {
  border-color: #64748b;
  color: white;
  background: rgba(51, 65, 85, 0.7);
}

/* Renk Modu ve Seçim Kutuları */
.custom-select {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  padding: 6px 10px;
  color: var(--text-main);
  font-size: 11.5px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.custom-select:focus {
  border-color: var(--border-active);
}

/* Zaman Çizelgesi ve Oynatıcı Kartı */
.timeline-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-info {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-muted);
}

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

.btn-play {
  flex: 1;
  background: #3b82f6;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-play:hover {
  background: #2563eb;
}

.btn-play.playing {
  background: #f59e0b;
}

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

/* Sıfırlama Butonu */
.btn-reset {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  padding: 7px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-reset:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #f87171;
}

/* Sidebar Açma Sekmesi (Kapalıyken) */
.sidebar-toggle-tab {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: var(--shadow-main);
  z-index: 890;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.sidebar-toggle-tab:hover {
  background: #1e293b;
  border-color: var(--border-active);
  transform: translateY(-1px);
}

/* ==================== SAĞ ÇEKMECE (BÜYÜK DEPREMLER) ==================== */
.drawer {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 340px;
  max-height: calc(100% - 28px);
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-main);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 900;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  overflow: hidden;
}

.drawer.collapsed {
  transform: translateX(380px);
  opacity: 0;
  pointer-events: none;
}

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

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

.drawer-list {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

.major-quake-card {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.major-quake-card:hover {
  background: rgba(51, 65, 85, 0.85);
  border-color: #ef4444;
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.major-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.major-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #f8fafc;
}

.major-card-mag {
  background: #dc2626;
  color: white;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
}

.major-card-details {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.major-card-desc {
  font-size: 10.5px;
  color: #cbd5e1;
  line-height: 1.35;
  margin-top: 2px;
}

/* ==================== HARİTA LEJANDI ==================== */
.map-legend {
  position: absolute;
  bottom: 24px;
  right: 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-main);
  box-shadow: var(--shadow-main);
  z-index: 800;
  backdrop-filter: blur(10px);
  pointer-events: auto;
  max-width: 250px;
}

.legend-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ==================== POPUP KARTI (CUSTOM) ==================== */
.quake-popup-wrap {
  min-width: 230px;
  max-width: 280px;
  font-family: var(--font-family);
}

.quake-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.quake-popup-mag {
  font-size: 16px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 5px;
  color: white;
}

.quake-popup-date {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.quake-popup-body {
  font-size: 11.5px;
  line-height: 1.5;
  color: #e2e8f0;
}

.quake-popup-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.quake-popup-row span:first-child {
  color: #94a3b8;
}

/* ==================== MODALLAR ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-window {
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  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: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.modal-close:hover {
  background: #334155;
  color: white;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
}

.modal-body h3 {
  font-size: 14px;
  color: #38bdf8;
  margin: 14px 0 6px 0;
}

.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 10px;
}

.modal-body li {
  margin-bottom: 4px;
}

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

/* Grafik Sekmeleri */
.chart-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

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

.chart-tab-btn:hover {
  background: #334155;
  color: white;
}

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

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

/* ==================== MOBİL UYUM (RESPONSIVE) ==================== */
@media (max-width: 900px) {
  .header-stats {
    display: none;
  }
  .sidebar {
    width: 290px;
  }
  .drawer {
    width: 300px;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 10px;
  }
  .brand-titles h1 {
    font-size: 13px;
  }
  .brand-attribution {
    display: none;
  }
  .sidebar {
    left: 8px;
    right: 8px;
    width: auto;
  }
  .drawer {
    right: 8px;
    left: 8px;
    width: auto;
  }
}
