/* ==========================================================================
   app.css — Global styles for drumroll.games
   Extracted from _header.ejs and _nav.ejs shared <style> blocks.
   ========================================================================== */

/* --- Custom properties --- */
:root {
    --dark-text: #141e26;
    --header-height: 40px;
}

/* --- Material Symbols Rounded icon font --- */
.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 48;
    vertical-align: middle;
}
.icon-bottom { vertical-align: text-bottom; }

/* --- Global element overrides --- */
* {
    touch-action: manipulation;
}

a {
    outline: 0;
    background-color: unset;
}

body {
    max-width: 1000px;
    margin: 0 auto 0 auto;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
}

/* --- Utility classes --- */
.hidden { display: none !important; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.error-text { color: var(--del-color); }
.warning-text { color: #e07b00; }
/* Input warning state — yellow border + warning icon (soft validation, not a hard error) */
input.input-warning {
    border-color: #fdd835 !important;
    padding-right: calc(var(--form-element-spacing-horizontal, 1rem) + 1.5rem) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fdd835'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E") !important;
    background-position: center right .75rem !important;
    background-size: 1rem auto !important;
    background-repeat: no-repeat !important;
}
input.input-warning:focus,
input.input-warning:active {
    border-color: #fdd835 !important;
    box-shadow: 0 0 0 var(--outline-width, 3px) rgba(253, 216, 53, .25) !important;
}
.btn-block { width: 100%; }
.game-title { margin: 0; padding: 0.5em 0; }
[data-busy="disabled"] { opacity: 0.3; cursor: default; }

/* --- Animations --- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }

/* --- Avatar components --- */
.avatar {
    border-radius: 50%;
    border: 3px solid var(--primary);
    vertical-align: middle;
    background-color: var(--secondary);
}
.avatar-sm {
    border-radius: 50%;
    border: 2px solid var(--muted-border-color);
    vertical-align: middle;
}

/* --- Card / article --- */
.card-section { padding: 1em; }
.card-section-flush { padding: 1em; margin-top: 0; }

article details {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

article details summary {
    font-weight: bold;
    color: var(--contrast);
    display: flex;
    align-items: center;
}

article details summary::after {
    margin-inline-start: auto;
}

/* --- Page layout --- */
.bg {
    width: 100%;
    max-width: 1000px;
    position: fixed;
    z-index: -1;
    text-align: center;
}

.content {
    background-color: var(--background-color);
    padding-bottom: 1em;
}

#gameCover {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.cover-spacer { width: 100%; visibility: hidden; max-height: 80vh; object-fit: contain; }

/* --- Grid layouts --- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--spacing); }
.stat-cell { text-align: center; color: var(--primary); }
.stat-cell .material-symbols-rounded { vertical-align: text-bottom; font-size: 18px; }
.bgg-value { font-weight: bold; font-size: x-large; color: var(--color); }

/* --- Player/avatar components --- */
.avatar-wrapper { position: relative; display: inline-block; margin-right: 0.75em; flex-shrink: 0; }
.player-avatar {
    width: var(--avatar-size, 60px);
    height: var(--avatar-size, 60px);
    border-radius: 50%;
    border: 3px solid var(--player-color, transparent);
    display: block;
}
.avatar-status {
    display: none;
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 20px;
    background: var(--card-background-color);
    border-radius: 50%;
    line-height: 1;
    color: var(--player-color, var(--muted-color));
}
.avatar-status.visible { display: block; }
.player-details { display: flex; flex-direction: column; min-width: 0; }
.player-name { font-size: 1.1em; font-weight: 500; }
.color-label {
    display: inline-flex;
    align-items: center;
    gap: 0.2em;
    padding: 0.15em 0.6em;
    border-radius: 1em;
    font-size: 0.875em;
    margin-top: 0.25em;
    width: fit-content;
    color: var(--primary-inverse);
    background-color: var(--player-color, var(--muted-color));
}
.waiting-text {
    font-size: 0.875em;
    color: var(--muted-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.players-summary { display: flex; align-items: baseline; gap: 0.5em; min-width: 0; }

/* --- Form --- */
form td { border: none; vertical-align: top; }

/* ==========================================================================
   Navigation (from _nav.ejs)
   ========================================================================== */

/* --- Drawer overlay / slide-out menu --- */
.drawer {
    position: fixed;
    height: 100vh;
    width: 100vw;
    top: 0px;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 100;
    left: 0;
}

.menu {
    background-color: var(--background-color);
    border-right: 0.25em solid var(--primary);
    height: 100%;
    position: fixed;
    margin-left: -667px;
    top: 0px;
    z-index: 105;
    transition: margin-left 200ms linear;
    padding: 1em;

    display: block;
    width: min(67vw, 667px);
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

#navCheck {
    display: none;
}

#navCheck ~ .drawer {
    display: none;
}

#navCheck:checked ~ .drawer {
    display: block;
}

#navCheck:checked ~ .menu {
    margin-left: 0;
}

/* --- Header bar --- */
#header {
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    width: 100%;
    height: var(--header-height);
    margin-bottom: 0;
    z-index: 10;
    display: block;
    padding: 3px var(--spacing) 3px var(--spacing);
    text-align: center;
}

#header svg {
    margin: auto 0 auto 0.25em;
    width: 32px;
    height: 32px;
    display: inline-block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

#header h2 {
    margin: 0;
    font-size: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#header label {
    float: left;
    width: 32px;
    height: 32px;
}

#headerBorder {
    background-color: var(--primary);
    width: 100%;
    min-height: 0.25em;
    padding: 0.125em var(--spacing);
    position: sticky;
    top: var(--header-height);
    z-index: 10;
    --indicator-left: -15px;
}

#headerBorder::after {
    content: "";
    position: absolute;
    top: -14px;
    left: var(--indicator-left);
    border-top: 7px solid transparent;
    border-bottom: 7px solid var(--primary);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    z-index: 11;
}

/* --- Header icons --- */
#header-icons {
    display: block;
    float: right;
    text-align: right;
}

#header-icons .material-symbols-rounded {
    font-size: 32px;
    color: var(--primary);
}

/* --- Search bar --- */
#searchForm {
    position: relative;
    margin: 0;
}

#searchBarcodeBtn {
    position: absolute;
    right: 0.75em;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4em;
    color: var(--primary);
    cursor: pointer;
    line-height: 1;
}

#searchInput {
    margin: 0.25em auto;
    background-color: var(--contrast-inverse);
    padding-right: 2.5em;
}

/* --- Nav icon --- */
.nav-icon {
    font-size: 32px;
    color: var(--primary);
}

#header .nav-icon {
    display: block;
}

/* --- Nav menu content --- */
.nav-close-label {
    text-align: right;
    margin-bottom: 0;
}

.nav-profile {
    text-align: center;
    margin-bottom: 0;
}

.menu h2 {
    margin-bottom: 0;
}

.nav-link-list {
    list-style: none;
    padding: 0;
    display: block;
}

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 0.25em;
    margin-bottom: 0.5em;
}

.nav-link-item span {
    font-size: 1.5em;
}

.nav-link-item a {
    font-size: 1.5em;
}

/* --- Nav bottom bar --- */
.nav-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    bottom: constant(safe-area-inset-bottom);
    bottom: env(safe-area-inset-bottom);
    width: 100%;
    margin-bottom: 1em;
}

.nav-bottom-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: space-evenly;
}

/* --- Left spacer (menu backdrop) --- */
#leftspacer {
    position: fixed;
    display: block;
    background-color: var(--background-color);
    width: min(67vw, 667px);
    height: 100%;
    top: 0px;
    margin: 0;
    padding: 0;
    margin-left: -667px;
    z-index: 125;
}

/* ==========================================================================
   Small page-specific rules (moved from inline <style> blocks)
   ========================================================================== */

/* --- Game detail (game.ejs) --- */
.bgg-value.tooltip-active::before,
.bgg-value.tooltip-active::after {
    opacity: 1;
}

/* --- Collection list (collection.ejs) --- */
#collectionTable img { width: 150px; }
#collectionTable td:first-child { width: 150px; }
#collectionTable td:last-child { font-size: 1.125em; }

/* --- Users list (users.ejs) --- */
.users-table td:last-child { font-size: 1.125em; }

/* --- Edit-game save button (_actions-edit-game.ejs) --- */
#saveBtn[data-invalid] {
    opacity: 0.4;
    cursor: not-allowed;
}
