terminal-widget {
    --initial-width: 420px;
    --initial-height: 420px;

    position: fixed;
    top: calc(50% - var(--initial-height) / 2);
    left: calc(50% - var(--initial-width) / 2);
    width: var(--initial-width);
    height: var(--initial-height);
    margin: 0;
}

terminal-widget[popover]:popover-open {
    visibility: visible;
}

/* ************************************************** */
/* #region ACTIVATOR                                  */
/* ************************************************** */

:has(terminal-widget[popover]:popover-open) button[popovertarget="project-terminal-popover"] {
    background-color: var(--bg-color-hover);
    color: var(--text-color-hover);
}

/* #endregion */

/* ************************************************** */
/* #region TABS                                       */
/* ************************************************** */

/* Hide tabs-bar when no tabs */
terminal-widget .tabs-bar:not(:has(.tab)) {
    display: none;
}

/* #endregion */

/* ************************************************** */
/* #region TAB CONTENT                                */
/* ************************************************** */

terminal-widget .tab-content {
    overflow: hidden;
}

/* #endregion */

/* ************************************************** */
/* #region EMPTY MESSAGE                              */
/* ************************************************** */

#no-terminal-jobs-notification {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Hide "empty" message when no tabs */
terminal-widget:has(.tab) #no-terminal-jobs-notification {
    display: none;
}

/* #endregion */

/* ************************************************** */
/* #region OUTPUT                                     */
/* ************************************************** */

terminal-widget .terminal-output-wrapper {
    width: 100%;
    height: 100%;
    padding: 0.5em;
    overflow: auto;
}

terminal-widget:has([data-preference="wrap-text"]:checked) .terminal-output {
    white-space: pre-wrap;
    word-break: break-word;
}

/* #endregion */