/* === Components === */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(59,130,246,0.3);
}
.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
  transform: translateY(-1px);
}

.btn--ghost {
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--ghost:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.btn--icon {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius);
  font-size: 13px;
}

.btn--sm {
  padding: 5px 10px;
  font-size: 0.72rem;
  border-radius: var(--radius-full);
}

/* Severity Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge--critical { background: var(--severity-critical-bg); color: var(--severity-critical); }
.badge--high { background: var(--severity-high-bg); color: var(--severity-high); }
.badge--medium { background: var(--severity-medium-bg); color: #92710A; }
.badge--low { background: var(--severity-low-bg); color: var(--severity-low); }
.badge--info { background: var(--severity-info-bg); color: var(--severity-info); }

[data-theme="dark"] .badge--medium { color: var(--severity-medium); }

/* === Event Cards === */
.event-card {
  padding: 10px 16px 10px 12px;
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  gap: 10px;
  align-items: stretch;
  position: relative;
}

.event-card:hover {
  background: var(--accent-light);
}

.event-card + .event-card {
  border-top: 1px solid var(--border-light);
}

.event-card--active {
  background: var(--accent-light);
}

/* Color bar on left */
.event-card__bar {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.event-card__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.event-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.event-card__title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.event-card__meta-sep {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.5;
}

.event-card__fatalities {
  color: var(--severity-critical);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
}

/* === Filter Panel === */
.filter-panel {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: none;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-primary);
}

.filter-panel--open { display: flex; }

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-group__label {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.filter-group__options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.filter-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* Select inputs */
.date-range { display: flex; gap: 6px; align-items: center; }

.date-range select,
.date-range input,
.region-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.78rem;
  transition: all var(--transition);
  outline: none;
}

.date-range select:focus,
.region-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.region-select { width: 100%; }

/* === Loading skeleton === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-primary) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: var(--radius-xs);
}

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

.skeleton-card { padding: 12px 16px; display: flex; gap: 10px; }
.skeleton-card + .skeleton-card { border-top: 1px solid var(--border-light); }
.skeleton-card__icon { width: 3px; border-radius: 2px; align-self: stretch; min-height: 32px; }
.skeleton-card__lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-card__line { height: 11px; border-radius: 6px; }
.skeleton-card__line--short { width: 50%; }

/* === Map popup === */
.map-popup {
  font-family: 'DM Sans', sans-serif;
  min-width: 220px;
  max-width: 300px;
}

.map-popup__type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.map-popup__title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--text-primary);
  line-height: 1.35;
}

.map-popup__details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.map-popup__detail {
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-popup__detail-icon {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.5;
}

.map-popup__source {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-light);
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* === Status banner === */
.status-banner {
  padding: 6px 16px;
  background: var(--accent-solid-bg);
  color: var(--accent);
  font-size: 0.75rem;
  text-align: center;
  display: none;
  border-bottom: 1px solid var(--accent-glow);
  font-weight: 500;
}

.status-banner--visible {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* === Last updated === */
.last-updated {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  padding: 3px 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
}

.last-updated__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 2px rgba(34,197,94,0.2); }
}

/* === Theme toggle === */
.theme-toggle {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all var(--transition);
  color: var(--text-muted);
}
.theme-toggle:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* === Sidebar toggle (mobile FAB) === */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px; right: 16px;
  z-index: 900;
  width: 44px; height: 44px;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 16px;
  transition: all var(--transition);
}
.sidebar-toggle:hover { transform: translateY(-2px); }

/* === Feedback FAB === */
.feedback-fab {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 900;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  opacity: 0.7;
  border: none;
  cursor: pointer;
  padding: 0;
}
.feedback-fab:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* === Hamburger === */
.hamburger {
  display: none;
  width: 30px; height: 30px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius);
}
.hamburger:hover { background: var(--accent-light); }

.hamburger__line {
  width: 16px; height: 1.5px;
  background: var(--text-primary);
  border-radius: 1px;
}

/* === Filter count badge === */
.filter-count {
  background: var(--severity-critical);
  color: #fff;
  border-radius: 10px;
  padding: 0 5px;
  font-size: 0.58rem;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
  display: none;
  line-height: 1.5;
}
.filter-count--visible { display: inline-block; }

/* === Timeline bars === */
.timeline-bar {
  flex-shrink: 0;
  width: 12px;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  opacity: 0.8;
}
.timeline-bar:hover {
  opacity: 1;
  transform: scaleY(1.08);
  transform-origin: bottom;
}

.timeline-bar--selected {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--accent), 0 0 8px var(--accent-glow);
}

.timeline-bar__label {
  position: absolute;
  bottom: -14px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.45rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  display: none;
  font-family: 'JetBrains Mono', monospace;
}
.timeline-bar:hover .timeline-bar__label { display: block; }

/* === Loader === */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.82rem;
  gap: 8px;
}

.loader__spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Noscript */
.noscript-message {
  padding: 40px;
  text-align: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Visitor counter */
.visitor-counter {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* Empty state */
.empty-state {
  padding: 48px 24px;
  text-align: center;
}
.empty-state__icon { font-size: 2rem; margin-bottom: 12px; opacity: 0.3; }
.empty-state__title { font-weight: 600; color: var(--text-secondary); font-size: 0.88rem; }
.empty-state__text { font-size: 0.76rem; margin-top: 6px; color: var(--text-muted); }

/* === Language Switcher === */
.lang-switcher {
  position: relative;
}
.lang-switcher__btn {
  font-size: 15px !important;
  padding: 4px 8px !important;
}
.lang-switcher__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 1000;
  min-width: 140px;
  max-height: 320px;
  overflow-y: auto;
}
.lang-switcher__dropdown--open { display: block; }
.lang-switcher__option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-align: left;
}
.lang-switcher__option:hover {
  background: var(--accent-light);
  color: var(--accent);
}
.lang-switcher__option--active {
  color: var(--accent);
  font-weight: 600;
}
.lang-switcher__option--active::after {
  content: '✓';
  margin-left: auto;
  font-size: 0.7rem;
}

/* === Share Dropdown === */
.share-wrap {
  position: relative;
}
.share-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 1000;
  min-width: 160px;
}
.share-dropdown--open { display: block; }
.share-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.share-dropdown__item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* === Feedback Modal === */
.feedback-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.feedback-modal--open {
  display: flex;
}
.feedback-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.feedback-modal__dialog {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.feedback-modal__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.feedback-modal__desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}
.feedback-modal__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feedback-modal__input,
.feedback-modal__textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color var(--transition);
  box-sizing: border-box;
}
.feedback-modal__input:focus,
.feedback-modal__textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.feedback-modal__textarea {
  resize: vertical;
  min-height: 80px;
}
.feedback-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}
.feedback-modal__status {
  font-size: 0.78rem;
  margin-top: 8px;
  text-align: center;
  min-height: 20px;
}
.feedback-modal__status--success { color: #22C55E; }
.feedback-modal__status--error { color: var(--severity-critical); }

/* === RTL Support === */
[dir="rtl"] .event-card__bar { left: auto; right: 0; }
[dir="rtl"] .sidebar { left: 0; right: auto; }
[dir="rtl"] .lang-switcher__dropdown { left: 0; right: auto; }
[dir="rtl"] .share-dropdown { right: auto; left: 0; }
[dir="rtl"] .feedback-fab { right: auto; left: 16px; }
[dir="rtl"] .sidebar-toggle { right: auto; left: 16px; }
