html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

:root {
  --ink: #0f172a;
  --muted: #475569;
  --panel: #0f172a;
  --panel-contrast: #f8fafc;
  --accent: #f97316;
  --accent-soft: #ffedd5;
  --frame: rgba(15, 23, 42, 0.08);
  --bg: #f8fafc;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.map-shell {
  position: relative;
  height: 100vh;
  width: 100%;
}

#map {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
}

#loader {
  position: fixed;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top, #ffffff 0%, #f1f5f9 100%);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.map-select-wrap {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(280px, calc(100vw - 24px));
  pointer-events: auto;
}

#countrySelect {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  border-radius: 10px;
  font-weight: 600;
  color: var(--ink);
  padding: 10px 42px 10px 18px;
  height: 44px;
  backdrop-filter: blur(14px);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16'%3E%3Cpath fill='%230f172a' d='M4.47 6.97a.75.75 0 0 1 1.06 0L8 9.44l2.47-2.47a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
}

#countrySelect:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(249, 115, 22, 0.2);
}

.modal-content {
  border-radius: 16px;
  border: 1px solid var(--frame);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2);
}

.app-modal .modal-dialog {
  max-width: min(760px, calc(100vw - 32px));
  margin: 1rem auto;
}

.app-modal .modal-content {
  max-height: calc(100vh - 2rem);
}

.modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-title {
  font-weight: 700;
}

.modal-body {
  color: var(--muted);
}

.modal-body p strong {
  color: var(--ink);
}

.modal-body .info-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--frame);
  padding: 12px 14px;
  box-shadow: 0 12px 25px rgba(15, 23, 42, 0.08);
}

.modal-body .info-grid {
  display: grid;
  gap: 12px;
}

.legend-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.legend-hero img {
  width: 56px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.legend-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 2px;
}

.legend-value {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0;
}

.glance-modal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.glance-flag {
  width: 76px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.glance-modal-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

.glance-modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

.glance-table {
  display: grid;
  gap: 10px;
}

.glance-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--frame);
  border-radius: 14px;
  background: #f8fafc;
}

.glance-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
}

.glance-row-label {
  color: var(--ink);
  font-weight: 600;
}

.glance-row-value {
  color: var(--muted);
  text-align: right;
}

.leaflet-container {
  background: #e2e8f0;
}

.leaflet-control-container {
  z-index: 1100;
}

.leaflet-top.leaflet-left {
  top: 88px;
  left: 4px;
}

.leaflet-top.leaflet-right {
  top: 88px;
  right: 4px;
}

@media (max-width: 768px) {
  .app-modal {
    padding: 14px;
  }

  .app-modal .modal-dialog {
    max-width: 100%;
    margin: 0 auto;
  }

  .app-modal .modal-content {
    max-height: 78vh;
    border-radius: 14px;
  }

  .glance-modal-head {
    align-items: flex-start;
  }

  .glance-row {
    grid-template-columns: 36px 1fr;
  }

  .glance-row-value {
    grid-column: 1 / -1;
    text-align: left;
    padding-left: 50px;
  }
}


.leaflet-bar a,
.leaflet-bar a:hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.leaflet-bar a:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.2);
}

.modal-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 160px;
}

.modal-loader img {
  max-width: 80px;
  height: auto;
}

.weather-panel {
  display: grid;
  gap: 18px;
}

#weatherModal .modal-content {
  overflow: hidden;
}

#weatherModal .modal-header {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-bottom: none;
}

#weatherModal .modal-body {
  background: #f3f4f6;
  padding: 24px;
}

.weather-today-card,
.weather-forecast-card {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  padding: 16px 18px;
}

.weather-card-label,
.weather-forecast-date {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.weather-today-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.weather-summary {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: capitalize;
}

.weather-today-icon {
  width: 86px;
  height: 86px;
  object-fit: contain;
}

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

.weather-temp-block strong,
.weather-forecast-temp strong {
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
}

.weather-temp-block span,
.weather-forecast-temp span {
  font-size: 1rem;
  color: #64748b;
}

.weather-forecast-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.weather-forecast-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.weather-forecast-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.weather-forecast-temp {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.weather-forecast-desc {
  margin-top: 12px;
  color: var(--muted);
  text-transform: capitalize;
}

.weather-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  color: #64748b;
  font-size: 0.95rem;
}

@media (max-width: 768px) {
  #weatherModal .modal-body {
    padding: 18px;
  }

  .weather-today-body {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .weather-temp-block,
  .weather-forecast-temp {
    align-items: flex-start;
  }

  .weather-forecast-grid {
    grid-template-columns: 1fr;
  }
}
