/*
 * The header of every page (issue #916): the title with a round Refresh beside it
 * (common/pageHead.xhtml), and the page's other buttons in the widgetbar as one even block.
 *
 * Before, each h:form in the widgetbar was a block of its own, so a button in a form took a whole
 * line and the links beside it shared one, spaced by mr-1 and with no gap between the rows. Here
 * the forms step aside (display: contents) and their buttons line up with the links.
 */

.breadcrumbbar .page-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.breadcrumbbar .page-head .page-title {
    margin-bottom: 0;
    min-width: 0;
}

.page-head .page-refresh {
    display: contents;
}

body .page-head .btn-refresh,
.page-head a.btn-refresh {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    background: #fff;
    border: 1px solid #007bff;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
}

body .page-head .btn-refresh:hover,
.page-head a.btn-refresh:hover {
    background: #e7f1ff;
}

/* desktop: the buttons in one right-aligned row, the same gap between all of them */
.breadcrumbbar .widgetbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
}

.breadcrumbbar .widgetbar form {
    display: contents;
}

/* the charging plan's growl sits in its form as an empty span - it must not take a cell */
.breadcrumbbar .widgetbar form > span:not(.btn) {
    display: contents;
}

.breadcrumbbar .widgetbar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    margin: 0;
}

@media (max-width: 767.98px) {
    /* a phone: the title on the left, Refresh at the right edge, within thumb's reach */
    .breadcrumbbar .page-head {
        justify-content: space-between;
    }

    .page-head .btn-refresh,
    .page-head a.btn-refresh {
        width: 44px;
        height: 44px;
    }

    /* equal tiles: one button fills the row, two halve it, three and more go three to a row */
    .breadcrumbbar .widgetbar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
    }

    .breadcrumbbar .widgetbar .btn {
        min-height: 3rem;
        white-space: normal;
        line-height: 1.2;
        text-align: center;
    }

    /* what the bar says rather than does - the time of the data, the car switch - spans the row */
    .breadcrumbbar .widgetbar .bar-info {
        grid-column: 1 / -1;
    }
}
