/**
 * Estilos personalizados para OpenLayers 10+
 * Popups y controles del mapa
 */

/* Popup styles */
.ol-popup {
    position: absolute;
    background-color: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #cccccc;
    bottom: 12px;
    left: -50px;
    min-width: 280px;
    z-index: 1000;
}

.ol-popup:after, .ol-popup:before {
    top: 100%;
    border: solid transparent;
    content: " ";
    height: 0;
    width: 0;
    position: absolute;
    pointer-events: none;
}

.ol-popup:after {
    border-top-color: white;
    border-width: 10px;
    left: 48px;
    margin-left: -10px;
}

.ol-popup:before {
    border-top-color: #cccccc;
    border-width: 11px;
    left: 48px;
    margin-left: -11px;
}

.ol-popup-closer {
    text-decoration: none;
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 20px;
    color: #999;
}

.ol-popup-closer:hover {
    color: #333;
}

.ol-popup-closer:after {
    content: "✖";
}

.ol-popup-content {
    margin-top: 5px;
}

.ol-popup-content input[type="text"] {
    width: 100%;
    padding: 5px;
    margin: 5px 0 10px 0;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.ol-popup-content button {
    margin-top: 5px;
}

/* Mouse position control */
.ol-mouse-position {
    top: auto;
    bottom: 8px;
    right: 8px;
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
}

/* Scale line control */
.ol-scale-line {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    bottom: 8px;
    left: 8px;
    padding: 2px;
    position: absolute;
}

.ol-scale-line-inner {
    border: 1px solid #000;
    border-top: none;
    color: #000;
    font-size: 10px;
    text-align: center;
    margin: 1px;
    will-change: contents, width;
}

/* Map container */
#mapDraw {
    position: relative;
    width: 100%;
    height: 100vh;
}

/* Asegurarse de que el canvas del mapa tenga el tamaño correcto */
#mapDraw .ol-viewport {
    width: 100%;
    height: 100%;
}

/* Attribution */
.ol-attribution {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 10px;
}

.ol-attribution ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ol-attribution li {
    display: inline;
}

/* Feature selection highlight */
.ol-layer canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Loading spinner para tiles */
.ol-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 999;
}

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

/* Ajustes para toolbar existente */
.toolbar {
    z-index: 1001;
}

/* Mejoras para controles en dispositivos móviles */
@media (max-width: 768px) {
    .ol-popup {
        min-width: 200px;
        left: -30px;
    }

    .ol-mouse-position {
        font-size: 9px;
        padding: 1px 3px;
    }
}
