html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}



#coords-box {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-size: 14px;
    z-index: 1000;
}

.sidebar {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 9%;
    max-width: 11%;
    height: 32%;
    min-width: 200px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 15px;
    box-sizing: border-box;
    z-index: 999;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}


/* Panel inferior-derecha para KML */
.kml-panel {
  position: absolute;
  right: 10px;
  top: 35%;
  width: 9%;
  max-width: 11%;
  min-width: 200px;
  height: 32%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  padding: 15px;
  box-sizing: border-box;
  z-index: 999;
  overflow-y: auto;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE10+ */
}
.kml-panel::-webkit-scrollbar { display: none; }


/* Panel de KML principal */
#panel-kml {
  top: 35%;    /* puedes cambiar a bottom si prefieres */
  right: 10px;
}

/* Panel de Estructuras 3D */
#panel-kml-3d {
  top: 68.5%;    /* ajústalo a tu gusto */
  right: 10px;
  height: 29%;

}



@media (max-width: 768px) {
    .sidebar {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        min-width: unset;
        max-height: 50%;
        border-radius: 16px;
    }
}

.top-left {
    position: absolute;
    top: 10px;
    left: 160px;
    background: white;
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1000;
}

.layer-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.layer-btn {
    background-color: white;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    box-shadow: 0 0 0 3px #aaa;
}

.layer-btn.active-layer {
    box-shadow: 0 0 0 3px #fa5c00 !important;
}

.layer-btn:focus {
    outline: none;
    box-shadow: none;
}

#loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    display: none;
}

.spinner-inner {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-inner i {
    font-size: 32px;
    color: #fa5c00;
}

#logo-empresa {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 12%;
    min-width: 150px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 1000;
}

#barra-medicion {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    padding: 5px;
}

#listado-objetos {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-30%);
  width: 20%;
  min-width: 150px;
  max-width: 250px;
  max-height: 45%;
  min-height: 20%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  padding: 10px;
  font-size: 14px;
  display: none;
  z-index: 1000;
}
#listado-objetos h4 {
  margin: 0 0 8px;
  font-size: 15px;
  text-align: center;
  color: #333;
}
.objeto-item {
  margin-bottom: 6px;
  padding: 4px 6px;
  border-left: 4px solid #fa5c00;
  background: #f9f9f9;
  border-radius: 4px;
}


/* Splashscreen */
#splashscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5000;
  animation: fadeOutSplash 1s ease-in-out 2s forwards;
}

#splash-logo {
  width: 20%;
  min-width: 150px;
  opacity: 0;
  transform: scale(0.8);
  animation: zoomFadeIn 1s ease-in-out forwards;
}

@keyframes zoomFadeIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeOutSplash {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

#listado-objetos {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE y Edge antiguos */
}

#listado-objetos::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge modernos */
}


.leaflet-print-container,
.leaflet-print-container html,
.leaflet-print-container body,
.leaflet-print-container #map {
  background: white !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}


#splashscreen {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 1s ease;
}

#splash-logo {
  width: 40%;
  opacity: 0;
  animation: fadeIn 1s ease forwards 0.5s;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

#mobile-warning {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: white;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#mobile-warning img {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
}

.medicion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-bottom: 1px solid #ddd;
  font-size: 14px;
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #c00;
  font-size: 14px;
  padding: 2px;
}

.delete-btn:hover {
  color: #900;
}


#utm-input-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: white;
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  width: 120px;
  position: absolute;
  top: 10px; /* debajo del layer-switcher */
  left: 10px;
  z-index: 1000;
}

#utm-input-panel input,
#utm-input-panel button {
  height: 26px;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  width: 100%;
}


.fa-spin {
  animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


#polygon-actions {
  position: absolute;
  bottom: 70px;              /* justo encima de la barra de herramientas */
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  padding: 6px;
  z-index: 1000;
  display: none;             /* visible solo al dibujar */
}
#polygon-actions .layer-btn {
  width: 36px;
  height: 36px;
  padding: 0 10px;
  height: 36px;
  font-size: 18px;
}

.toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #c00;
  font-size: 14px;
  padding: 2px;
}

.toggle-btn:hover { color: #111; }

/* Marca visual de ítems ocultos */
.objeto-item.objeto-oculto {
  opacity: 0.6;
}



/* Asas (handles) de edición de vértices */
.vertex-handle {
  width: 10px;
  height: 10px;
  background: #2ecc71;
  border: 2px solid #1e8449;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}


/* Botón "+" de los midpoints */
.mid-handle {
  font-weight: bold;
  text-align: center;
  color: #2a81cb;
}

/* Ojo: es el MISMO elemento; usa selector combinado, no descendiente */
.mid-handle.leaflet-div-icon {
  width: 24px !important;      /* ajusta a gusto */
  height: 24px !important;
  background: #fff;
  border: 2px dashed #2a81cb;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  font-size: 50px;             /* tamaño del "+" */
  line-height: 24px;           /* centra el "+" */
}





/* === Resaltado temporal en el panel de elementos dibujados === */
.objeto-item.resaltado {
  outline: 2px solid #fa5c00;
  background: #fff3e0;
  transition: background 0.5s ease;
}

/* === Parpadeo de objeto en el mapa === */
@keyframes parpadeo {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.objeto-parpadeo {
  animation: parpadeo 0.8s ease-in-out 2;
}



/* Overlay para el visor 3D */
#iframe-3d-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
}
#iframe-3d-box {
  position: relative;
  width: min(90vw, 1200px);
  height: min(80vh, 800px);
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
#iframe-3d-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
#iframe-3d-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  z-index: 1;
}
#iframe-3d-close i {
  font-size: 18px;
  color: #333;
}

#lista-items .objeto-item{border-left:none !important;}

.color-handle-bar{cursor:grab;}
.color-handle-bar:hover{filter:brightness(.95);}
.color-handle-bar:active{cursor:grabbing;}
.objeto-item.dragging{opacity:.6;}
.objeto-item.drop-target{outline:2px dashed #fa5c00; outline-offset:2px;}

/* Cuadro de búsqueda de elementos */
#search-box-container {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  padding: 10px;
  z-index: 1000;
  display: none;
  width: 300px;
}

#search-box-container.active {
  display: block;
}

#search-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
  outline: none;
}

#search-input:focus {
  border-color: #fa5c00;
}

#search-results {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#search-results::-webkit-scrollbar {
  display: none;
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  margin-bottom: 4px;
  background: #f5f5f5;
  font-size: 14px;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  background: #fa5c00;
  color: white;
}

.search-no-results {
  padding: 12px;
  text-align: center;
  color: #999;
  font-size: 14px;
  font-style: italic;
}

/* Overlay para el streaming en vivo */
#streaming-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

#streaming-box {
  position: relative;
  width: 90vw;
  max-width: 1400px;
  height: 0;
  padding-bottom: 50.625%; /* 16:9 aspect ratio */
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(255, 107, 53, 0.3);
}

#streaming-box iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

#streaming-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 10;
  transition: all 0.2s ease;
}

#streaming-close:hover {
  background: #fa5c00;
  transform: scale(1.1);
}

#streaming-close:hover i {
  color: white;
}

#streaming-close i {
  font-size: 20px;
  color: #333;
  transition: color 0.2s ease;
}

@media (max-width: 768px) {
  #streaming-box {
    width: 95vw;
    max-width: none;
  }
  
  #streaming-close {
    width: 36px;
    height: 36px;
    top: 10px;
    right: 10px;
  }
  
  #streaming-close i {
    font-size: 16px;
  }
}

/* ====================================
   ESTILOS PARA IMPRESIÓN
   ==================================== */

/* Asegurar que el logo sea visible en la impresión/exportación */
@page {
  size: landscape;
  margin: 10;
}


@media print {
  /* Mostrar solo mapa y logo */
  #map {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 0 !important;
  }
  
  #logo-empresa {
    display: block !important;
    visibility: visible !important;
    position: fixed !important;
    bottom: 20px !important;
    left: 20px !important;
    width: 150px !important;
    z-index: 9999 !important;
  }
  
  /* Ocultar todos los controles y paneles */
  .sidebar,
  .kml-panel,
  #coords-box,
  #layer-switcher,
  #utm-input-panel,
  #barra-medicion,
  #listado-objetos,
  #polygon-actions,
  #search-box-container,
  .top-left,
  #loading-spinner,
  .leaflet-control-zoom,
  .leaflet-control-attribution,
  .leaflet-control {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Asegurar fondo blanco */
  body, html {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}


/* ====================================
   ESTILOS PARA GRILLA UTM
   ==================================== */

.grid-label-este,
.grid-label-norte {
  pointer-events: none;
}

.grid-label-este .leaflet-div-icon,
.grid-label-norte .leaflet-div-icon {
  border: none !important;
  background: transparent !important;
}

