/* =============================================================================
   Turkey Live Map — Global Styles
   ============================================================================= */

:root {
  /* ── Color Palette ───────────────────────────────────────────────────────── */
  --bg-primary:    #0f1923;
  --bg-secondary:  #1a2634;
  --bg-card:       #1e2d3d;
  --bg-hover:      #253545;
  --text-primary:  #e8eaed;
  --text-secondary:#9aa5b4;
  --text-muted:    #6b7a8d;
  --border:        #2a3a4a;
  --accent:        #4fc3f7;
  --accent-dim:    #2a7fb5;

  /* ── Category Colors ─────────────────────────────────────────────────────── */
  --cat-deprem:    #ef4444;
  --cat-sel:       #06b6d4;
  --cat-yangin:    #dc2626;
  --cat-trafik:    #f97316;
  --cat-guvenlik:  #3b82f6;
  --cat-saglik:    #22c55e;
  --cat-altyapi:   #8b5cf6;
  --cat-hava:      #eab308;
  --cat-resmi:     #64748b;
  --cat-genel:     #94a3b8;

  /* ── Severity ────────────────────────────────────────────────────────────── */
  --sev-low:       #4ade80;
  --sev-medium:    #facc15;
  --sev-high:      #f97316;
  --sev-critical:  #ef4444;

  /* ── Layout ──────────────────────────────────────────────────────────────── */
  --sidebar-width: 380px;
  --filter-height: 56px;
  --font-family:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* ── Staleness Banner ──────────────────────────────────────────────────────── */
.staleness-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #b45309, #92400e);
  color: #fef3c7;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.3px;
  animation: slideDown 0.3s ease;
}

.staleness-banner.hidden {
  display: none;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

/* ── Filter Bar ─────────────────────────────────────────────────────────────── */
.filter-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--filter-height);
  background: rgba(15, 25, 35, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.filter-bar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 16px;
  gap: 16px;
  max-width: 100%;
  overflow-x: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 22px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--accent), #81d4fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.category-filters {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cat-btn:hover {
  background: var(--bg-hover);
}

.cat-btn.active {
  border-color: var(--cat-color, var(--accent));
  color: var(--text-primary);
  background: rgba(79, 195, 247, 0.1);
}

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

.time-filters {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.time-btn {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-btn:hover {
  background: var(--bg-hover);
}

.time-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* ── Map ────────────────────────────────────────────────────────────────────── */
#map {
  position: fixed;
  top: var(--filter-height);
  left: 0;
  right: var(--sidebar-width);
  bottom: 0;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--filter-height);
  right: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.event-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 12px;
}

.event-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.event-feed::-webkit-scrollbar {
  width: 4px;
}

.event-feed::-webkit-scrollbar-track {
  background: transparent;
}

.event-feed::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* ── Event Feed Item ────────────────────────────────────────────────────────── */
.feed-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid rgba(42, 58, 74, 0.5);
}

.feed-item:hover {
  background: var(--bg-hover);
}

.feed-item .cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.feed-item .item-content {
  flex: 1;
  min-width: 0;
}

.feed-item .item-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-item .item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.feed-item .item-source {
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.feed-item .severity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.feed-item.new-item {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Skeleton Loading ───────────────────────────────────────────────────────── */
.loading-skeleton .skeleton-item {
  height: 60px;
  margin: 8px 20px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Map Popup ──────────────────────────────────────────────────────────────── */
.maplibregl-popup-content {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 16px !important;
  max-width: 280px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}

.maplibregl-popup-tip {
  border-top-color: var(--bg-card) !important;
}

.maplibregl-popup-close-button {
  color: var(--text-secondary) !important;
  font-size: 18px !important;
  padding: 4px 8px !important;
}

.popup-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}

.popup-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.popup-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.popup-severity {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.popup-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
}

.popup-link:hover {
  text-decoration: underline;
}

/* ── Mobile Bottom Sheet ────────────────────────────────────────────────────── */
.bottom-sheet-handle {
  display: none;
}

/* ── New event marker pulse (width/height only, no transform) ──────────────── */
@keyframes markerPulse {
  0%   { box-shadow: 0 0 6px currentColor;  opacity: 1; }
  50%  { box-shadow: 0 0 20px currentColor; opacity: 0.7; }
  100% { box-shadow: 0 0 6px currentColor;  opacity: 1; }
}

.marker-pulse {
  animation: markerPulse 1.5s ease-in-out 3;
}

/* ── Toast Notifications ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 4.7s forwards;
  max-width: 320px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.toast.toast-critical { border-left-color: var(--sev-critical); }
.toast.toast-high     { border-left-color: var(--sev-high); }

.toast-title {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 2px;
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-10px); }
}

/* ── Source Badge ───────────────────────────────────────────────────────────── */
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.source-badge.official {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

.source-badge.news {
  background: rgba(79, 195, 247, 0.12);
  color: var(--accent);
}

.source-badge.automated {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
}

/* ── Live Indicator ────────────────────────────────────────────────────────── */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  color: #4ade80;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px #4ade80; }
  50%      { opacity: 0.4; box-shadow: 0 0 0 #4ade80; }
}

/* ── Feed Item Hover Lift ──────────────────────────────────────────────────── */
.feed-item {
  transition: background 0.15s ease, transform 0.15s ease;
}

.feed-item:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
}

.feed-item:active {
  transform: translateX(0);
}

/* ── Responsive: Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100vw;
    --filter-height: 48px;
  }

  #map {
    right: 0;
    bottom: 40vh;
  }

  .sidebar {
    top: auto;
    bottom: 0;
    height: 40vh;
    width: 100vw;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transition: height 0.3s ease;
  }

  .sidebar.expanded {
    height: 70vh;
  }

  .sidebar.collapsed {
    height: 48px;
  }

  .bottom-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 8px;
    cursor: grab;
  }

  .handle-bar {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 4px;
  }

  .logo-text {
    font-size: 14px;
  }

  .live-indicator {
    display: none;
  }

  .cat-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .time-btn {
    padding: 4px 8px;
    font-size: 11px;
  }

  .filter-bar-inner {
    padding: 0 8px;
    gap: 8px;
  }

  .toast-container {
    bottom: 42vh;
    left: 12px;
    right: 12px;
  }

  .toast {
    max-width: 100%;
  }
}

