:root {
  --bg: #0a1616;
  --surface: #082a2a;
  --surface-soft: rgba(8, 42, 42, 0.92);
  --line: #393f47;
  --text: #e8edef;
  --text-dim: rgba(232, 237, 239, 0.62);
  --teal-glow: #0e4040;
  --glass-border: rgba(255, 255, 255, 0.28);
  --glass-fill: rgba(255, 255, 255, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

html[lang="en"] {
  --font: "Inter", system-ui, sans-serif;
}

html[lang="ar"] {
  --font: "Cairo", "Inter", system-ui, sans-serif;
}

body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

#map {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1;
}

#map.dimmed .leaflet-tile-pane {
  filter: brightness(0.75) saturate(0.85);
  transition: filter 0.4s ease;
}

#map .leaflet-tile-pane {
  transition: filter 0.4s ease;
}

.hidden {
  display: none !important;
}

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(10, 22, 22, 0.78);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(57, 63, 71, 0.55);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.brand:hover,
.brand:focus {
  color: #fff;
  text-decoration: none;
}

.brand-logo {
  height: 26px;
  width: auto;
  flex: none;
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 13.5px;
  white-space: nowrap;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.brand-tagline {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blur-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  padding: 18px 22px;
  border: 1px solid #fff;
  border-radius: 15px;
  background-color: var(--glass-fill);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
}

.blur-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.blur-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

.blur-btn-sm {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  gap: 8px;
}

.icon-flip {
  transition: transform 0.2s ease;
}

[dir="rtl"] .icon-flip {
  transform: scaleX(-1);
}

#back-btn {
  position: fixed;
  top: auto;
  bottom: 22px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 1050;
}

.icon-btn {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--glass-fill);
  color: #fff;
  cursor: pointer;
  z-index: 5;
  transition: background-color 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

#sidebar {
  position: fixed;
  top: 84px;
  bottom: 18px;
  inset-inline-start: 18px;
  width: min(400px, calc(100vw - 36px));
  z-index: 1000;
  background: var(--surface-soft);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: sidebar-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes sidebar-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#sidebar-content {
  height: 100%;
  overflow-y: auto;
  padding: 26px 24px 30px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

#sidebar-content::-webkit-scrollbar {
  width: 6px;
}

#sidebar-content::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}

.kicker {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

[dir="rtl"] .kicker {
  letter-spacing: 0;
}

.sb-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 6px;
  padding-inline-end: 34px;
}

.sb-title {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
}

.count-pill {
  flex: none;
  margin-top: 3px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-fill);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.sb-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  text-align: start;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(57, 63, 71, 0.55);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.project-item:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.45);
  transform: translateX(0) scale(1.01);
}

.pi-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--surface);
}

.pi-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.pi-text {
  flex: 1;
  min-width: 0;
}

.pi-name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
}

.pi-location {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pi-chevron {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 12px;
  color: var(--text-dim);
}

[dir="rtl"] .pi-chevron i {
  transform: scaleX(-1);
}

.empty-state {
  margin-top: 28px;
  padding: 30px 20px;
  text-align: center;
  border: 1px dashed rgba(57, 63, 71, 0.9);
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.7;
}

.empty-state i {
  display: block;
  font-size: 26px;
  margin-bottom: 12px;
  opacity: 0.7;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.detail-name {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 12px;
}

.detail-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--surface);
  margin-bottom: 16px;
}

.region-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(14, 64, 64, 0.55);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 18px;
}

.detail-meta {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(57, 63, 71, 0.55);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 22px;
  font-size: 13.5px;
  line-height: 1.6;
}

.detail-meta i {
  margin-top: 4px;
  color: var(--text-dim);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-actions .blur-btn {
  justify-content: center;
  width: 100%;
}

.btn-outline {
  border-color: rgba(255, 255, 255, 0.45);
  background: transparent;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

.region-label {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: rgba(10, 22, 22, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 9px 14px;
  color: var(--text);
  font-family: var(--font);
  direction: inherit;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}

.rl-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  transform-origin: center;
  transition: transform 0.25s ease;
}

.rl-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.rl-count {
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--glass-fill);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}

.region-label.dimmed {
  opacity: 0.28;
}

.region-label.focused {
  border-color: #fff;
}

.project-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(14, 64, 64, 0.85);
  border: 2px solid #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 14px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.project-marker:hover {
  transform: scale(1.25);
  background: rgba(232, 237, 239, 0.95);
}

.project-marker.is-selected {
  transform: scale(1.35);
  background: #e8edef;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.25), 0 4px 18px rgba(0, 0, 0, 0.6);
}

.project-tooltip {
  pointer-events: none;
  background: rgba(10, 22, 22, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  box-shadow: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
}

.project-tooltip::before {
  display: none;
}

.leaflet-container {
  font-family: var(--font);
  background: var(--bg);
}

.leaflet-top {
  top: 80px;
}

.leaflet-overlay-pane {
  transition: opacity 0.35s ease;
}

.leaflet-overlay-pane.boundaries-hidden path {
  opacity: 0;
}

.rl-holder {
  transition: opacity 0.3s ease;
}

.leaflet-control-zoom a {
  background: rgba(10, 22, 22, 0.85) !important;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #fff !important;
}

.leaflet-control-attribution {
  background: rgba(10, 22, 22, 0.7) !important;
  color: rgba(232, 237, 239, 0.55) !important;
  font-size: 10px !important;
  direction: ltr;
}

.leaflet-control-attribution a {
  color: rgba(232, 237, 239, 0.75) !important;
}

@media (max-width: 768px) {
  #topbar {
    height: 60px;
    padding: 0 14px;
  }

  .brand-tagline,
  .brand-divider {
    display: none;
  }

  #back-btn {
    top: 70px;
    bottom: auto;
    transform: none;
    inset-inline-start: 12px;
    padding: 12px 16px;
  }

  #sidebar {
    top: auto;
    inset-inline-start: 0;
    bottom: 0;
    width: 100%;
    max-height: 62vh;
    display: flex;
    flex-direction: column;
    border-radius: 20px 20px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: none;
  }

  #sidebar::before {
    content: '';
    flex: none;
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    margin: 10px auto 2px;
  }

  #sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 18px calc(20px + env(safe-area-inset-bottom));
  }
}
