html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #050608;
  color: #f3f3f3;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

a {
  color: #82152c;
}

a:hover {
  opacity: 0.85;
}

#incident-card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 320px;
  background: rgba(10, 10, 18, 0.96);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  font-size: 13px;
  line-height: 1.4;
  z-index: 1000;
}

#incident-card.hidden {
  display: none;
}

#incident-card h2 {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 600;
  color: #f3f3f3;
}

#incident-card .meta {
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 11px;
  color: #9aa0b0;
  margin-bottom: 8px;
}

#incident-card .summary {
  margin-bottom: 10px;
  color: #d0d0d0;
}

#incident-card button,
#incident-card a.cta {
  display: inline-block;
  margin-top: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #82152c;
  background: #82152c;
  color: #f3f3f3;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

#incident-card a.cta:hover {
  background: #9a1a36;
  opacity: 1;
}

#incident-card button.close {
  float: right;
  background: transparent;
  border: none;
  color: #666b7a;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  margin: 0 0 6px 6px;
}

#incident-card button.close:hover {
  color: #f3f3f3;
}

#incident-card .badge-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

#incident-card .impact-badge,
#incident-card .category-badge {
  display: inline-block;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#incident-card .impact-badge {
  border: 1px solid;
}

#incident-card .impact-high {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.5);
  color: #fca5a5;
}

#incident-card .impact-medium {
  background: rgba(251, 146, 60, 0.15);
  border-color: rgba(251, 146, 60, 0.5);
  color: #fdba74;
}

#incident-card .impact-low {
  background: rgba(156, 163, 175, 0.15);
  border-color: rgba(156, 163, 175, 0.5);
  color: #d1d5db;
}

#incident-card .category-badge {
  background: rgba(100, 100, 120, 0.2);
  border: 1px solid rgba(100, 100, 120, 0.4);
  color: #b4b8c4;
}

#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 8, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(130, 21, 44, 0.15);
  border-top: 4px solid #82152c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 13px;
  color: #82152c;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
}

#legend {
  position: absolute;
  bottom: 35px;
  right: 15px;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.legend-title {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #82152c;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.legend-toggle {
  background: transparent;
  border: 1px solid rgba(130, 21, 44, 0.3);
  color: #82152c;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
  font-weight: 700;
}

.legend-toggle:hover {
  background: rgba(130, 21, 44, 0.15);
  border-color: #82152c;
}

#legend.collapsed {
  padding: 10px 12px;
}

#legend.collapsed .legend-header {
  margin-bottom: 0;
}

#legend-content {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#legend.collapsed #legend-content {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.legend-label {
  font-size: 11px;
  color: #d4d4d8;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: nowrap;
}

#filters-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10, 10, 18, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(100, 100, 120, 0.15);
  padding: 12px 16px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  flex-wrap: wrap;
}

.branding {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}

.branding .logo {
  height: 28px;
  width: auto;
}

.branding .recon-text {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.toggle-btn {
  background: rgba(100, 100, 120, 0.1);
  border: 1px solid rgba(100, 100, 120, 0.25);
  color: #d4d4d8;
  margin-left: 8px;
  font-size: 16px;
  padding: 7px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  font-weight: 600;
}

.toggle-btn:hover {
  background: rgba(100, 100, 120, 0.2);
  border-color: rgba(100, 100, 120, 0.4);
  transform: translateY(-1px);
}

.risk-toggle-btn {
  background: rgba(100, 100, 120, 0.1);
  border: 1px solid rgba(100, 100, 120, 0.25);
  color: #d4d4d8;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  font-weight: 500;
  white-space: nowrap;
}

.risk-toggle-btn:hover {
  background: rgba(100, 100, 120, 0.2);
  border-color: rgba(100, 100, 120, 0.4);
}

.risk-toggle-btn.active {
  background: rgba(130, 21, 44, 0.3);
  border-color: #82152c;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(130, 21, 44, 0.4);
}

.risk-toggle-btn.active:hover {
  background: rgba(130, 21, 44, 0.4);
}

#search-input {
  flex: 1;
  min-width: 220px;
  background: transparent;
  border: 1px solid rgba(100, 100, 120, 0.25);
  border-radius: 4px;
  padding: 6px 10px;
  color: #d4d4d8;
  font-size: 13px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#search-input:focus {
  outline: none;
  border-color: rgba(130, 21, 44, 0.8);
  box-shadow: 0 0 0 2px rgba(130, 21, 44, 0.3);
}

#search-input::placeholder {
  color: #6b7280;
}

#time-filter,
#region-filter,
#impact-filter,
#category-filter {
  background: transparent;
  border: 1px solid rgba(100, 100, 120, 0.25);
  border-radius: 4px;
  padding: 6px 28px 6px 10px;
  color: #d4d4d8;
  font-size: 13px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  min-width: 130px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4d4d8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

#time-filter:hover,
#region-filter:hover,
#impact-filter:hover,
#category-filter:hover {
  border-color: rgba(100, 100, 120, 0.4);
}

#time-filter:focus,
#region-filter:focus,
#impact-filter:focus,
#category-filter:focus {
  outline: none;
  border-color: rgba(130, 21, 44, 0.8);
  box-shadow: 0 0 0 2px rgba(130, 21, 44, 0.3);
}

.stats-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.stat-badge {
  font-size: 13px;
  font-weight: 700;
  font-family: "DM Mono", ui-monospace, monospace;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#incident-counter {
  color: #82152c;
  background: rgba(130, 21, 44, 0.15);
  border: 1px solid rgba(130, 21, 44, 0.3);
}

.stat-badge.secondary {
  color: #9aa0b0;
  background: rgba(100, 100, 120, 0.08);
  border: 1px solid rgba(100, 100, 120, 0.2);
  font-size: 12px;
  font-weight: 600;
}

.stat-badge.secondary:hover {
  background: rgba(100, 100, 120, 0.12);
  border-color: rgba(100, 100, 120, 0.3);
}

@media (max-width: 900px) {
  #filters-bar {
    gap: 8px;
  }
  
  #time-filter,
  #region-filter,
  #impact-filter,
  #category-filter {
    min-width: 120px;
  }
}

@media (max-width: 600px) {
  #filters-bar {
    padding: 8px 10px;
  }
  
  #search-input {
    flex-basis: 100%;
    order: 10;
  }
  
  .stats-container {
    margin-left: 0;
    order: 11;
  }
  
  #sidebar {
    top: 100px;
    max-height: calc(100vh - 110px);
  }
}

@media (max-width: 400px) {
  #filters-bar {
    gap: 6px;
    padding: 6px 8px;
  }
  
  #time-filter,
  #region-filter,
  #impact-filter,
  #category-filter {
    min-width: 100px;
    font-size: 12px;
  }
  
  #sidebar {
    top: 120px;
    max-height: calc(100vh - 130px);
    width: calc(100% - 20px);
  }
}

#sidebar {
  position: absolute;
  top: 65px;
  left: 12px;
  width: 300px;
  max-height: calc(100vh - 75px);
  background: rgba(10, 10, 18, 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 10px;
  z-index: 1500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.hidden {
  display: none;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(130, 21, 44, 0.3);
  background: rgba(0, 0, 0, 0.2);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #82152c;
  font-family: "DM Mono", ui-monospace, monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.close-btn {
  background: rgba(130, 21, 44, 0.1);
  border: 1px solid rgba(130, 21, 44, 0.4);
  color: #82152c;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
}

.close-btn:hover {
  background: rgba(130, 21, 44, 0.25);
  border-color: #82152c;
  box-shadow: 0 0 8px rgba(130, 21, 44, 0.3);
  transform: scale(1.05);
}

#incident-list {
  overflow-y: auto;
  padding: 10px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.incident-item {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(100, 100, 120, 0.25);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.incident-item:hover {
  border-color: rgba(100, 100, 120, 0.5);
  background: rgba(130, 21, 44, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  transform: translateX(4px);
}

.incident-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #f3f3f3;
  margin-bottom: 6px;
  line-height: 1.4;
}

.incident-item-meta {
  font-size: 11px;
  color: #9aa0b0;
  font-family: "DM Mono", ui-monospace, monospace;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.incident-item-age {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.incident-item-age.new {
  background: rgba(130, 21, 44, 0.3);
  color: #d4a574;
}

.incident-item-age.recent {
  background: rgba(130, 21, 44, 0.2);
  color: #c9986b;
}

.incident-item-age.old {
  background: rgba(130, 21, 44, 0.15);
  color: #9aa0b0;
}

/* Marker cluster styling */
.marker-cluster-small {
  background-color: rgba(130, 21, 44, 0.6);
}

.marker-cluster-small div {
  background-color: rgba(130, 21, 44, 0.8);
}

.marker-cluster-medium {
  background-color: rgba(204, 51, 51, 0.6);
}

.marker-cluster-medium div {
  background-color: rgba(204, 51, 51, 0.8);
}

.marker-cluster-large {
  background-color: rgba(255, 0, 0, 0.6);
}

.marker-cluster-large div {
  background-color: rgba(255, 0, 0, 0.8);
}

.marker-cluster {
  background-clip: padding-box;
  border-radius: 20px;
}

.marker-cluster div {
  width: 30px;
  height: 30px;
  margin-left: 5px;
  margin-top: 5px;
  text-align: center;
  border-radius: 15px;
  font-family: "DM Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 12px;
}

.marker-cluster span {
  line-height: 30px;
  color: #f3f3f3;
}

/* Position Leaflet zoom controls below filter bar on the right */
.leaflet-top.leaflet-left {
  left: auto !important;
  right: 15px;
  top: 120px;
}

/* Risk overlay tooltip styling */
.risk-tooltip {
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #d4d4d8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Country detail modal */
.country-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.country-modal-content {
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.country-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(100, 100, 120, 0.2);
  border: 1px solid rgba(100, 100, 120, 0.3);
  color: #d4d4d8;
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.country-modal-close:hover {
  background: rgba(130, 21, 44, 0.3);
  border-color: #82152c;
}

.country-modal-content h2 {
  color: #f3f3f3;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 24px;
  margin: 0 0 12px 0;
  font-weight: 700;
}

.country-modal-content h3 {
  color: #d4d4d8;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 16px;
  margin: 20px 0 12px 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.country-risk-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.country-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-box {
  background: rgba(100, 100, 120, 0.1);
  border: 1px solid rgba(100, 100, 120, 0.2);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.stat-label {
  font-size: 11px;
  color: #9aa0b0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 20px;
  color: #f3f3f3;
  font-weight: 700;
  font-family: "DM Mono", ui-monospace, monospace;
}

.impact-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.impact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4d4d8;
  font-size: 14px;
}

.impact-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.impact-badge.high {
  background: #dc2626;
  color: #fff;
}

.impact-badge.medium {
  background: #fb923c;
  color: #fff;
}

.impact-badge.low {
  background: #fbbf24;
  color: #000;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.category-item {
  background: rgba(100, 100, 120, 0.15);
  border: 1px solid rgba(100, 100, 120, 0.25);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #d4d4d8;
}

.filter-to-country-btn {
  width: 100%;
  background: rgba(130, 21, 44, 0.3);
  border: 1px solid #82152c;
  color: #f3f3f3;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 12px;
}

.filter-to-country-btn:hover {
  background: rgba(130, 21, 44, 0.5);
  box-shadow: 0 0 12px rgba(130, 21, 44, 0.4);
}

.no-incidents {
  color: #9aa0b0;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* Enhanced Country Profile - HOZINT-style */
.country-modal-content.enhanced {
  max-width: 700px;
  max-height: 85vh;
}

.profile-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(100, 100, 120, 0.2);
}

.profile-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.profile-rank {
  background: rgba(130, 21, 44, 0.3);
  border: 1px solid #82152c;
  color: #f3f3f3;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-family: "DM Mono", ui-monospace, monospace;
}

.profile-score-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.profile-total-score {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  letter-spacing: 1px;
}

.profile-level {
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.profile-meta {
  font-size: 12px;
  color: #9aa0b0;
  font-family: "DM Mono", ui-monospace, monospace;
}

.profile-trend-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.profile-trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 13px;
  font-family: "DM Mono", ui-monospace, monospace;
}

.profile-trend-badge.worsening {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(220, 38, 38, 0.1);
}

.profile-trend-badge.worsening .trend-icon {
  color: #dc2626;
}

.profile-trend-badge.improving {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}

.profile-trend-badge.improving .trend-icon {
  color: #22c55e;
}

.profile-trend-badge.stable {
  border-color: rgba(249, 115, 22, 0.3);
  background: rgba(249, 115, 22, 0.1);
}

.profile-trend-badge.stable .trend-icon {
  color: #f97316;
}

.trend-delta {
  font-size: 11px;
  color: #9ca3af;
  margin-left: 4px;
}

.trend-sparkline {
  display: flex;
  align-items: center;
}

.sparkline-svg {
  display: block;
}

.trend-icon {
  font-size: 16px;
  font-weight: 700;
}

.trend-icon.up {
  color: #f87171;
}

.trend-icon.down {
  color: #4ade80;
}

.trend-icon.stable {
  color: #fbbf24;
}

.trend-text {
  font-weight: 600;
  color: #d4d4d8;
}

.trend-percent {
  font-weight: 700;
  color: #f3f4f6;
  font-size: 14px;
}

.trend-period {
  color: #9ca3af;
  font-size: 11px;
}

/* Profile Tabs */
.profile-tabs {
  margin-bottom: 16px;
}

.profile-tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid rgba(100, 100, 120, 0.3);
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.profile-tabs-nav::-webkit-scrollbar {
  display: none;
}

.profile-tab {
  background: transparent;
  border: none;
  color: #9aa0b0;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  font-family: inherit;
}

.profile-tab:hover {
  color: #d4d4d8;
  background: rgba(255, 255, 255, 0.05);
}

.profile-tab.active {
  color: #82152c;
  border-bottom-color: #82152c;
  background: rgba(130, 21, 44, 0.1);
}

.profile-tabs-content {
  min-height: 200px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabFadeIn 0.2s ease;
}

@keyframes tabFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-content-inner {
  padding: 4px 0;
}

.profile-subsection {
  margin-bottom: 20px;
}

.profile-subsection h4 {
  font-size: 13px;
  font-weight: 600;
  color: #82152c;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-subsection p {
  font-size: 14px;
  line-height: 1.7;
  color: #d4d4d8;
  margin: 0;
}

/* Sub-field styling for nested profile data */
.profile-subsection .sub-field {
  font-size: 14px;
  line-height: 1.7;
  color: #d4d4d8;
  margin-bottom: 12px;
  padding-left: 0;
}

.profile-subsection .sub-field strong {
  color: #9aa0b0;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.profile-subsection .sub-field:last-child {
  margin-bottom: 0;
}

/* IIRF Religious Freedom Index Styles */
.iirf-section {
  background: rgba(25, 25, 40, 0.6);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.iirf-section h4 {
  color: #9aa0b0;
  margin-bottom: 16px;
}

.iirf-score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.iirf-score-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.iirf-score-label {
  font-size: 11px;
  font-weight: 600;
  color: #9aa0b0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.iirf-score-bar {
  height: 8px;
  background: rgba(50, 50, 60, 0.8);
  border-radius: 4px;
  overflow: hidden;
}

.iirf-score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.iirf-score-value {
  font-size: 12px;
  font-weight: 600;
  color: #d4d4d8;
  font-family: 'DM Mono', monospace;
}

.iirf-findings {
  font-size: 13px;
  line-height: 1.6;
  color: #b0b0b8;
  margin: 12px 0;
  padding: 12px;
  background: rgba(15, 15, 25, 0.5);
  border-radius: 6px;
  border-left: 3px solid rgba(130, 21, 44, 0.5);
}

.iirf-source {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(100, 100, 120, 0.2);
}

.iirf-source a {
  font-size: 11px;
  color: #6b7280;
  text-decoration: none;
  transition: color 0.2s;
}

.iirf-source a:hover {
  color: #82152c;
}

@media (max-width: 768px) {
  .iirf-score-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.concerns-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.concerns-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #d4d4d8;
}

.concerns-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #82152c;
  font-weight: 700;
}

.emergency-contacts {
  background: rgba(130, 21, 44, 0.1);
  border: 1px solid rgba(130, 21, 44, 0.3);
  border-radius: 8px;
  padding: 16px;
}

.contact-card {
  margin-bottom: 12px;
}

.contact-card:last-child {
  margin-bottom: 0;
}

.contact-label {
  font-size: 12px;
  font-weight: 600;
  color: #82152c;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-item {
  font-size: 13px;
  color: #d4d4d8;
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.contact-item a {
  color: #60a5fa;
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
}

.contact-icon {
  font-size: 14px;
  min-width: 18px;
}

.risk-level-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(100, 100, 120, 0.3);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  color: #d4d4d8;
}

.no-data-note {
  color: #6b7280;
  font-style: italic;
  text-align: center;
  padding: 40px 20px;
}

.data-source-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 8px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.data-source-badge.official {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.data-source-badge.synthesized {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}

.badge-icon {
  font-size: 14px;
  font-weight: 700;
}

.badge-text {
  flex: 1;
}

.data-disclaimer {
  background: rgba(100, 100, 120, 0.15);
  border-left: 3px solid rgba(251, 191, 36, 0.6);
  padding: 12px 14px;
  margin: 8px 0 16px 0;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.6;
  color: #d4d4d8;
}

.data-disclaimer strong {
  color: #fbbf24;
  font-weight: 600;
}

.profile-section {
  margin: 24px 0;
  padding: 20px 0;
  border-bottom: 1px solid rgba(100, 100, 120, 0.1);
}

.profile-section:last-of-type {
  border-bottom: none;
}

.profile-narrative {
  color: #d4d4d8;
  line-height: 1.7;
  font-size: 14px;
  text-align: justify;
}

.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.dimension-badge {
  background: rgba(100, 100, 120, 0.08);
  border: 1px solid rgba(100, 100, 120, 0.2);
  border-radius: 8px;
  padding: 12px;
}

.dimension-label {
  font-size: 11px;
  color: #9aa0b0;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
  font-weight: 600;
}

.dimension-score-bar {
  background: rgba(100, 100, 120, 0.15);
  border-radius: 4px;
  height: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.dimension-score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease-out;
}

.dimension-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.dimension-score {
  color: #d4d4d8;
  font-family: "DM Mono", ui-monospace, monospace;
  font-weight: 600;
}

.dimension-severity {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.incidents-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.incident-list-item-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.incident-list-item {
  background: rgba(100, 100, 120, 0.08);
  border: 1px solid rgba(100, 100, 120, 0.2);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.incident-list-item-link:hover .incident-list-item {
  background: rgba(100, 100, 120, 0.15);
  border-color: rgba(130, 21, 44, 0.5);
  transform: translateX(4px);
}

.incident-list-title {
  color: #f3f3f3;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.incident-list-meta {
  color: #9aa0b0;
  font-size: 11px;
  font-family: "DM Mono", ui-monospace, monospace;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-all-btn {
  width: 100%;
  background: rgba(130, 21, 44, 0.2);
  border: 1px solid rgba(130, 21, 44, 0.5);
  color: #f3f3f3;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 12px;
}

.view-all-btn:hover {
  background: rgba(130, 21, 44, 0.4);
  box-shadow: 0 0 12px rgba(130, 21, 44, 0.3);
}

.profile-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(100, 100, 120, 0.1);
}

.profile-source {
  font-size: 11px;
  color: #6b7280;
  font-family: "DM Mono", ui-monospace, monospace;
}

.profile-note {
  color: #9aa0b0;
  font-size: 13px;
  font-style: italic;
  padding: 12px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  margin-bottom: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(130, 21, 44, 0.2);
  border-top-color: #82152c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* Threat Actor Cards */
.threat-actors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.threat-actor-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.threat-actor-card {
  background: rgba(100, 100, 120, 0.08);
  border: 1px solid rgba(100, 100, 120, 0.2);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.threat-actor-card-link:hover .threat-actor-card {
  background: rgba(100, 100, 120, 0.15);
  border-color: rgba(220, 38, 38, 0.5);
  transform: translateX(4px);
}

.threat-actor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 12px;
}

.threat-actor-name {
  color: #f3f3f3;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.threat-actor-type {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.threat-actor-summary {
  color: #d4d4d8;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.threat-actor-countries {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(100, 100, 120, 0.15);
}

.countries-label {
  color: #9ca3af;
  font-size: 11px;
  margin-right: 4px;
}

.country-tag {
  background: rgba(100, 100, 120, 0.15);
  color: #a1a1aa;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   Auto-detects screen size and optimizes layout
   ============================================ */

/* Mobile toggle button for sidebar */
.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 80px;
  left: 12px;
  background: rgba(130, 21, 44, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid #82152c;
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 1600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  align-items: center;
  justify-content: center;
}

.mobile-sidebar-toggle:active {
  transform: scale(0.95);
}

/* Tablet optimization (768px - 480px) */
@media (max-width: 768px) {
  /* Adjust filter bar */
  #filters-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  
  .branding .recon-text {
    font-size: 14px;
  }
  
  #search-input {
    min-width: 180px;
  }
  
  #time-filter,
  #region-filter,
  #impact-filter,
  #category-filter {
    min-width: 110px;
    font-size: 12px;
  }
  
  /* Adjust sidebar */
  #sidebar {
    width: 280px;
  }
  
  /* Adjust modals */
  .country-modal-content {
    max-width: 90%;
    padding: 20px;
  }
  
  .country-modal-content.enhanced {
    max-width: 90%;
  }
  
  .dimensions-grid {
    grid-template-columns: 1fr;
  }
  
  .country-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}

/* Mobile optimization - Portrait orientation (incidents default) */
@media (max-width: 768px) and (orientation: portrait) {
  /* Filter bar - compact mobile layout */
  #filters-bar {
    padding: 8px;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
  }
  
  .branding {
    width: 100%;
    justify-content: space-between;
  }
  
  .branding .recon-text {
    font-size: 14px;
  }
  
  /* Stack filters in mobile layout */
  .filter-row-mobile {
    display: flex;
    gap: 6px;
    width: 100%;
  }
  
  #search-input {
    width: 100%;
    min-width: auto;
    margin-bottom: 6px;
    font-size: 14px;
    padding: 8px;
  }
  
  #time-filter,
  #region-filter,
  #impact-filter,
  #category-filter {
    flex: 1;
    min-width: auto;
    font-size: 13px;
    padding: 8px 24px 8px 8px;
  }
  
  .toggle-btn {
    padding: 8px 12px;
    font-size: 14px;
  }
  
  .risk-toggle-btn {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
  }
  
  .stats-container {
    width: 100%;
    justify-content: space-between;
  }
  
  .stat-badge {
    font-size: 13px;
    padding: 6px 12px;
  }
  
  .stat-badge.secondary {
    font-size: 12px;
  }
  
  /* Sidebar - VISIBLE by default in portrait (incidents feed) */
  #sidebar {
    top: auto;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: 12px 12px 0 0;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 800;
    display: flex;
  }
  
  /* Mobile-hidden class - hides sidebar in portrait when user toggles to map */
  #sidebar.mobile-hidden {
    transform: translateY(100%);
  }
  
  /* Standard hidden class - maintains desktop behavior */
  #sidebar.hidden {
    transform: translateY(100%);
  }
  
  .mobile-sidebar-toggle {
    display: flex;
    z-index: 900;
  }
  
  .mobile-sidebar-toggle.hidden {
    display: none;
  }
  
  /* Map - hidden by default in portrait, accessible via toggle */
  #map {
    height: 100vh;
  }
  
  /* Incident list items - larger tap targets and readable text */
  .incident-item {
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
  }
  
  .incident-item-title {
    font-size: 16px;
    line-height: 1.4;
  }
  
  .incident-location,
  .incident-meta {
    font-size: 14px;
  }
  
  .incident-summary {
    font-size: 14px;
    line-height: 1.5;
  }
  
  /* Legend - smaller and repositioned */
  #legend {
    bottom: 20px;
    right: 10px;
    padding: 8px 10px;
    font-size: 11px;
  }
  
  .legend-title {
    font-size: 10px;
  }
  
  .legend-marker {
    width: 12px;
    height: 12px;
  }
  
  .legend-label {
    font-size: 11px;
  }
  
  /* Map zoom controls - reposition for mobile */
  .leaflet-top.leaflet-left {
    top: auto !important;
    bottom: 85px;
    right: 10px;
  }
  
  .leaflet-control-zoom {
    border: 1px solid rgba(100, 100, 120, 0.3) !important;
  }
  
  .leaflet-control-zoom a {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    font-size: 22px !important;
  }
  
  /* Country modals - full screen on mobile */
  .country-modal {
    padding: 0;
    align-items: stretch;
  }
  
  .country-modal-content {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 18px;
    margin: 0;
  }
  
  .country-modal-content.enhanced {
    max-width: 100%;
    max-height: 100vh;
  }
  
  .country-modal-content h2 {
    font-size: 22px;
    margin-right: 40px;
  }
  
  .country-modal-content h3 {
    font-size: 16px;
  }
  
  .country-modal-close {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  
  /* Profile cards - stack on mobile */
  .country-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .stat-box {
    padding: 12px;
  }
  
  .stat-label {
    font-size: 12px;
  }
  
  .stat-value {
    font-size: 20px;
  }
  
  .profile-total-score {
    font-size: 30px;
    padding: 8px 18px;
  }
  
  .profile-level {
    font-size: 16px;
  }
  
  .dimensions-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  
  .profile-narrative {
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
  }
  
  /* Buttons - larger tap targets */
  .filter-to-country-btn,
  .view-all-btn {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
  }
  
  /* Incident card - hide floating card on portrait mobile */
  #incident-card {
    display: none;
  }
}

/* Mobile optimization - Landscape orientation (map default) */
@media (max-width: 768px) and (orientation: landscape) {
  /* Filter bar - horizontal compact layout */
  #filters-bar {
    padding: 6px 8px;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .branding .recon-text {
    font-size: 13px;
  }
  
  #search-input {
    min-width: 200px;
    font-size: 13px;
  }
  
  #time-filter,
  #region-filter,
  #impact-filter,
  #category-filter {
    font-size: 12px;
    padding: 6px 20px 6px 8px;
  }
  
  .stat-badge {
    font-size: 12px;
    padding: 5px 10px;
  }
  
  /* Sidebar - HIDDEN by default in landscape (map view) */
  #sidebar {
    top: auto;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 50vh;
    border-radius: 12px 12px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 800;
    display: flex;
  }
  
  /* Mobile-visible class - shows sidebar in landscape when user toggles to incidents */
  #sidebar.mobile-visible {
    transform: translateY(0);
  }
  
  /* Mobile-hidden class - keeps sidebar hidden in landscape */
  #sidebar.mobile-hidden {
    transform: translateY(100%);
  }
  
  /* Standard hidden class - maintains desktop behavior */
  #sidebar.hidden {
    transform: translateY(100%);
  }
  
  .mobile-sidebar-toggle {
    display: flex;
    z-index: 900;
  }
  
  .mobile-sidebar-toggle.hidden {
    display: none;
  }
  
  /* Map - full screen by default in landscape */
  #map {
    height: 100vh;
  }
  
  /* Incident list items */
  .incident-item {
    padding: 12px;
    margin-bottom: 10px;
  }
  
  .incident-item-title {
    font-size: 15px;
  }
  
  .incident-location,
  .incident-meta {
    font-size: 13px;
  }
  
  /* Legend */
  #legend {
    bottom: 15px;
    right: 10px;
    padding: 6px 8px;
    font-size: 10px;
  }
  
  /* Map zoom controls */
  .leaflet-top.leaflet-left {
    top: auto !important;
    bottom: 70px;
    right: 10px;
  }
  
  .leaflet-control-zoom a {
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 20px !important;
  }
  
  /* Country modals - slightly smaller in landscape */
  .country-modal-content {
    max-width: 90%;
    max-height: 90vh;
    padding: 16px;
  }
  
  .country-modal-content h2 {
    font-size: 20px;
  }
  
  .country-modal-content h3 {
    font-size: 15px;
  }
  
  /* Incident card - hide in landscape too */
  #incident-card {
    display: none;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Increase all tap targets for touch */
  button,
  a,
  .incident-item,
  select {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .incident-item:hover {
    transform: none;
  }
  
  .toggle-btn:hover,
  .risk-toggle-btn:hover {
    transform: none;
  }
}

/* MOBILE-FIRST REDESIGN: Bottom Sheet & Filter Modal */

/* Hide mobile-only elements on desktop */
.mobile-filters-btn {
  display: none;
}

/* Hide desktop-only elements on mobile */
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
}

/* Mobile Filter Modal */
.mobile-filter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 6, 8, 0.92);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  transition: opacity 0.3s ease;
}

.mobile-filter-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.mobile-filter-content {
  width: 100%;
  max-height: 85vh;
  background: rgba(15, 15, 25, 0.98);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-filter-modal.hidden .mobile-filter-content {
  transform: translateY(100%);
}

.mobile-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px 20px;
  border-bottom: 1px solid rgba(100, 100, 120, 0.2);
}

.mobile-filter-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #f3f3f3;
}

.mobile-filter-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #9aa0b0;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  background: rgba(25, 25, 35, 0.8);
  border: 1px solid rgba(100, 100, 120, 0.3);
  border-radius: 8px;
  color: #f3f3f3;
  outline: none;
  transition: border-color 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
  border-color: #82152c;
}

.mobile-risk-toggle {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  background: rgba(25, 25, 35, 0.8);
  border: 2px solid rgba(100, 100, 120, 0.3);
  border-radius: 8px;
  color: #9aa0b0;
  cursor: pointer;
  transition: all 0.2s;
}

.mobile-risk-toggle.active {
  background: rgba(130, 21, 44, 0.2);
  border-color: #82152c;
  color: #82152c;
}

.mobile-filter-footer {
  padding: 16px 20px 20px 20px;
  border-top: 1px solid rgba(100, 100, 120, 0.2);
}

.apply-filters-btn {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  background: #82152c;
  border: none;
  border-radius: 12px;
  color: #f3f3f3;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 56px;
}

.apply-filters-btn:active {
  background: #9a1a36;
}

/* Mobile Filters Button */
@media (max-width: 768px) {
  .mobile-filters-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(25, 25, 35, 0.9);
    border: 1px solid rgba(100, 100, 120, 0.3);
    border-radius: 8px;
    color: #f3f3f3;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
    z-index: 1001;
  }
  
  .mobile-filters-btn:active {
    background: rgba(35, 35, 45, 0.95);
  }
  
  /* Hide desktop filter controls on mobile */
  #search-input,
  #time-filter,
  #region-filter,
  #impact-filter,
  #category-filter,
  #toggle-risk-overlay,
  #toggle-sidebar {
    display: none !important;
  }
  
  /* Simplified mobile header */
  #filters-bar {
    padding: 12px 16px;
    gap: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .branding {
    flex: 1;
  }
  
  .branding .logo {
    height: 32px;
  }
  
  .branding .recon-text {
    font-size: 18px;
  }
  
  .stats-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  
  .stat-badge {
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* Bottom Sheet Pointer Events (only when bottom-sheet-active class is present) */
body.bottom-sheet-active #sidebar:not(.sheet-expanded) {
  pointer-events: none;
}

body.bottom-sheet-active #sidebar:not(.sheet-expanded) .bottom-sheet-handle,
body.bottom-sheet-active #sidebar:not(.sheet-expanded) .bottom-sheet-peek {
  pointer-events: auto;
}

body.bottom-sheet-active #sidebar.sheet-expanded {
  pointer-events: auto;
}

body.bottom-sheet-active #sidebar .incident-list {
  pointer-events: auto;
}

/* Bottom Sheet Component (Mobile Only) */
@media (max-width: 768px) {
  /* Mobile Typography: Increase base font sizes for readability */
  body {
    font-size: 18px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 22px;
  }
  
  h3 {
    font-size: 20px;
  }
  
  p, li, span {
    font-size: 18px;
    line-height: 1.6;
  }
  
  .bottom-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(100, 100, 120, 0.5);
    border-radius: 2px;
    margin: 12px auto 0 auto;
    cursor: grab;
  }
  
  .bottom-sheet-peek {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(100, 100, 120, 0.2);
    cursor: pointer;
    user-select: none;
  }
  
  .peek-content {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .peek-count {
    font-size: 18px;
    font-weight: 700;
    color: #f3f3f3;
  }
  
  .peek-chevron {
    color: #9aa0b0;
    transition: transform 0.3s;
  }
  
  #sidebar.sheet-expanded .peek-chevron {
    transform: rotate(180deg);
  }
  
  /* Sidebar becomes bottom sheet on mobile */
  #sidebar {
    position: fixed;
    top: auto;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 20vh;
    max-height: 20vh;
    background: rgba(15, 15, 25, 0.98);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  #sidebar.sheet-expanded {
    max-height: 70vh;
  }
  
  .sidebar-header {
    display: none;
  }
  
  .incident-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 0 16px 20px 16px;
  }
  
  /* Larger touch targets for incident items */
  .incident-item {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    min-height: 80px;
  }
  
  .incident-item-title {
    font-size: 18px;
    line-height: 1.4;
    margin-bottom: 6px;
  }
  
  .incident-location {
    font-size: 15px;
    margin-bottom: 4px;
  }
  
  .incident-meta {
    font-size: 14px;
  }
  
  /* Ensure map is not covered by bottom sheet */
  #map {
    height: calc(100vh - 20vh);
    padding-bottom: 0;
  }
  
  #sidebar.sheet-expanded + #map {
    height: calc(100vh - 70vh);
  }
}

/* Hide bottom sheet elements on desktop */
@media (min-width: 769px) {
  .bottom-sheet-handle,
  .bottom-sheet-peek {
    display: none;
  }
  
  .mobile-filter-modal {
    display: none;
  }
}

/* ========================================
   WEEKLY SNAPSHOT STYLES
   ======================================== */

.snapshot-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(130, 21, 44, 0.3);
  border: 1px solid rgba(130, 21, 44, 0.6);
  color: #f3f3f3;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.snapshot-btn:hover {
  background: rgba(130, 21, 44, 0.5);
  border-color: #82152c;
}

.snapshot-btn svg {
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .snapshot-btn .snapshot-text {
    display: none;
  }
  .snapshot-btn {
    padding: 8px;
  }
}

/* Snapshot Overlay */
.snapshot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

/* Social media optimized: 1200x630 (1.91:1 ratio for Twitter/Facebook) */
.snapshot-container {
  width: 1200px;
  height: 630px;
  max-width: 100%;
  max-height: 90vh;
  background: linear-gradient(180deg, #08080f 0%, #0c0c14 50%, #0a0a12 100%);
  border: 2px solid rgba(130, 21, 44, 0.5);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(130, 21, 44, 0.3), 0 20px 60px rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
}

.snapshot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: linear-gradient(90deg, rgba(130, 21, 44, 0.35) 0%, rgba(130, 21, 44, 0.1) 50%, transparent 100%);
  border-bottom: 2px solid rgba(130, 21, 44, 0.4);
  flex-shrink: 0;
}

.snapshot-branding {
  display: flex;
  align-items: center;
}

.snapshot-logo-horizontal {
  height: 44px;
  width: auto;
}

.snapshot-header-right {
  text-align: right;
}

.snapshot-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.snapshot-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #82152c;
  text-transform: uppercase;
}

.snapshot-date {
  font-family: "DM Mono", monospace;
  font-size: 18px;
  font-weight: 600;
  color: #f3f3f3;
  letter-spacing: 1px;
}

.snapshot-map {
  height: 380px;
  flex: 1;
  width: 100%;
  background: #08080f;
  position: relative;
}

.snapshot-metrics {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.2fr;
  gap: 0;
  background: #0a0a12;
  border-top: 2px solid rgba(130, 21, 44, 0.4);
  flex-shrink: 0;
}

.snapshot-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(12, 12, 20, 0.95) 0%, rgba(8, 8, 15, 0.98) 100%);
  position: relative;
  border-right: 1px solid rgba(130, 21, 44, 0.25);
}

.snapshot-metric:last-child {
  border-right: none;
}

.snapshot-metric .metric-icon {
  color: #82152c;
  margin-bottom: 6px;
  opacity: 0.8;
}

.snapshot-metric .metric-icon svg {
  width: 20px;
  height: 20px;
}

.snapshot-metric .metric-value {
  font-size: 36px;
  font-weight: 800;
  color: #f3f3f3;
  margin-bottom: 4px;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.snapshot-metric .metric-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #777;
  text-transform: uppercase;
  margin-top: 4px;
}

.snapshot-metric .metric-sublabel {
  font-size: 11px;
  font-weight: 500;
  color: #999;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.snapshot-metric.threat-score-combined {
  background: linear-gradient(180deg, rgba(130, 21, 44, 0.08) 0%, rgba(8, 8, 15, 0.98) 100%);
}

/* threat-score-row deprecated - trend now stacked below score */
.threat-score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.snapshot-metric.threat-score-combined .metric-value {
  color: #ef4444;
  font-size: 42px;
}

.threat-trend {
  font-size: 14px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  margin-top: 6px;
  margin-bottom: 4px;
  text-align: center;
}

.threat-trend.worsening {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.threat-trend.improving {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.threat-trend.stable {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.3);
}


.snapshot-metric.category .metric-value {
  font-size: 24px;
  text-align: center;
}

.snapshot-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 28px;
  background: linear-gradient(90deg, rgba(130, 21, 44, 0.15) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(130, 21, 44, 0.15) 100%);
  border-top: 1px solid rgba(130, 21, 44, 0.25);
  flex-shrink: 0;
}

.snapshot-url {
  font-size: 14px;
  font-weight: 700;
  color: #82152c;
  letter-spacing: 1px;
}

/* Snapshot Controls */
.snapshot-controls {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.download-btn {
  background: linear-gradient(135deg, #82152c 0%, #6b1124 100%);
  border: none;
  color: #f3f3f3;
  padding: 14px 36px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.download-btn:hover {
  background: linear-gradient(135deg, #9a1a35 0%, #82152c 100%);
  transform: translateY(-1px);
}

.download-btn:disabled {
  background: #333;
  cursor: not-allowed;
  opacity: 0.6;
}

.close-snapshot-btn {
  background: transparent;
  border: 1px solid rgba(100, 100, 120, 0.4);
  color: #9aa0b0;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-snapshot-btn:hover {
  border-color: rgba(100, 100, 120, 0.6);
  color: #f3f3f3;
}

@media (max-width: 768px) {
  .snapshot-container {
    width: 100%;
    height: auto;
    max-height: 85vh;
  }
  
  .snapshot-header {
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
  }
  
  .snapshot-header-right {
    text-align: center;
  }
  
  .snapshot-title-block {
    align-items: center;
  }
  
  .snapshot-map {
    height: 250px;
    min-height: 200px;
  }
  
  .snapshot-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .snapshot-metric {
    padding: 16px 12px;
  }
  
  .snapshot-metric .metric-value {
    font-size: 28px;
  }
  
  .snapshot-metric .metric-icon {
    display: none;
  }
  
  .snapshot-footer {
    flex-direction: column;
    gap: 8px;
    padding: 12px 20px;
  }
  
  .snapshot-footer-left,
  .snapshot-footer-center,
  .snapshot-footer-right {
    text-align: center;
  }
}
