@import "/css/main.css";
@import url("https://fonts.googleapis.com/css2?family=Montserrat+Alternates:wght@400;600&display=swap");
@import url("https://fonts.googleapis.com/css?family=Play&display=swap");
@import url("https://fonts.googleapis.com/css?family=Almarai&display=swap");
@import url("https://fonts.googleapis.com/css?family=Roboto&display=swap");
@import url("https://fonts.googleapis.com/css?family=Galada&display=swap");

/* ========== DASHBOARD ========== */
.Map {
  background: var(--card-bg);
}
#Map::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 60% 20%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 80% 80%, rgba(255, 255, 255, 0.5), transparent);
  background-size: 200px 200px;
  animation: bubblesAnimation 20s linear infinite;
  pointer-events: none;
}

@keyframes bubblesAnimation {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-200px);
  }
}

.Map-container {
  max-width: 1400px;
  margin: 0 auto;
  /* border-radius: 32px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.2); */
  padding: 28px 32px 32px 32px;
}

.dashboard-title h1 {
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  text-align: center;
}
.dashboard-title h1 span {
  color: var(--primary-color);
  font-weight: 700;
}

.dashboard-title h1[dir="rtl"] {
  font-size: 2.2rem;
  font-weight: 600;
  margin-bottom: 0;
  text-align: center;
}
.dashboard-title h1[dir="rtl"] span {
  color: var(--primary-color);
  font-weight: 700;
}

.dropdownMap {
  margin-bottom: 24px;
}
.dropdown-container select {
  font-family: "Montserrat Alternates", sans-serif;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 60px;
  border: 1.5px solid #e2e8f0;
  background: white;
  min-width: 260px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.2s;
}
.dropdown-container select:hover {
  border-color: var(--primary-color);
}

.dropdown-container[dir="rtl"] select {
  font-family: "Almarai", "Arial", sans-serif;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 60px;
  border: 1.5px solid #e2e8f0;
  background: white;
  min-width: 260px;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  cursor: pointer;
  transition: all 0.2s;
}
.dropdown-container[dir="rtl"] select:hover {
  border-color: var(--primary-color);
}
/* ========== MAP CONTAINER ========== */
.map-wrapper {
  position: relative;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 600px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 220px; /* leave space on sides for bubbles */
}

#OmanMap {
  position: relative;
  border-radius: 24px;
  padding: 8px;
  z-index: 1;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 80px rgba(13, 110, 253, 0.1);
}

/* ---------- Floating bubbles around map ---------- */
.floating-bubble {
  position: absolute;
  /* background: var(--background-dark); */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 24px;
  box-shadow:
    0 12px 28px -8px rgba(0, 0, 0, 0.18),
    0 4px 12px -4px rgba(0, 0, 0, 0.06);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  transition:
    transform 0.25s ease,
    box-shadow 0.2s ease,
    opacity 0.35s ease;
  z-index: 50;
  pointer-events: none;
  width: 220px;
  color: var(--text-color);
  opacity: 0;
  transform: scale(0.9);
}

.floating-bubble.visible {
  opacity: 1;
  transform: scale(1);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

/* Positions — arranged around the map (left & right columns) */
.bubble-total-employment {
  top: 2%;
  left: 0;
}

.bubble-omani-expat {
  top: 2%;
  right: 0;
  left: auto;
}

.bubble-population {
  top: 26%;
  left: 0;
}

.bubble-students {
  top: 34%;
  right: 0;
  left: auto;
}

.bubble-jobseekers {
  top: 51%;
  left: 0;
}

.bubble-school-types {
  bottom: 2%;
  right: 0;
  left: auto;
}

.bubble-geography {
  bottom: 2%;
  left: 0;
}

.bubble-extra {
  bottom: 2%;
  right: 0;
  left: auto;
}

/* Bubble internal styles */
.bubble-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid rgba(180, 83, 9, 0.15);
}

.bubble-header i {
  color: var(--text-color);
  font-size: 0.95rem;
}

.bubble-header .bubble-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-color);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bubble-header .bubble-name[dir="rtl"] {
  font-weight: 500;
  font-size: 0.9rem;
}

.bubble-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--light-text);
  line-height: 1.15;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.bubble-metric-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 2px;
}

.bubble-rows {
  margin-top: 4px;
}

.bubble-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  /* padding: 2px 0; */
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.bubble-row .k {
  color: var(--light-text);
  font-weight: 500;
}
.bubble-row .v {
  font-weight: 500;
  color: var(--dark-text);
  font-feature-settings: "tnum";
}

.bubble-section-title {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--light-blue);
  margin-top: 6px;
  margin-bottom: 2px;
}

/* Controls area */
#controls-OmanMap {
  display: flex;
  background: var(--border-color);
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 60px;
  margin-top: 16px;
}
.oman-map-metric-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.oman-map-metric-control label {
  font-weight: 600;
  white-space: nowrap;
}

#map-metric-selector {
  height: 38px;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.96);
}

/* Play + Year */
.oman-map-animation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

#play-button-OmanMap {
  width: 42px;
  height: 38px;
  flex-shrink: 0;
}

.oman-map-year-controls {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

#year-slider {
  flex: 1;
  min-width: 0;
  background: var(--background);
}

#year-label {
  min-width: 45px;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
}

/* Reset */
#reset-button-OmanMap {
  width: 42px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 40px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.bubbles-toggle-btn {
  display: none; /* shown only on mobile/tablet */
}

/* ---------- Small laptops: 1025–1199px ---------- */
@media (max-width: 1199px) {
  .Map-container {
    padding: 24px 20px 28px;
  }
  .map-wrapper {
    padding: 0 200px;
    min-height: 560px;
  }
  .floating-bubble {
    width: 190px;
    padding: 12px 14px;
  }
  #OmanMap {
    min-width: 0;
    flex: 0 1 auto;
  }
}

/* ---------- Small laptop / large tablet landscape: 901–1024px ---------- */
@media (max-width: 1024px) {
  .dashboard-title h1 {
    font-size: 1.9rem;
  }
  .map-wrapper {
    padding: 0 170px;
    min-height: 500px;
  }
  .floating-bubble {
    width: 160px;
    padding: 10px 12px;
    border-radius: 18px;
  }
  .bubble-row {
    font-size: 0.66rem;
  }
  .bubble-metric-value {
    font-size: 1.25rem;
  }
}

@media (max-width: 900px) {
  .Map-container {
    padding: 20px 16px 24px;
  }
  .dashboard-title h1 {
    font-size: 1.7rem;
  }

  .dropdownMap {
    margin-bottom: 16px;
  }
  .dropdown-container select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .map-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0;
    min-height: 0;
    align-items: stretch;
  }

  #OmanMap {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    max-width: 575px;
    padding: 4px;
    border-radius: 18px;
    box-shadow: 0 0 40px rgba(13, 110, 253, 0.08);
  }
  #OmanMap svg {
    width: 100%;
    height: auto;
    display: block;
  }
  #OmanMap svg {
    touch-action: pan-y !important;
  }
  .floating-bubble {
    position: static;
    width: auto;
    opacity: 1;
    transform: none;
    animation: none !important;
    pointer-events: auto;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--background-dark);
    box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.18);
  }
  .floating-bubble:not(.visible),
  .bubble-extra {
    display: none;
  }
  /* hero bubble spans the full row */
  .bubble-total-employment {
    grid-column: 1 / -1;
  }
  .bubble-metric-value {
    font-size: 1.4rem;
  }
  .bubble-row {
    font-size: 0.74rem;
    padding: 2px 0;
  }

  /* Controls: wrap instead of a long pill */
  #controls-OmanMap {
    flex-wrap: wrap;
    border-radius: 20px;
    padding: 12px 14px;
    gap: 10px;
  }
  .oman-map-metric-control {
    flex: 1 1 100%;
  }
  .oman-map-metric-control select,
  #map-metric-selector {
    flex: 1;
    min-width: 0;
    width: 100%;
  }
  .oman-map-animation-controls {
    flex: 1 1 calc(100% - 60px);
  }
  #reset-button-OmanMap {
    margin-left: 0 !important;
  }

  /* Mobile tooltip (tap on governorate) */

  .bubbles-toggle-btn {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border: none;
    border-radius: 14px;
    background: var(--background-dark);
    color: var(--text-color);
    font-family: "Montserrat Alternates", sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
  }

  [dir="rtl"] .bubbles-toggle-btn {
    font-family: "Almarai", "Arial", sans-serif;
    font-weight: 500;
  }
  .bubbles-toggle-btn .toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.25s ease;
  }
  .bubbles-toggle-btn.open .toggle-icon {
    transform: rotate(180deg);
  }

  /* keep order: map → button → bubbles, whatever the HTML order is */
  #OmanMap {
    order: 0;
  }
  .bubbles-toggle-btn {
    order: 1;
  }
  .floating-bubble {
    order: 2;
  }

  /* collapsed = hide all bubbles */
  .map-wrapper.bubbles-collapsed .floating-bubble {
    display: none;
  }
}

/* ---------- Phones large: ≤ 768px (stay 3 → 2 columns) ---------- */
@media (max-width: 768px) {
  .dashboard-title h1 {
    font-size: 1.5rem;
  }
  .dashboard-title h1[dir="rtl"] {
    font-size: 1.9rem;
    margin-bottom: 20px;
  }
  .map-wrapper {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- ≤ 425px ---------- */
@media (max-width: 425px) {
  .Map-container {
    padding: 16px 12px 20px;
  }
  .dashboard-title h1 {
    font-size: 1.3rem;
    margin-bottom: 8px;
  }
  .dashboard-title h1[dir="rtl"] {
    font-size: 1.8rem;
  }

  .map-wrapper {
    gap: 10px;
  }
  .floating-bubble {
    padding: 10px 11px;
    border-radius: 14px;
  }
  .bubble-row {
    font-size: 0.68rem;
  }
  .bubble-metric-value {
    font-size: 1.2rem;
  }
  .bubble-metric-label {
    font-size: 0.55rem;
  }

  /* The SVG is scaled down to ~0.6, so enlarge in-SVG text to stay readable */
  #OmanMap .legend text {
    font-size: 17px !important;
  }
  #OmanMap .legend rect {
    width: 18px;
    height: 18px;
  }
  #displayedMetricLabel {
    font-size: 26px !important;
  }
  #displayedMetricValue {
    font-size: 46px !important;
  }
  #displayedMetricNote {
    font-size: 15px !important;
  }

  #year-label {
    min-width: 38px;
    margin-left: 6px !important;
    font-size: 0.9rem;
  }
  #play-button-OmanMap,
  #reset-button-OmanMap {
    width: 40px;
    height: 40px; /* better tap target */
  }
}

/* ---------- ≤ 375px ---------- */
@media (max-width: 375px) {
  .Map-container {
    padding: 14px 10px 18px;
  }
  .dashboard-title h1 {
    font-size: 1.2rem;
  }
  .dropdown-container select {
    padding: 9px 14px;
    font-size: 0.9rem;
  }

  #OmanMap {
    padding: 2px;
    border-radius: 14px;
  }
  .floating-bubble {
    padding: 9px 10px;
  }
  .bubble-header .bubble-name {
    font-size: 0.74rem;
  }
  .bubble-row {
    font-size: 0.64rem;
  }
  .bubble-metric-value {
    font-size: 1.1rem;
  }

  #OmanMap .legend text {
    font-size: 18px !important;
  }
  #displayedMetricLabel {
    font-size: 28px !important;
  }
  #displayedMetricValue {
    font-size: 50px !important;
  }

  #controls-OmanMap {
    padding: 10px 12px;
  }
  #map-metric-selector {
    font-size: 0.85rem;
  }
}

/* ---------- very small phones ≤ 359px: single column ---------- */
@media (max-width: 359px) {
  .map-wrapper {
    grid-template-columns: 1fr;
  }
}
