/* ==========================================
   ESTILOS GLOBALES
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body, #map {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background-color: #121212;
  position: relative; 
}


/* ==========================================
   CONTENEDOR SELECTOR MAPAS BASE
   ========================================== */
#map-selector-container {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
}

#map-select {
  background-color: rgba(30, 30, 30, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#map-select option {
  background-color: #1e1e1e;
  color: #ffffff;
}


/* ==========================================
   CARTEL INFORMATIVO FLOTANTE (FEEDBACK BANNER)
   ========================================== */
.map-feedback-banner {
  position: absolute;
  top: 10px; 
  left: 15px; 
  z-index: 10;
  width: auto;
  max-width: 240px;
  background: rgba(18, 18, 18, 0.92);
  border: 1px solid rgba(183, 9, 43, 0.7);
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.map-feedback-banner.hidden {
  display: none !important;
}


/* ==========================================
   CONTENEDOR DEL BUSCADOR
   ========================================== */
#search-container {
  position: absolute;
  top: 145px;
  right: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
}

#search-toggle {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  min-height: 30px !important;
  background-color: rgba(30, 30, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  padding: 0;
  box-sizing: border-box;
  backdrop-filter: blur(4px);
}

#search-toggle:active {
  background-color: rgba(50, 50, 50, 0.9);
}

#search-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  filter: invert(100%);
}

#search-box {
  position: relative;
  margin-right: 6px;
}

#search-box.hidden {
  display: none;
}

#search-input {
  width: 180px;
  padding: 8px 10px;
  background-color: rgba(30, 30, 30, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#search-results {
  position: absolute;
  top: 40px;
  right: 0;
  width: 220px;
  max-height: 200px;
  background-color: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  list-style: none;
  overflow-y: auto;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#search-results li {
  padding: 8px 10px;
  font-size: 12px;
  color: #dddddd;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

#search-results li:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}


/* ==========================================
   CONTROLES NATIVOS MAPLIBRE
   ========================================== */
.maplibregl-ctrl-group {
  background-color: rgba(30, 30, 30, 0.9) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.maplibregl-ctrl-group button {
  background-color: transparent !important;
}

.maplibregl-ctrl-group button span,
.maplibregl-ctrl-icon {
  filter: brightness(0) invert(1) !important;
}

.maplibregl-ctrl-group button:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Ocultar la escala nativa ya que usamos el cartel informativo flotante */
.maplibregl-ctrl-scale {
  display: none !important;
}

.maplibregl-ctrl-attrib {
  background-color: rgba(30, 30, 30, 0.7) !important;
  color: #cccccc !important;
}

.maplibregl-ctrl-attrib a {
  color: #ffffff !important;
}


/* ==========================================
   PANEL DESLIZANTE (BOTTOM SHEET)
   ========================================== */
#bottom-sheet {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 50dvh;
  background-color: #121212;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateY(calc(50dvh - 58px));
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
  touch-action: pan-y; 
}

/* Cabecera roja fija */
#sheet-header {
  height: 58px;
  min-height: 58px;
  background-color: #b7092b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px 8px 16px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  cursor: grab;
  position: relative;
  flex-shrink: 0;
}

.drag-handle {
  width: 36px;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
  margin-bottom: 4px;
}

/* Estados de la cabecera (Principal vs Pestañas de configuración) */
#header-main-actions,
#header-tabs-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-top-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 16px;
}

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

/* Forzar iconos blancos en la cabecera (excluyendo el logo) */
#sheet-header img:not(.app-logo),
#sheet-header svg,
.sheet-actions img:not(.app-logo),
.sheet-actions svg,
.sheet-btn img:not(.app-logo),
.sheet-btn svg {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* Excepción limpia para que el logo conserve sus colores y tamaño a todo color */
#sheet-header img.app-logo {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  filter: none !important;
  object-fit: cover !important;
}




/* Barra de pestañas superiores */
.tabs-bar {
  width: 100%;
  display: flex;
  justify-content: space-around !important;
  align-items: center;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn.active, 
.tab-btn:hover {
  opacity: 1;
}

.tab-btn.active {
  border-bottom: 2px solid #ffffff;
}


/* ==========================================
   CONTENIDO INTERNO DEL SHEET
   ========================================== */
#sheet-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: #121212;
  color: #ffffff;
  padding: 12px 16px;
}

.category-subheader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #2a2a2a;
}

.subheader-title {
  font-weight: 700;
  font-size: 14px;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-label {
  font-size: 12px;
  color: #cccccc;
}

/* Switch ON/OFF */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #444444;
  transition: 0.3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #b7092b;
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* Árbol de categorías y listas */
.poi-categories {
  list-style: none;
  margin-top: 8px;
}

.category-row, 
.subcategory-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #1e1e1e;
  font-size: 13px;
}

.subcategory-list {
  list-style: none;
  display: none;
  padding-left: 20px;
}

.category-item.active .subcategory-list {
  display: block;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #666666;
  border-radius: 3px;
  background-color: #121212;
  cursor: pointer;
  display: grid;
  place-content: center;
  margin: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checkbox-container input[type="checkbox"]:checked {
  background-color: #b7092b;
  border-color: #b7092b;
}

.checkbox-container input[type="checkbox"]:checked::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.checkbox-container input[type="checkbox"]:indeterminate {
  background-color: #b7092b;
  border-color: #b7092b;
}

.checkbox-container input[type="checkbox"]:indeterminate::before {
  content: "";
  width: 8px;
  height: 2px;
  background-color: #ffffff;
}

.arrow-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.25s ease;
}

.category-item.active .arrow-icon-btn {
  transform: rotate(90deg);
}

.category-row img,
.subcategory-list img,
.category-row svg,
.subcategory-list svg {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

.checkbox-container img,
.checkbox-container svg {
  margin-right: 4px;
}

.hidden {
  display: none !important;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #ffffff;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 6px;
}

.settings-group {
  margin-bottom: 20px;
}
