/* puush website: the pages you see logged in (uploads, settings, admin): header, menu bar, uploads, dialogs. */

:root {
    --slate: #424b51;
    --slate-mid: #697175;
    --slate-light: #bac0c6;
    --link: #7992a2;
    --selected: #ffae00;
    --text: #eae5e1;
    --error: #ffb4b4;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--slate);
    color: #fff;
    font: 13px/1.4 Helvetica, Arial, sans-serif;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--selected);
    outline-offset: 1px;
}

/* Top bar: logo on the left, account summary and picture on the right. */

#my-menubox {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    height: 64px;
    background: var(--slate) url(../img/bar-bg.png) repeat-x;
}

#puush_button {
    flex: none;
    width: 212px;
    height: 64px;
    margin-left: 5px;
    background: url(../img/puush-menuhead.png) no-repeat;
}

#header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 3px 10px 0 0;
    line-height: 20px;
    text-align: right;
    text-shadow: var(--slate) 1px 1px 1px;
    overflow-wrap: anywhere;
}

.header-avatar-link {
    flex: none;
    border-radius: 50%;
}

/* Profile pictures: a photo, or a letter on a colour (see puush.avatar in common.js). */

.avatar {
    display: inline-block;
    flex: none;
    border-radius: 50%;
    background: #1d2124;
    object-fit: cover;
    vertical-align: middle;
}

.avatar.initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    line-height: 1;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
    user-select: none;
}

.header-avatar {
    width: 48px;
    height: 48px;
    border: 2px solid rgba(255, 255, 255, .85);
    box-shadow: 0 0 3px #1a1c1d;
    font-size: 21px;
}

/* Menu bar: the page tabs on the left, the page's own buttons and Logout on the right. */

.my-menubar {
    display: flex;
    height: 31px;
    border-top: 1px solid var(--slate-mid);
    background: url(../img/toolbar.png) repeat-x;
}

.my-menubar a {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px;
    color: var(--slate-mid);
    font-size: 18px;
    line-height: 30px;
    text-decoration: none;
    white-space: nowrap;
}

.my-menubar a:hover {
    background: var(--slate-light);
    color: var(--slate-mid);
}

.my-menubar img {
    width: 22px;
    height: 22px;
}

.my-menubar .spacer {
    flex: 1;
}

/* The current page's tab joins the strip under the bar. */
.my-menubar .tab[aria-current="page"],
.my-menubar .tab[aria-current="page"]:hover {
    background: var(--slate-mid);
    color: #fff;
    text-shadow: var(--slate) 1px 1px 1px;
    cursor: default;
}

/* While two-factor login still has to be set up, the other tabs wait. */
.my-menubar .tab.waiting {
    opacity: .4;
    pointer-events: none;
}

/* In select mode the bar darkens so it's obvious clicks select instead of opening. */
.my-menubar.select-mode {
    background: var(--slate);
}

.my-menubar.select-mode a {
    color: var(--text);
}

.my-menubar.select-mode a:hover {
    color: var(--slate);
}

/* All / None / Delete only appear in select mode, and make room by hiding the tabs. */
.my-menubar .select,
.my-menubar.select-mode .tab {
    display: none;
}

@media (max-width: 520px) {
    .my-menubar a {
        padding: 0 8px;
        font-size: 15px;
    }

    #header-meta {
        font-size: 12px;
        line-height: 18px;
    }

    .header-avatar-link {
        display: none;
    }
}

@media (max-width: 420px) {
    .my-menubar img {
        display: none;
    }
}

@media (max-width: 360px) {
    .my-menubar a {
        padding: 0 6px;
    }
}

/* Strip under the menu bar: page number, or a summary of the page. */

#pool_info {
    min-height: 28px;
    padding: 5px 10px;
    background: var(--slate-mid);
    text-align: right;
    text-shadow: var(--slate) 1px 1px 1px;
}

/* Upload grid */

#hist_result:not(:empty) {
    padding: 10px;
    color: var(--error);
}

#puushes {
    display: grid;
    grid-template-columns: repeat(auto-fill, 102px);
    gap: 10px;
    padding: 10px;
}

.puush_tile {
    width: 102px;
    height: 102px;
    border: 1px solid #333a3f;
    background: #fff;
    box-shadow: 0 0 3px #1a1c1d;
}

.puush_tile.selected {
    border-color: var(--selected);
    background: var(--selected);
}

.puush_tile a {
    display: block;
}

.puush_tile .thumb {
    display: block;
    width: 100px;
    height: 100px;
    background: #1d2124;
    object-fit: cover;
}

.puush_tile.selected .thumb {
    opacity: .8;
}

#puushes .empty {
    grid-column: 1 / -1;
    padding: 10px 0;
    color: var(--text);
}

#pagination {
    padding: 4px;
    background: var(--slate-mid);
    text-align: center;
}

#pagination:empty {
    display: none;
}

#pagination a,
#pagination span {
    display: inline-block;
    margin: 0 5px;
    padding: 1px 5px;
    color: #fff;
    font-weight: bold;
    line-height: 2em;
}

#pagination .page {
    font-size: 16px;
}

/* Delete confirmation and "working" box */

#blinds {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
}

/* Fades for the overlay, dialogs and select-mode buttons (toggled by puush.fade). */
#blinds,
#throbber,
.dialog,
.my-menubar .select {
    opacity: 0;
    transition: opacity .4s;
}

#throbber.shown,
.dialog.shown,
.my-menubar .select.shown {
    opacity: 1;
}

#blinds.shown {
    opacity: .8;
}

#throbber,
.dialog {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 15px 20px;
    border: 1px solid var(--slate-light);
    border-radius: 5px;
    background: #fff;
    color: #000;
    text-align: center;
}

#throbber {
    width: 220px;
}

.dialog {
    width: 240px;
}

#throbber h1,
.dialog h1 {
    margin: 0 0 10px;
    font-size: 20px;
}

.dialog p {
    margin: 8px 0 12px;
}

.dialog .actions {
    font-size: 14px;
}
