.window{
    position: absolute;
    border: unset;
    border-radius: 0.8rem;
    background-color: white;
    -webkit-box-shadow: var(--window-shadow);
    -moz-box-shadow: var(--window-shadow);
    box-shadow: var(--window-shadow);
    overflow: hidden;
    visibility: hidden;

    .window-header{
        display: flex;
        align-items: center;
        gap: 0.625rem;
        padding: 0.75rem 1rem;
        background-color: var(--app-color-3);
        color: var(--app-color-1);

        >svg{
            flex-shrink: 0;
            width: 1.5rem;
            height: 1.5rem;
        }

        >span{
            padding: 0 0.2rem;
        }

        >span.action{
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            width: 1.5rem;
            height: 1.5rem;
            text-align: center;
            line-height: 1rem;
            cursor: pointer;
            border-radius: 0.3rem;

            svg{
                width: 1.125rem;
                height: 1.125rem;
            }
        }

        >span.action:hover{
            background-color: rgba(255, 255, 255, 0.2);
        }

        >div{
            padding: 0 0.2rem;
            flex-grow: 1;
            font-size: 1rem;
            font-weight: 700;
            /* XuntaSans deja el centro optico del texto ligeramente alto:
               baja 1px para centrarlo respecto al icono */
            transform: translateY(1px);
        }
    }
    .window-body{
        display: block;
    }
}
.window.minimize{
    .window-body{
        display: none;
    }
    .action.minimize{
        background-color: rgba(255, 255, 255, 0.3);
    }
}
.window.maximize{
    /* !important: los IDs de cada ventana (p.ej. #window-file-loader con
       width:28rem) ganaban por especificidad y el popup maximizado solo
       ocupaba una franja de la pantalla. */
    width: 100vw !important;
    height: 100vh !important;
    /* los max-* concretos de cada ventana (p.ej. #window-legend con
       max-height:20rem) capaban la ventana aunque tuviera 100vh */
    max-width: none !important;
    max-height: none !important;
    left: 0 !important;
    top: 0 !important;
    z-index: 9999999;
    border-radius: 0;

    .window-body{
        /* el cuerpo ocupa todo el alto libre bajo la cabecera y no
           desborda el ancho en pantallas estrechas */
        max-height: none;
        min-width: 0;
        width: 100%;
        height: calc(100vh - var(--window-header, 3rem));
    }

    .action.maximize{
        background-color: rgba(255, 255, 255, 0.3);
    }
}
.window.active{
    visibility: visible;
}

/* En pantallas pequenas las ventanas se abren ya a pantalla completa:
   solo queda el boton de cerrar. */
body.mobile .window .window-header > span.action.minimize,
body.mobile .window .window-header > span.action.maximize{
    display: none;
}

/* En pantallas pequenas las cabeceras muestran siempre el puntero por
   defecto (no grab, aunque la ventana sea arrastrable en escritorio). */
body.mobile .window .window-header{
    cursor: default !important;
}

/* La X de cierre de los menus que no son .window (p.ej. el panel de
   secciones en movil): la franja completa no es clicable, solo el
   icono (el resto muestra el puntero por defecto). */
.close-parent{
    cursor: default;
    pointer-events: none;
}
.close-parent svg{
    pointer-events: all;
    cursor: pointer;
}
.close-parent svg:hover{
    opacity: 0.7;
}
