html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#app-container {
    display: flex;
    height: 100vh;
}

#main-content {
    height: 100%;
    width: 100%;
}

.leaflet-control-layers {
    display: none !important;
}

/* Hide default control; we use button */
.leaflet-control-zoom {
    display: none !important;
}

.leaflet-control-attribution {
    display: none !important;
}

.leaflet-popup-content-wrapper {
    padding: 0px;
}

.leaflet-popup-content {
    margin: 0px;
}

.map-style-option.selected .border-gray-200 {
    border-color: #3b82f6 !important;
}

.map-style-option .border-blue-500 {
    border-color: #3b82f6 !important;
}

.custom-station-marker {
    background: transparent !important;
    border: none !important;
}

/* Estilos para el popup de estaciones */
/* Estilos para los popups pequeños */
.small-popup .leaflet-popup-content-wrapper {
    padding: 0;
    font-size: 11px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    /* shadow-md de Tailwind, misma que usa el panel de detalle */
}

.small-popup .leaflet-popup-content {
    margin: 0;
}

.small-popup .leaflet-popup-tip-container {
    display: none;
}

/* Estilos para el popup de estaciones */
.station-popup .leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    /* shadow-lg de Tailwind */
}

.station-popup .leaflet-popup-content {
    margin: 0;
}

.station-popup.init-popup .leaflet-popup-content {
    min-height: 10vh;
}

/* Ocultar la flecha triangular del popup para un aspecto más limpio */
.station-popup .leaflet-popup-tip-container {
    display: none;
}

.data-numeric {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

/* Sombras y bordes ajustados según formato del proyecto */
.tooltip-light {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tooltip-dark {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Puntos de estado */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-bueno {
    background-color: #10b981;
}

.status-moderado {
    background-color: #f59e0b;
}

.status-alerta {
    background-color: #f97316;
}

.status-peligroso {
    background-color: #ef4444;
}

.status-offline {
    background-color: #6b7280;
}

/* Modo oscuro */
.dark .text-gray-900 {
    color: #f9fafb !important;
}

.dark .text-gray-700 {
    color: #d1d5db !important;
}

.dark .text-gray-600 {
    color: #9ca3af !important;
}

.dark .text-gray-500 {
    color: #6b7280 !important;
}

.dark .text-gray-400 {
    color: #4b5563 !important;
}

/* Aislar tooltips claros en modo oscuro
    Evita que los selectores globales .dark afecten el contenido de .tooltip-light */
.dark .tooltip-light {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .tooltip-light .text-gray-900 {
    color: #111827 !important;
}

.dark .tooltip-light .text-gray-700 {
    color: #374151 !important;
}

.dark .tooltip-light .text-gray-600 {
    color: #4b5563 !important;
}

.dark .tooltip-light .text-gray-500 {
    color: #6b7280 !important;
}

.dark .tooltip-light .text-gray-400 {
    color: #9ca3af !important;
}

/* Toggle para modo oscuro */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

/* Tooltips específicos - Más compactos */
.tooltip-name-only {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
    min-width: fit-content;
}

.tooltip-variable-only {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    display: inline-block;
    min-width: fit-content;
}

.tooltip-name-value {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    display: inline-block;
    min-width: fit-content;
    max-width: 160px;
}

.tooltip-compact-6vars {
    padding: 8px 10px;
    font-size: 11px;
    width: 250px;
}

.tooltip-value-only {
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
    display: inline-block;
    min-width: fit-content;
}

.status-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-bueno-badge {
    background-color: #dcfce7;
    color: #166534;
}

.status-moderado-badge {
    background-color: #fef3c7;
    color: #92400e;
}

.status-alerta-badge {
    background-color: #fed7aa;
    color: #9a3412;
}

.status-peligroso-badge {
    background-color: #fecaca;
    color: #991b1b;
}

.status-emergencia-badge {
    background-color: #eed6fb;
    color: #6b21a8;
}

.status-offline-badge {
    background-color: #f3f4f6;
    color: #4b5563;
}

.unit-small {
    font-size: 10px;
    opacity: 0.7;
}

.station-tag {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    /* Quitar padding extra si el HTML interno ya lo tiene */
}

/* Ocultar el triángulo/puntero del tooltip */
.station-tag::before {
    display: none !important;
}

@media(max-width: 640px) {
    #top-bar-group {
        max-width: 100vw;
    }

    #custom-map-selector,
    #resolution-selector {
        width: 48px !important;
        min-width: 48px;
        max-width: 48px;
        flex-basis: 48px;
    }

    #custom-map-selector.compact #selected-map,
    #custom-map-selector.compact .fa-chevron-down,
    #resolution-selector.compact #selected-resolution,
    #resolution-selector.compact .fa-chevron-down {
        display: none !important;
    }

    #custom-map-selector.compact #map-button,
    #resolution-selector.compact #resolution-button {
        padding: 0.75rem !important;
        justify-content: center;
    }

    #top-bar-group .relative.flex-1 {
        margin-right: 0;
    }

    #search-button {
        margin-right: 8px;
    }
}

.searchable-select-option {
    padding: 8px 12px;
    cursor: pointer;
    transition: all 150ms ease-in-out;
    border-bottom: 1px solid #f3f4f6;
}

.searchable-select-option:hover {
    background-color: #f8fafc;
}

.searchable-select-option.selected {
    background-color: #eff6ff;
    border-left: 3px solid #2563eb;
}

/* Contenedor del tooltip */
.tooltip-block {
    position: relative;
    display: flex;
    cursor: pointer;
}

/* El globo del tooltip */
.tooltip-block::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 140%; /* Posición arriba del círculo */
    left: 50%;
    transform: translateX(-50%);

    /* Estilos */
    background-color: #1f2937; /* Gris oscuro (bg-gray-800) */
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap; /* Evita que el texto se rompa */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    /* Visibilidad */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10000; /* Por encima de todo */
    pointer-events: none;
}

/* Triángulo pequeño inferior */
.tooltip-block::before {
    content: "";
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 10000;
}

/* Hover: Mostrar ambos */
.tooltip-block:hover::after,
.tooltip-block:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px); /* Pequeño salto hacia arriba */
}

.leaflet-popup-close-button{
    display: none;
}

/* Animación base */
.sk-loading {
  background: #f6f7f8;
  background-image: linear-gradient(90deg, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
  background-repeat: no-repeat;
  background-size: 200% 100%;
  display: inline-block;
  animation: skeletonShimmer 1.5s infinite linear;
  border-radius: 4px;
}

@keyframes skeletonShimmer {
  0% { background-position: -100% 0; }
  100% { background-position: 100% 0; }
}

/* Estructura del Skeleton dentro del Tooltip */
.tooltip-skeleton {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  padding: 2px 0;
}

.sk-dot { width: 12px; height: 12px; border-radius: 50%; }
.sk-text { width: 60px; height: 16px; }
.sk-unit { width: 30px; height: 14px; }

/* Sobrescribir estilos de Leaflet para que se vea limpio */
.leaflet-tooltip.loading-tooltip {
  background-color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-radius: 8px;
}

span[data-color]:last-child{
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

#station-detail-panel-content{
    padding-top: 0.5rem;
}
