#mapa-redes-wrapper {
  box-sizing: border-box;
  font-family: "Outfit", sans-serif;
  -webkit-font-smoothing: antialiased;
  background-color: #eaf4f4;
  display: flex;
  height: auto;
  min-height: 600px;
  padding: 20px;
  gap: 20px;
  border-radius: 12px;
}

#mapa-redes-wrapper * { box-sizing: border-box; }

/* Panel Lateral */
#mapa-redes-wrapper #sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 10;
  /* overflow-y: auto; */
}

#mapa-redes-wrapper .card {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

/* --- BOTÓN SANI DESBLOQUEAR (MODAL-SIMPLE TRIGGER) --- */
.unlock-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-sani-desbloquear {
  width: 100%;
  background: #0d9488;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.15);
}

.btn-sani-desbloquear:hover {
  background: #0f766e;
  transform: translateY(-1px);
}

.lock-status-locked {
  font-size: 0.8rem;
  color: #e11d48;
  font-weight: 500;
  margin-top: 8px;
  text-align: center;
}

.lock-status-unlocked {
  font-size: 0.85rem;
  color: #16a34a;
  font-weight: 600;
  margin-top: 8px;
  text-align: center;
}

/* --- MODAL SIMPLE NATIVO OVERLAY & CONTENT --- */
.modal-simple-overlay {
  display: none; /* Oculto por defecto, se maneja mediante JS con 'flex' */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99999; /* Asegura visualización encima del mapa y del panel lateral */
  align-items: center;
  justify-content: center;
}

.modal-simple-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  width: 340px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-simple-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.modal-simple-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1F345E;
}

.btn-close-modal {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: #94a3b8;
  line-height: 1;
  transition: color 0.15s;
}
.btn-close-modal:hover {
  color: #475569;
}

.modal-simple-body input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  font-size: 0.9rem;
  font-family: "Outfit", sans-serif;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.modal-simple-body input:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.modal-simple-footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.btn-confirmar {
  background: #0284c7;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-family: "Outfit", sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-confirmar:hover {
  background: #0369a1;
}

/* Responsive */
/* @media (max-width: 1024px) {
  #mapa-redes-wrapper {
    display: none !important;
  }
} */
/* --- RESPONSIVE PARA MÓVILES Y TABLETS --- */
@media (max-width: 1024px) {
  #mapa-redes-wrapper {
    flex-direction: column; /* Apila el sidebar y el mapa verticalmente */
    height: auto;           /* Permite que crezca según el contenido */
    min-height: auto;
    padding: 10px;
    gap: 15px;
  }

  #mapa-redes-wrapper #sidebar {
    width: 100%;            /* El panel lateral ocupa todo el ancho */
    order: 4;               /* Coloca el panel debajo del mapa (opcional) */
  }

  #map-container {
    flex: none !important; /* Evita que el mapa se estire en altura */
    width: 100%;
    height: 60vh;           /* Altura ideal para ver el mapa en teléfonos */
    min-height: 350px;
    order: 3;               /* El mapa sale primero en la pantalla móvil */
  }

  .unlock-card {
    display: none; /* Oculta el botón de desbloqueo en móviles para simplificar la UI */
  }

  #sidebar .header-card{
    display: none; /* Oculta el título y subtítulo en móviles para ahorrar espacio */
  }

  .header-card-mobile{
    display: flex !important; /* Muestra el header-card en móviles */
    flex-direction: column;
    padding: 5px;
    color: #0d9488;
    order: 1; /* Asegura que el header-card esté al inicio del sidebar */
  }

  .search-card-mobile{
    display: flex !important; /* Muestra la caja de búsqueda en móviles */
    padding: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
    order: 2; /* Asegura que la búsqueda esté al inicio del sidebar */
  }

  .search-card{
    display: none; /* Oculta la búsqueda original en móviles */
  }

  /* Ajuste de los Modales flotantes dentro del mapa en móviles */
  #attr-modal {
    position: fixed;
    top: auto;
    bottom: 20px;
    left: 20px;
    right: 20px;
    width: auto;            /* Deja de tener ancho estático y se expande */
    z-index: 2000;          /* Asegura estar sobre los controles del mapa */
  }

  /* Reducir espaciados y textos ligeramente en pantallas muy pequeñas */
  .header-card h2 {
    font-size: 1.1rem;
  }
  
  .modal-simple-content {
    width: 90%;             /* El modal de contraseña no se desbordará */
    max-width: 340px;
  }
}


/* Estilos de la UI */
.desc-card p {
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

.header-card {
  display: flex;
  flex-direction: column;
  padding: 5px;
  color: #0d9488;
}

.header-card-mobile{
  display: none; /* Oculto por defecto, se muestra en móviles */
  flex-direction: column;
  padding: 5px;
  color: #0d9488;
}

.search-card-mobile{
  display: none; /* Oculto por defecto, se muestra en móviles */
  padding: 10px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

.search-card-mobile .search-wrapper{
  width: 100%;
}

#autocomplete-list-mobile{
  z-index: 1000000;
}

.header-card h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.header-card p{
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 10px;
  padding-right: 32px;
}

.search-wrapper { position: relative; }

.search-box {
  display: flex;
  align-items: center;
  border-radius: 20px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 15px;
  font-family: "Outfit", sans-serif;
}

.autocomplete-results {
  position: absolute;
  top: 110%;
  left: 0; right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  max-height: 220px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  line-height: 1.3;
}
.autocomplete-item:hover { background-color: #f0fdf4; color: #0d9488; }

.desc-card h3, .layers-card h3 {
  margin: 0;
  font-size: 17px;
  color: #1F345E;
}

.layers-card hr, .desc-card hr {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 10px 0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 0.9rem;
  color: #334155;
}

.line-icon {
  width: 20px;
  height: 3px;
  background-color: #0284c7;
  display: inline-block;
  border-radius: 2px;
}

.node-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #0d9488;
  background: white;
  display: inline-block;
}

.btn-export {
  width: 100%;
  padding: 12px;
  background: #0d9488;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-export:hover { background: #0f766e; }

#map-container {
  flex: 1;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

#map { width: 100%; height: 100%; }

.custom-node {
  background-color: #ffffff;
  border: 3px solid #0d9488;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  cursor: pointer;
}

#attr-modal {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  width: 280px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.modal-header h4 { margin: 0; color: #0f172a; font-size: 1rem; }
.btn-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #94a3b8;
}

#attr-modal label { font-size: 12px; font-weight: 600; color: #475569; display: block; margin-top: 10px; }
#attr-modal input, #attr-modal select { 
  width: 100%; 
  padding: 8px; 
  margin-top: 4px; 
  border: 1px solid #cbd5e1; 
  border-radius: 6px; 
  font-size: 13px;
  outline: none;
}
#attr-modal button.btn-save { 
  margin-top: 18px; 
  width: 100%; 
  padding: 10px; 
  background: #0284c7; 
  color: white; 
  border: none; 
  border-radius: 6px; 
  cursor: pointer; 
  font-weight: 600; 
}
#attr-modal button.btn-delete { 
  margin-top: 8px; 
  width: 100%; 
  padding: 10px; 
  background: #ef4444; 
  color: white; 
  border: none; 
  border-radius: 6px; 
  cursor: pointer; 
  font-weight: 600; 
}

.icon-wrapper {
  width: 44px;
  height: 44px;
  background-color: #0d9488;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-card .title-div, .layers-card .title-div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layer-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  flex-shrink: 0;
}
.layer-item input[type="checkbox"]:checked::before {
  content: "";
  width: 5px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.layer-item #chk-lineas { border: 2px solid #0072bc; }
.layer-item #chk-lineas:checked { background-color: #0072bc; border-color: #0072bc; }
.layer-item #chk-nodos { border: 2px solid #0d9488; }
.layer-item #chk-nodos:checked { background-color: #0d9488; border-color: #0d9488; }