:root {
  --text-color: #373c44;
  --snackbar-bg: #333333;
  --snackbar-color: #fff;
  --sidebar-background: #fff;
  --sidebar-hover: #c2c2c2;
}

[data-theme="dark"] {
  --text-color: #c2c7d0;
  --snackbar-bg: #dddddd;
  --snackbar-color: #333;
  --sidebar-background: #13171fb8;
  --sidebar-hover: #656565;
}


body {
  margin: 0;
}

#logo-img {
  margin-right: 1rem;
}

.app-header {
  height: 3.5rem;
}

#map {
  height: calc(100vh - 3.5rem);
}

header {
  padding: 0 1rem 0 1rem;
}

.dark-map-tiles {
  filter: var(--dark-map-filter, none);
  transition: filter 0.3s ease;
}

#tr-titleApp {
  all: unset;
}

#snackbar {
  visibility: hidden;
  min-width: 250px;
  text-align: center;
  border-radius: 14px;
  padding: 16px;
  position: fixed;
  z-index: 5050;
  left: 50%;
  bottom: 30px;
  font-size: 17px;
  transform: translate(-50%, 0);
}
#snackbar {
  background-color: var(--snackbar-bg);
  color: var(--snackbar-color);
}

#snackbar.show {
  visibility: visible;
  -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
  animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@-webkit-keyframes fadein {
  from {
    bottom: 0;
    opacity: 0;
  }
  to {
    bottom: 30px;
    opacity: 1;
  }
}

@keyframes fadein {
  from {
    bottom: 0;
    opacity: 0;
  }
  to {
    bottom: 30px;
    opacity: 1;
  }
}

@-webkit-keyframes fadeout {
  from {
    bottom: 30px;
    opacity: 1;
  }
  to {
    bottom: 0;
    opacity: 0;
  }
}

@keyframes fadeout {
  from {
    bottom: 30px;
    opacity: 1;
  }
  to {
    bottom: 0;
    opacity: 0;
  }
}

/* Style for the Legend box */
.info.legend {
  padding: 10px;
  font: 14px/16px Arial, Helvetica, sans-serif;
  background: white;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  line-height: 24px;
}

.info.legend h4 {
  margin: 0 0 5px;
  color: #555;
}

.info.legend i {
  width: 18px;
  height: 18px;
  float: left;
  margin-right: 8px;
  opacity: 0.7;
  border-radius: 50%;
}

/* Cluster style */
.marker-cluster-small {
  background-color: rgba(181, 226, 140, 0.6);
}

.marker-cluster-small div {
  background-color: rgba(110, 204, 57, 0.6);
}

.marker-cluster-medium {
  background-color: rgba(241, 211, 87, 0.6);
}

.marker-cluster-medium div {
  background-color: rgba(240, 194, 12, 0.6);
}

.marker-cluster-large {
  background-color: rgba(253, 156, 115, 0.6);
}

.marker-cluster-large div {
  background-color: rgba(241, 128, 23, 0.6);
}

.marker-cluster {
  background-clip: padding-box;
  border-radius: 20px;
}

.marker-cluster div {
  width: 30px;
  height: 30px;
  margin-left: 5px;
  margin-top: 5px;
  color: black;

  text-align: center;
  border-radius: 15px;
  font: 12px "Roboto", Arial, Helvetica, sans-serif;
}

.marker-cluster span {
  line-height: 30px;
}

.leaflet-control-locate {
  display: none;
}

/* Icons style */

.active-marker {
  z-index: 1000 !important;
  /* Ensure the container is circular so the shadow pulse is round */
  border-radius: 50%;
  /* Trigger the pulse on the container itself */
  animation: marker-glow-pulse 1.5s infinite !important;
}

@keyframes marker-glow-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--pico-primary);
  }

  50% {
    box-shadow: 0 0 0 25px rgba(0, 0, 0, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

/* Popup CSS */

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-card header {
  display: flex;
  justify-content: space-between;
}

.welcome-card h3 {
  margin: 0;
}

.welcome-overlay.hidden {
  display: none;
}

.welcome-card {
  max-width: 500px;
  width: 100%;
}

.welcome-list {
  list-style: none;
  padding: 0;
}

.welcome-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 1rem;
}

.welcome-list svg {
  flex-shrink: 0;
  margin-top: 4px;
  color: var(--pico-primary);
}

.welcome-footer {
  display: flex;
  justify-content: space-evenly;
}

#close-invite, #close-welcome, #close-auth-popup {
  border: none;
  padding: 0;
  margin: 0;
  height: 20px;
}

/* Lateral buttons */

.map-sidebar {
  position: absolute;
  right: 15px;
  top: 35%;
  transform: translateY(-50%);
  z-index: 1050;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-background);
  border-radius: 1rem;
  box-shadow: var(--pico-card-sectioning-background-color) 0px 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-btn {
  width: 60px;
  height: 60px;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--pico-contrast);
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}

#btn-layers {
  border-radius: 1rem 1rem 0 0;
}

#btn-add-camera {
  border-radius: 0 0 1rem 1rem;
}

.sidebar-btn:hover {
  background: var(--sidebar-hover);
  color: var(--pico-primary);
}

/* Active State: Uses Primary Color */
.sidebar-btn.active {
  background: var(--pico-primary) !important;
  color: white !important;
}

.sidebar-divider {
  margin: 4px 0;
  border-top: 1px solid var(--pico-muted-border-color);
}

/* Tooltips for Desktop */
@media (min-width: 920px) {
  .sidebar-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 65px;
    background: #333;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 1rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-btn:hover::after {
    opacity: 1;
  }
}

@media (max-width: 919px) {
  .map-sidebar {
    right: 0 !important;
    top: 20%;
    transform: none;
    border-radius: 1rem 0 0 1rem;
  }

  #btn-layers {
    border-radius: 1rem 0 0 0;
  }

  #btn-add-camera {
    border-radius: 0 0 0 1rem;
  }
}

/* Legend modal */

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.legend-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.dot-id {
  background-color: #ff3131;
}

.dot-rec {
  background-color: #ffbf00;
}

.dot-obs {
  background-color: #00b300;
}

.legend-subtitle {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-color) !important;
}

.marker-status-list {
  margin-bottom: 1.5rem;
}

.legend-marker-sample {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 4px;
}

.status-normal {
  background-color: #6c5d53;
}

.status-incomplete {
  background-color: #bf000d;
}

/* Grid for the 4 shapes */
.legend-icon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  background: var(--pico-card-sectioning-background-color);
  padding: 15px;
  border-radius: var(--pico-border-radius);
  margin-bottom: 1rem;
}

.icon-grid-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-grid-item img {
  width: 24px;
  height: 24px;
  filter: saturate(0);
  /* Optional: makes them look like neutral "shapes" */
  opacity: 0.8;
}

/* Scenario switcher modal */

.scenario-option.outline:hover {
  background: var(--pico-text-selection-color);
}

.scenario-option.outline {
  background: var(--pico-muted-border-color);
}

.scenario-option.active {
  background: var(--pico-primary-underline);
}

.scenario-option h5 {
  margin: 0 0 5px 0;
  color: var(--text-color);
}

.scenario-option p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-color);
}

/* Force the group to be vertical */
[role="group"].vertical {
  flex-direction: column;
}

[role="group"].vertical>button {
  width: 100%;
  border-radius: 0;
  /* Pico's horizontal group hides the left border of middle elements. 
     We reset it here to ensure the full outline is visible. */
  border: var(--pico-border-width) solid var(--pico-border-color) !important;
  margin-left: 0 !important;
}

/* Remove bottom border of stacked elements to prevent double lines, 
   except for the last one */
[role="group"].vertical>button:not(:last-child) {
  border-bottom: none;
}

/* Fix rounding for vertical stack: 
   Top of the first button and bottom of the last button */
[role="group"].vertical>button:first-child {
  border-top-left-radius: var(--pico-border-radius);
  border-top-right-radius: var(--pico-border-radius);
}

[role="group"].vertical>button:last-child {
  border-bottom-left-radius: var(--pico-border-radius);
  border-bottom-right-radius: var(--pico-border-radius);
}

/* Editorial content modals */
.email-obfuscated {
  background: var(--pico-card-sectioning-background-color);
  padding: 1rem;
  border-radius: var(--pico-border-radius);
  font-family: var(--pico-font-family-monospace);
  text-align: center;
  border: 1px dashed var(--pico-muted-border-color);
  user-select: all; /* Makes it easy for the user to select the whole line */
}

/* Layers switch modal */

/* Highlight the currently active basemap */
.modal-cell.active {
  background-color: var(--pico-primary-underline);
  border: 2px solid var(--pico-primary);
}

/* Ensure map previews look consistent */
.modal-image.map-preview {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--pico-muted-border-color);
  margin-bottom: 8px;
}

#seo-content-pool {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  bottom: 0;
  left: -1000px;
}

/* The clickable header */
.modal-accordion-summary {
  cursor: pointer;
  padding: 0.75rem;
  border-radius: 6px;
  font-weight: 600;
  list-style: none; /* Hides the default browser arrow */
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
}

.modal-accordion-summary:hover {
  background-color: rgba(110, 65, 226, 0.1); /* Subtle purple tint or your theme color */
  color: var(--primary-color, #6e41e2);
}

/* Custom arrow indicator */
.modal-accordion-summary::before {
  content: "→";
  display: inline-block;
  margin-right: 0.75rem;
  transition: transform 0.2s ease;
  font-weight: bold;
}

/* Rotate arrow when open */
details[open] .modal-accordion-summary::before {
  transform: rotate(90deg);
}

/* Styling the expanded content */
.modal-accordion-content {
  padding: 0.5rem 1rem 1rem 2.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
