body {
  font-family: 'IBM Plex Sans', 'Segoe UI', 'Roboto', Arial, sans-serif;
  background-color: #F1F5F9;
}

:root {
  --color-bg:#f4f6f8;
  --color-panel: #fff;
  --color-accent: #043e52;
  --color-accent-dark: #065068;
  --color-red: #FC3E3E;
  --color-yellow: #FFC833;
  --color-green: #00BC57;
  --color-border: #e4e8f0;
  --color-shadow: 0 2px 16px rgba(27, 41, 90, 0.07);
  --radius: 16px;
  --radius-btn: 8px;
  --font-main: 'Segoe UI', 'Arial', sans-serif;
  --transition: 0.2s;
}
* {margin: 0; padding: 0; box-sizing: border-box;}
html, body {height: 100%; min-height: 100%;}
body {
  background: var(--color-bg);
  font-family: var(--font-main);
  color: #273044;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {display: flex; align-items: center; padding: 1.5rem 2rem; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.06); min-height: 70px;}
.logo {height: 44px;}
nav {margin-left: 2rem; display: flex; gap: 1.2rem;}
nav a {text-decoration: none; color: #043E52; font-weight: 500; font-size: 1rem; padding: 0.5rem 1.2rem; border-radius: 6px; transition: background var(--transition);}
nav a.active,nav a:hover {color: var(--color-accent); background: #f0f7f7;}
main {flex: 1 0 auto; display: grid; grid-template-columns: 320px 1fr 320px; gap: 2rem; padding: 2rem 2rem 0 2rem; min-height: 0;}
.left-panel, .right-panel, .map-container {background: var(--color-panel); border-radius: var(--radius); box-shadow: var(--color-shadow); padding: 2rem 1.5rem; display: flex; flex-direction: column; min-width: 0;}
/* Search row */
.search-row {display: flex; align-items: center; gap: 0.45rem; margin-bottom: 1.3rem;}
.search-row input[type="search"] {
  flex: 1 1 120px;
  min-width: 0;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  padding: 0.6rem 1rem;
  font-size: 1rem;
  background: #f8fafc;
  transition: border-color var(--transition);
}
.search-row input[type="search"]:focus { border-color: var(--color-accent);}
.notification-btn, .legend-btn {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.18rem;
  color: #49536b;
  cursor: pointer;
  transition: background 0.18s, border-color 0.2s;
  padding: 0;
}
.notification-btn:hover, .legend-btn:hover {background: #e4f1ef; border-color: var(--color-accent);}
.legend-overlay {position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.23); display: flex; justify-content: center; align-items: center; z-index: 2000;}
.legend-content {background: #fff; padding: 2rem 2.5rem; border-radius: var(--radius); position: relative; max-width: 400px; width: 92%; box-shadow: 0 6px 32px rgba(0,0,0,0.07);}
.close-legend {position: absolute; top: 1.1rem; right: 1.2rem; background: none; border: none; font-size: 1.6rem; color: #a1a1a1; cursor: pointer;}
.legend-item {display: flex; align-items: center; margin: 1.2rem 0; gap: 1.3rem; font-size: 1.07rem;}
.circle {width: 22px; height: 22px; border-radius: 50%; display: inline-block;}
.circle.red {background-color: var(--color-red);}
.circle.yellow {background-color: var(--color-yellow);}
.circle.green {background-color: var(--color-green);}
.filter-section {margin-bottom: 2rem;}
.filter-section h3 {margin-bottom: 1.3rem; font-size: 1.14rem;}
.filter-group {margin-bottom: 1.1rem;}
.filter-group label {display: block; margin-bottom: 0.4rem; font-size: 0.98rem; color: #49536b;}
select {
  width: 100%;
  padding: 0.68rem 2.5rem 0.68rem 0.9rem;
  border-radius: var(--radius-btn);
  border: 1px solid var(--color-border);
  background: #f8fafc;
  font-size: 1rem;
  margin-bottom: 0.15rem;
  color: #2d3e53;
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* هذا السهم أطول (طول 22px بدل 16px) */
  background-image: url('data:image/svg+xml;utf8,<svg fill="gray" height="22" viewBox="0 0 22 22" width="22" xmlns="http://www.w3.org/2000/svg"><path d="M7.293 9.293a1 1 0 011.414 0L11 11.586l2.293-2.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 1rem center;
}
select:focus {border-color: var(--color-accent);}
.apply-filter {width: 100%; padding: 0.92rem 0; background: var(--color-accent); color: #fff; border: none; border-radius: var(--radius-btn); font-weight: 600; font-size: 1.04rem; margin-top: 0.5rem; cursor: pointer; transition: background var(--transition);}
.apply-filter:hover {background: var(--color-accent-dark);}
.filter-results {margin-top: 2rem;}
.filter-results h3 {margin-bottom: 0.6rem; font-size: 1.1rem; font-weight: 600; color: #273044;}
.results-card {background: #f8fafc; border-radius: 12px; padding: 1.1rem 1.3rem 0.9rem 1.3rem; box-shadow: 0 1px 9px rgba(27,41,90,0.05);}
.results-header {display: flex; align-items: center; gap: 0.6rem; font-size: 1.07rem; margin-bottom: 0.88rem;}
.results-city {font-weight: 600; color: #273044; font-size: 1.05rem;}
.live-dot {display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-red);}
.results-live {color: var(--color-red); font-size: 0.98rem; font-weight: 500; margin-left: 2px;}
.results-stats {display: flex; flex-direction: column; gap: 0.3rem;}
.results-stats div {display: flex; justify-content: space-between; align-items: center; color: #35445e; font-size: 0.97rem;}
.results-stats strong {font-weight: 600; font-size: 1.02rem;}
/* Alert Modern */
.alert-modern {
  display: flex;
  align-items: flex-start;
  gap: 1.05rem;
  padding: 1.2rem 1.7rem 1.1rem 1.2rem;
  background: #fff;
  border-radius: 15px;
  border: 1px solid #D2D6DB;     /* <-- أضفت الـ stroke هنا */
  border-left: 7px solid #FC3E3E;
  box-shadow: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  margin-bottom: 1.2rem;
  min-height: 65px;
  z-index: 999;
}

.alert-modern .alert-icon {display: flex; align-items: center; justify-content: center; min-width: 40px; margin-top: 2px;}
.alert-modern .alert-content {flex: 1;}
.alert-modern .alert-title {font-weight: 700; color: #232F3E; font-size: 1.2rem; margin-bottom: 3px;}
.alert-modern .alert-desc {font-size: 1.05rem; color: #3a4353; margin-top: 2px;}
.alert-modern .alert-close {
  background: none;
  border: none;
  outline: none;
  margin-left: 16px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  width: 32px;
}
.alert-modern .alert-close {
  background: none;
  border: none;
  outline: none;
  margin-left: 16px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.alert-modern .alert-close-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  transition: background 0.16s;
  padding: 0;
}

.alert-modern .alert-close-bg:hover {
  background: #e0e3e7;
}

.alert-modern .alert-close-bg svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
}


.map-container {padding: 0; height: 100%; min-height: 520px; display: flex; flex-direction: column; overflow: hidden; position: relative; box-shadow: 0 2px 16px rgba(27, 41, 90, 0.08);}
#map {flex: 1; min-height: 420px; border-radius: var(--radius); box-shadow: 0 1px 16px rgba(27,41,90,0.13); margin-bottom: 0;}
.leaflet-control-zoom {z-index: 1000 !important;}
.right-panel {min-width: 0;}
.data-section h3 {font-size: 1.12rem; margin-bottom: 1rem;}
.microbes-chart {margin-bottom: 1.2rem;}
.covid-stats {margin-top: 1.8rem; background: #f9fafc; border-radius: 9px; padding: 1rem 1.2rem;}
.covid-stats .stat-item {display: flex; justify-content: space-between; padding: 0.52rem 0; border-bottom: 1px solid #eee; font-size: 1.01rem;}
.covid-stats .stat-item:last-child {border-bottom: none;}

.footer-main {
  width: 100%;
  background: #075267;
  color: #fff;
  font-family: 'IBM Plex Sans', 'Segoe UI', Arial, sans-serif;
  margin-top: 0;
  padding-bottom: 0;
  margin-top: 40px;
}

.footer-sections {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 85px;
  padding: 52px 80px 0 80px;
  /* الفاصل السفلي */
  margin-bottom: 100px;    /* عدل الرقم حسب المسافة المطلوبة بالضبط */
}

.footer-sections {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 85px;
  padding: 52px 80px 0 80px;
}
.footer-section {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.footer-section h4 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 11px;
  position: relative;
}
.footer-divider {
  height: 1px;
  width: 100%;
  background: #e0f2f7;
  border-radius: 2px;
  margin-bottom: 10px;
}
.footer-section a {
  color: #fff;
  text-decoration: none;
  font-size: 1.13rem;
  opacity: 0.93;
  margin-bottom: 4px;
  transition: opacity 0.18s;
}
.footer-section a:hover {
  opacity: 1;
  text-decoration: underline;
}
.social-links, .accessibility-links {
  display: flex;
  gap: 16px;
  align-items: center;
}
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #16586C;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 1.3rem;
  color: #fff;
  border: 1px solid #ffffffcd;
  height: 38px; width: 38px;
  transition: background 0.2s;
}
.icon-link:hover {
  background: #21708e;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 80px 32px 80px;
  margin-top: 28px;
}
.footer-bottom-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 330px;
}
.footer-links-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.footer-links-bottom a {
  color: #fff;
  font-size: 1.13rem;
  text-decoration: underline;
  opacity: 0.93;
}
.footer-bottom-text {
  font-size: 1.09rem;
  line-height: 1.55;
  margin-bottom: 5px;
  margin-left: 0;
  flex: 1;
  min-width: 220px;
  max-width: 440px;
}
.footer-bottom-text strong {
  display: block;
  font-size: 1.17rem;
  margin-bottom: 6px;
}
.footer-bottom-logos {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 250px;
  justify-content: flex-end;
  margin-bottom: 4px;
}
.footer-bottom-logos img {
  height: 41px;
  background: transparent;
}
@media (max-width: 1100px) {
  .footer-sections, .footer-bottom {
    padding-left: 18px;
    padding-right: 18px;
  }
  .footer-sections {
    gap: 20px;
  }
}
@media (max-width: 800px) {
  .footer-sections {
    flex-direction: column;
    gap: 18px;
    padding: 22px 6px 0 6px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 0 10px 16px 10px;
  }
  .footer-bottom-logos {
    margin-top: 14px;
  }
}

@media (max-width: 1100px) {
  main {grid-template-columns: 1fr; padding: 1.2rem 0.7rem 0 0.7rem; min-height: 0;}
  .left-panel, .right-panel, .map-container {border-radius: 0; min-width: 0; padding: 1rem;}
  .footer-content {grid-template-columns: 1fr 1fr; gap: 1.1rem;}
}
@media (max-width: 700px) {
  header {flex-direction: column; padding: 0.6rem 0.2rem;}
  .logo {height: 32px;}
  main {grid-template-columns: 1fr; gap: 0.7rem; padding: 0.3rem;}
  .footer-content {grid-template-columns: 1fr; gap: 0.7rem;}
  .left-panel, .right-panel, .map-container {border-radius: 0; padding: 0.7rem 0.2rem;}
  .legend-content {padding: 1rem 0.4rem;}
}
::-webkit-scrollbar { width: 8px; background: #e9f1f1; }
::-webkit-scrollbar-thumb { background: #b2d7d7; border-radius: 10px; }
.city-card, .hospital-card {
  position: absolute;
  min-width: 230px;
  background: rgba(255,255,255,0.97);
  border-radius: 14px;
  box-shadow: 0 6px 28px 0 rgba(27, 41, 90, 0.11);
  border: 1px solid #D2D6DB;
  padding: 1.18rem 1.15rem 1.02rem 1.2rem;
  z-index: 1600;
  pointer-events: auto;
  transition: opacity .17s;
}

.card-title {
  font-weight: 700;
  color: #232F3E;
  font-size: 1.18rem;
  margin-bottom: 0.65rem;
}
.card-stats { margin-top: 0.25rem; }
.card-stats div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.22rem;
  color: #3a4353;
}
.card-close {
  position: absolute;
  top: 13px; right: 12px;
  background: #F3F4F6;
  border-radius: 50%;
  width: 29px; height: 29px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .13s;
}
.card-close:hover { background: #e0e3e7; }
.card-close svg { width: 17px; height: 17px; }


/* Mobile Responsive Style */
/* --- Global fluid sizing tweaks --- */
:root {
  --container-pad: clamp(0.75rem, 2vw, 2rem);
  --gap: clamp(0.6rem, 1.6vw, 2rem);
}
html { scroll-behavior: smooth; }
body { font-size: clamp(14px, 0.9vw + 10px, 16px); }

/* --- Header / Nav: wrap + scroll on small screens --- */
header { flex-wrap: wrap; row-gap: 0.4rem; }
nav { flex-wrap: wrap; overflow-x: auto; gap: clamp(0.5rem, 1.2vw, 1.2rem); }
nav a { font-size: clamp(0.9rem, 0.4vw + 0.8rem, 1rem); padding: 0.4rem 0.9rem; }

/* --- Main layout: move to grid areas for sane reflow --- */
main {
  display: grid;
  grid-template-areas: "left map right";
  grid-template-columns: minmax(260px, 28vw) 1fr minmax(260px, 28vw);
  gap: var(--gap);
  padding: var(--container-pad) var(--container-pad) 0 var(--container-pad);
  min-height: 0;
}
.left-panel { grid-area: left; }
.map-container { grid-area: map; }
.right-panel { grid-area: right; }

/* 2-column on medium screens: right panel drops under the map */
@media (max-width: 1280px) {
  main {
    grid-template-areas:
      "left map"
      "right right";
    grid-template-columns: minmax(240px, 32vw) 1fr;
  }
}

/* 1-column on small: map first, then panels */
@media (max-width: 900px) {
  main {
    grid-template-areas:
      "map"
      "left"
      "right";
    grid-template-columns: 1fr;
  }
  .left-panel, .right-panel, .map-container { border-radius: 0; padding: 1rem; }
}

/* --- Map sizing: fluid heights --- */
.map-container {
  padding: 0;
  height: auto;
  min-height: clamp(380px, 54vh, 760px);
}
#map {
  min-height: clamp(300px, 48vh, 680px);
}

/* --- Inputs: make the dropdown caret position responsive --- */
select {
  background-position: right clamp(0.6rem, 2vw, 1rem) center;
  background-size: clamp(16px, 1.6vw, 22px) clamp(16px, 1.6vw, 22px);
}

/* --- Legend modal: prevent overflow on tiny screens --- */
.legend-content {
  max-width: min(420px, 94vw);
  width: 94vw;
  padding: clamp(1rem, 3vw, 2rem);
}

/* --- Absolute info cards: cap width + allow wrapping --- */
.city-card, .hospital-card {
  max-width: min(360px, calc(100vw - 24px));
  word-wrap: break-word;
  overflow-wrap: anywhere;
  padding: clamp(0.9rem, 2.5vw, 1.18rem);
  border-radius: clamp(10px, 2vw, 14px);
}
.card-title { font-size: clamp(1rem, 0.8vw + 0.9rem, 1.18rem); }

/* --- Footer: convert to responsive grid --- */
.footer-sections {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(12px, 4vw, 85px);
  padding: clamp(18px, 4vw, 52px) clamp(12px, 6vw, 80px) 0 clamp(12px, 6vw, 80px);
  margin-bottom: clamp(24px, 8vw, 100px);
}
.footer-section h4 { font-size: clamp(1.05rem, 0.7vw + 1rem, 1.4rem); }
.footer-section a,
.footer-bottom-text,
.footer-links-bottom a { font-size: clamp(0.95rem, 0.4vw + 0.9rem, 1.13rem); }

.footer-bottom {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: clamp(10px, 2vw, 28px);
  padding: 0 clamp(12px, 6vw, 80px) 32px clamp(12px, 6vw, 80px);
}
@media (max-width: 800px) {
  .footer-bottom {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 16px;
    padding: 0 10px 16px 10px;
  }
  .footer-bottom-logos { justify-content: flex-start; margin-top: 8px; }
}

/* --- Touch-safe paddings for iOS notch --- */
@supports (padding: max(0px)) {
  header { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
  .footer-main { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
}

/* --- Small polish: reduce control sizes on narrow screens --- */
@media (max-width: 600px) {
  .notification-btn, .legend-btn { width: 32px; height: 32px; }
  .results-header, .results-stats div { font-size: 0.95rem; }
  .alert-modern .alert-title { font-size: 1.05rem; }
  .alert-modern .alert-desc { font-size: 0.98rem; }
}

/* --- Clean up duplicates: keep only one of these; ensure they appear ONCE --- */
.alert-modern .alert-close {
  background: none; border: none; outline: none; margin-left: 16px; cursor: pointer;
  padding: 0; display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
}
/* Remove the earlier duplicate .footer-sections and .alert-close blocks in the original file if possible */
