/* Gazetteer - Styles */
:root {
  --primary-color: #28a745;
  --primary-dark: #20c997;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  min-width: 280px;
  overflow-x: auto;
}

body {
  display: flex;
  flex-direction: column;
}

#map {
  flex: 1;
  width: 100%;
  z-index: 1;
}

/* DROPDOWN STYLING */
#selectContainer {
  position: fixed;
  top: 4px;
  z-index: 1000;
  width: 100%;
  padding: 5px 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#selectContainer i {
  color: #28a745;
  font-size: 1.3rem;
  pointer-events: auto;
}

#countrySelect {
  max-width: 400px;
  min-width: 200px;
  width: 200px;
  border: 2px solid #28a745;
  border-radius: 6px;
  padding: 12px 35px 12px 15px;
  font-size: 1rem;
  font-weight: 500;
  height: 51px;
  transition: all 0.3s ease;
  cursor: pointer;
  background-position: right 10px center;
  background-size: 12px;
  pointer-events: auto;
}

#countrySelect:hover {
  border-color: #28a745;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

#countrySelect:focus {
  outline: none;
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

#countrySelect option {
  padding: 10px;
  font-size: 1rem;
}

#infoFlag {
  max-width: 140px;
  min-height: 80px;
  max-height: 90px;
  border: 0.5px solid black;
}

#weatherCapitalHeading {
  font-size: 1.1rem;
}

/*  LEAFLET CONTROLS */
.leaflet-control {
  box-shadow: var(--box-shadow) !important;
  border: none !important;
}

.leaflet-bar a:hover,
.easy-button-button:hover {
  background: #28a745 !important;
  color: white !important;
}

/* LEAFLET LAYER CONTROL - Radio & Checkbox */
.leaflet-control-layers-toggle {
  width: 42px !important;
  height: 42px !important;
  background-size: 20px 20px !important;
}

/* identical size for ALL inputs (radio + checkbox) */
.leaflet-control-layers-selector,
.leaflet-control-layers input[type="checkbox"],
.leaflet-control-layers input[type="radio"] {
  width: 10px !important;
  height: 10px !important;
  min-width: 10px !important;
  min-height: 10px !important;
  background-image: none !important;
  background-color: white !important;
  border: 1.5px solid #666 !important;
  border-radius: 0 !important;
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  margin: 0 6px 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  vertical-align: middle !important;
}

.leaflet-control-layers input[type="radio"] {
  border-radius: 50% !important;
}

.leaflet-control-layers input[type="checkbox"] {
  border-radius: 2px !important;
}

.leaflet-control-layers label {
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 2px 0 !important;
  cursor: pointer !important;
  font-size: 12px !important;
}

.leaflet-control-layers span {
  display: inline-flex !important;
  align-items: center !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
}

.leaflet-control-layers {
  margin-right: 10px !important;
  /* Optional: align it vertically with your other buttons if needed */
  margin-top: 10px !important;
}

.leaflet-control-layers-expanded {
  padding: 4px 4px !important;
}

/*  EASY BUTTONS - 36px*/
.easy-button-button {
  width: 36px !important;
  height: 36px !important;
  font-size: 18px !important;
  line-height: 36px !important;
}

.easy-button-button .fa,
.easy-button-button .fas {
  font-size: 18px !important;
}

/*  REMOVE OUTLINES & FOCUS RINGS */
.leaflet-container,
.leaflet-container *,
.leaflet-interactive,
path.leaflet-interactive,
.leaflet-zoom-animated,
.leaflet-overlay-pane svg {
  outline: none !important;
}

.leaflet-container a:focus,
.leaflet-container button:focus,
path.leaflet-interactive:focus {
  outline: none !important;
  box-shadow: none !important;
}

/*   POPUP STYLING */
.leaflet-popup-content-wrapper {
  border: none;
  border-radius: 8px;
  padding: 2px;
}

.leaflet-popup-content strong {
  font-size: 12px;
  color: #333;
}

/* Fix popup close button position */
.leaflet-popup-close-button {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  padding: 1px 2px !important;
  border: none !important;
  font-size: 14px !important;
  color: black !important;
}

/* Center popup text */
.leaflet-popup-content {
  margin: 15px;
  font-size: 14px;
  line-height: 1.2;
  text-align: center !important;
}

.leaflet-popup-content .current-location {
  color: #28a745;
  font-weight: 550;
  font-size: 11px;
  text-align: center !important;
}

/*  TOOLTIP STYLING */
.leaflet-tooltip {
  background-color: rgba(40, 167, 69, 0.9);
  border: none;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
}

.leaflet-tooltip.country-tooltip {
  background: rgba(40, 167, 69, 0.9);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 5px 10px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.leaflet-tooltip.country-tooltip::before {
  border-top-color: rgba(40, 167, 69, 0.9);
}

/*   LOADING SPINNER */
#loadingSpinner {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.7));
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}

#loadingSpinner.active {
  display: flex;
}

/* Toast container positioning */
.toast-container {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 9999;
}

/* Toast styling */
.toast {
  min-width: 250px;
  opacity: 1 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: none;
  background: transparent !important;
}

.toast-body {
  background: rgba(220, 53, 69, 0.95) !important;
  color: white !important;
  border-radius: 8px;
  padding: 15px 20px;
  gap: 10px;
  display: flex;
  align-items: center;
  font-weight: 500;
}

.toast-body .close {
  color: white !important;
  opacity: 0.9;
  text-shadow: none;
  margin-left: auto;
  padding: 0;
  font-size: 1.3rem;
}

.toast-body .close:hover {
  opacity: 1;
}

.toast-body i {
  font-size: 1.4rem;
}

#errorToast {
  z-index: 3000 !important;
}

#errorToast:not(.show) {
  display: none;
}

.leaflet-bar a,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 22px !important;
}

.leaflet-bar a {
  text-decoration: none !important;
}

/* MARKER CLUSTERS */

.marker-cluster-small {
  background-color: rgba(40, 167, 69, 0.6) !important;
}

.marker-cluster-small div {
  background-color: rgba(40, 167, 69, 1) !important;
  color: white !important;
}

/*   LEAFLET ATTRIBUTION */
.leaflet-control-attribution {
  font-size: 12px !important;
  background: rgba(255, 255, 255, 0.8) !important;
  padding: 4px 8px !important;
  margin-right: 6px !important;
  margin-bottom: 4px !important;
}

.modal .btn-close:focus,
.modal .btn:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* PRE-LOADER */

/* Pre-loader overlay */
#preloader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.8));
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
}

/* When hiding the preloader */
#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

/* Globe icon */
#preloader .preloader-icon {
  font-size: 4rem;
  color: white;
  margin-bottom: 20px;
  animation: spin 2s linear infinite;
}

/* App title inside preloader */
#preloader .preloader-title {
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 8px;
  letter-spacing: 2px;
}

/* Subtitle */
#preloader .preloader-subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  margin-bottom: 40px;
}

/* Loading bar container */
#preloader .preloader-bar-container {
  width: 250px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

/* Animated loading bar */
#preloader .preloader-bar {
  height: 100%;
  width: 0%;
  background: white;
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* Status text below bar */
#preloader .preloader-status {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  text-align: center;
  min-height: 24px;
}

/* Fix for Printing */
@media print {
  .leaflet-control {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Spin animation for globe */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/*    TAB RESPONSIVE */
@media (min-width: 576px) {
  .modal-body {
    max-height: 70vh;
  }

  #selectContainer {
    top: 4px;
  }
}

/*    MOBILE RESPONSIVE */
@media (max-width: 576px) {
  #selectContainer i {
    display: none; /* Hides the 🔍 icon */
  }

  #selectContainer {
    top: 4px;
  }

  #countrySelect {
    min-width: 120px;
    width: 90%;
    max-width: 160px;
    height: 45px;
    padding: 6px 12px 6px 10px;
  }

  .leaflet-popup-content {
    font-size: 12px;
  }

  .leaflet-popup-content strong {
    font-size: 14px;
  }

  .modal-dialog {
    margin: 1.5rem auto; /* Increases the gap from the edges */
    width: 85%;
    max-width: 85%;
  }

  /* Force modals to be scrollable and not exceed screen height */
  .modal-content {
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    overflow-y: auto;
    max-height: calc(80vh - 120px);
    padding: 15px 10px;
  }

  .modal-title {
    font-size: 1rem !important;
    font-weight: 600;
  }

  .modal-header {
    padding: 0.75rem 1rem;
  }

  /* Adjust the size of the icon inside the title specifically */
  .modal-title i {
    font-size: 1rem;
    margin-right: 5px;
  }

  .modal-header .close {
    padding: 0.8rem 1rem;
    margin: -0.75rem -1rem -0.75rem auto;
    font-size: 1.2rem;
  }

  .modal-body table td {
    font-size: 0.85rem; /* Standard readable mobile size */
    padding: 0.5rem 0.25rem !important;
  }

  .modal-body table td:nth-child(2) {
    font-weight: 500;
    color: #555;
  }

  .modal-body table td.text-right {
    font-weight: 600;
    color: #333;
  }

  .modal-body table i {
    width: 20px;
    text-align: center;
    font-size: 0.85rem;
  }

  #weatherForecast strong {
    font-size: 0.8rem;
  }

  #weatherForecast small {
    font-size: 0.7rem;
    display: block;
    line-height: 1.1;
  }

  #weatherCapitalHeading {
    font-size: 0.9rem;
  }

  /* Make the flag look better on small screens */
  #infoFlag {
    max-width: 110px;
    min-height: 70px;
    max-height: 75px;
    border: 0.5px solid black;
  }

  /* Ensure the weather forecast doesn't wrap and look messy */
  #weatherForecast {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  #weatherForecast .col {
    min-width: 80px; /* Prevents columns from getting too squished */
  }

  .leaflet-control-layers input[type="radio"],
  .leaflet-control-layers input[type="checkbox"] {
    width: 12px !important;
    height: 12px !important;
    min-width: 12px !important;
    min-height: 12px !important;
    margin: 0 2px 0 0 !important;
  }

  .leaflet-control-layers label {
    font-size: 12px !important;
    padding: 1px 0 !important;
  }

  .leaflet-control-layers span {
    font-size: 11px !important;
  }
}
