/****************************************************
 * CONTENIDORS PRINCIPALS
 ****************************************************/
.dg-app-wrapper {
    width: 100%;
    height: 500px !important;
    position: relative;
}

#dg-app-container {
    width: 100%;
    height: 500px;
    position: relative;
    background: transparent;
    transition: opacity 0.6s ease;
}

#dg-app-container.fade-in {
    opacity: 1;
}

#dg-intro-wrapper {
    text-align: center;
    position: relative;
}

/****************************************************
 * MAPA MAPLIBRE
 ****************************************************/
#dg-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
}

/****************************************************
 * MAPLIBRE MARKERS FIX (CRÍTIC PER EVITAR DESPLAÇAMENT)
 ****************************************************/
.maplibregl-marker {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    will-change: transform;
    z-index: 9997;
}

.dg-user-marker {
    width: 120px;
    height: 120px;
    display: block;
    margin: 0;
    padding: 0;
}

/****************************************************
 * BOTÓ COMENÇAR RUTA
 ****************************************************/
.dg-start-btn {
    padding: 14px 22px;
    font-size: 18px;
    border-radius: 8px;
    background: #007aff;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: opacity 0.4s ease;
    z-index: 999999 !important;
}

.dg-start-btn.fade-out {
    opacity: 0;
    pointer-events: none;
}

/****************************************************
 * BOTONS FLOTANTS SOBRE EL MAPA
 ****************************************************/
.dg-map-btn {
    position: absolute;
    right: 15px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    border: none;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.dg-map-btn.active {
    background-color: #007AFF;
    color: #ffffff;
}

.dg-map-btn svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

/* Botó fullscreen */
#dg-fullscreen-btn {
    top: 15px;
}

/* Botó centrar */
#dg-center-btn {
    top: 75px;
}

/* Botó brúixola */
#dg-compass-mode-btn {
    top: 140px;
}

/****************************************************
 * MODE BLAU
 ****************************************************/
/* .dg-blue-mode .maplibregl-canvas {
    filter:
        grayscale(1)
        invert(0.7)
        sepia(1)
        hue-rotate(190deg)
        saturate(3.5)
        brightness(1.30)
        contrast(1.20) !important;
} */

/****************************************************
 * BRÚIXOLA / AGULLA
 ****************************************************/
.dg-compass {
    width: 60px;
    height: 60px;
    position: relative;
}

.dg-compass-needle {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 30px solid red;
    position: absolute;
    top: 15px;
    left: 20px;
    transform-origin: 50% 100%;
}

/****************************************************
 * ANIMACIONS
 ****************************************************/
.fade-in {
    opacity: 1;
}

.fade-out {
    opacity: 0;
}

/****************************************************
 * MAPLIBRE CONTROLS
 *
 * Dejamos que MapLibre gestione los iconos.
 * Solo controlamos posición, tamaño y z-index.
 ****************************************************/

#dg-map .maplibregl-control-container {
    position: absolute !important;
    inset: 0 !important;
    z-index: 10000 !important;
    pointer-events: none !important;
}

/* Contenedor superior izquierdo */
#dg-map .maplibregl-ctrl-top-left {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    pointer-events: auto !important;
}

/* Grupo de controles */
#dg-map .maplibregl-ctrl-group {
    margin: 0 !important;
    padding: 0 !important;

    background: #ffffff !important;

    border-radius: 4px !important;

    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.30) !important;

    overflow: hidden !important;
}

/* Botones */
#dg-map .maplibregl-ctrl-group button {
    width: 32px !important;
    height: 32px !important;

    margin: 0 !important;
    padding: 0 !important;

    display: block !important;

    background-color: #ffffff !important;

    border: 0 !important;

    cursor: pointer !important;
}

/* Separación entre botones */
#dg-map .maplibregl-ctrl-group button + button {
    border-top: 1px solid #ddd !important;
}

/*
 * IMPORTANTE:
 *
 * NO definimos background-image.
 * MapLibre ya proporciona sus propios iconos.
 */

/*
 * No ocultar ::before / ::after.
 * Algunas versiones de MapLibre pueden utilizarlos.
 */

/* Brújula: mantener el giro que aplica MapLibre */
#dg-map .maplibregl-ctrl-compass {
    background-color: #ffffff !important;
}

/*
 * Aseguramos que los controles sean visibles
 * aunque algún CSS global de WordPress interfiera.
 */
#dg-map .maplibregl-ctrl-group button {
    visibility: visible !important;
    opacity: 1 !important;
}

/****************************************************
 * MAPLIBRE - POSICIONAMIENTO DE CONTROLES
 ****************************************************/

#dg-map .maplibregl-ctrl-top-left {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
}

#dg-map .maplibregl-ctrl-top-right {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
}

#dg-map .maplibregl-ctrl-bottom-left {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
}

#dg-map .maplibregl-ctrl-bottom-right {
    position: absolute !important;
    bottom: 0 !important;
    right: 0 !important;
}

#dg-map .maplibregl-ctrl-container {
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none;
}

#dg-map .maplibregl-ctrl {
    pointer-events: auto;
}

/****************************************************
 * MAPLIBRE - CONTROLES NATIVOS
 ****************************************************/

#dg-map .maplibregl-control-container {
    position: absolute !important;
    z-index: 10000 !important;
    pointer-events: none !important;
}

#dg-map .maplibregl-ctrl-top-left {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    pointer-events: auto !important;
}

#dg-map .maplibregl-ctrl-group {
    background: #fff !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.3) !important;
    overflow: hidden !important;
}

#dg-map .maplibregl-ctrl-group button {
    display: block !important;
    width: 32px !important;
    height: 32px !important;

    margin: 0 !important;
    padding: 0 !important;

    background-color: #fff !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 24px 24px !important;

    border: 0 !important;
    cursor: pointer !important;
}

/* Separador entre botones */
#dg-map .maplibregl-ctrl-group button + button {
    border-top: 1px solid #ddd !important;
}

/* Zoom + */
#dg-map .maplibregl-ctrl-zoom-in {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M19 11h-6V5h-2v6H5v2h6v6h2v-6h6z' fill='%23333'/%3E%3C/svg%3E") !important;
}

/* Zoom - */
#dg-map .maplibregl-ctrl-zoom-out {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M5 11h14v2H5z' fill='%23333'/%3E%3C/svg%3E") !important;
}

/* Brújula */
#dg-map .maplibregl-ctrl-compass {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l7 18-7-4-7 4 7-18zm0 5-3 8 3-2 3 2-3-8z' fill='%23333'/%3E%3C/svg%3E") !important;
}

/* Evitar que algún CSS global oculte el contenido */
#dg-map .maplibregl-ctrl button::before,
#dg-map .maplibregl-ctrl button::after {
    display: none !important;
}