@import url('open-iconic/font/css/open-iconic-bootstrap.min.css');

html,
body {
    /*
     * Pre-series model: .page/.content own the layout scroll (content-scoped
     * scrollbar), but do NOT set overflow:hidden on html/body — Chrome treats
     * that as root overflow-y hidden and disables native pull-to-refresh.
     */
    height: 100%;
    height: 100dvh;
    min-height: 100%;
    min-height: 100dvh;
    margin: 0;
    touch-action: manipulation;
    /*
     * Mobile Chrome paints html/body in overscroll / uncovered bottom areas.
     * MudThemeProvider defaults body to --mud-palette-background (#32333d in dark),
     * while app content uses --content-background-color (#27272f). Match content
     * so the bottom of the screen does not show a different band of color.
     */
    background-color: var(--content-background-color);
}

/*
 * Games only: suppress Chrome native PTR (Games has its own tab PTR).
 * Playground keeps default native PTR like other content-scrolling pages.
 * overflow:hidden on the root is what turns native PTR off.
 */
html:has(.games-page-shell),
body:has(.games-page-shell) {
    overflow: hidden;
    overscroll-behavior-y: none;
}

/* Win over MudBlazor's body { background-color: var(--mud-palette-background) }. */
html body {
    background-color: var(--content-background-color) !important;
}

:root {
    --pilottapp-logo-font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
    --pilottapp-logo-font-weight: 600;
}

.brand-name,
.card-text.card-app-name {
    font-family: var(--pilottapp-logo-font-family);
    font-weight: var(--pilottapp-logo-font-weight);
    letter-spacing: 0.03em;
}

/* Bootstrap reboot styles every hr with a faded background fill; MudDivider uses border-top only. */
hr.mud-divider {
    margin: 0;
    background-color: transparent;
    opacity: 1;
    color: inherit;
}

.rz-dialog {
    position: fixed !important;
    background-color: var(--top-row-background-color) !important;
}

.rz-dialog-title {
    color: var(--mud-palette-text-primary) !important;
}

.rz-dialog-titlebar {
    background-color: var(--top-row-background-color) !important;
    color: var(--mud-palette-text-primary) !important;
}

.rz-dialog-wrapper {
    --rz-dialog-mask-background-color: transparent;
}

div.rz-dialog-wrapper {
    position: absolute;
    width: -webkit-fill-available;
}

.rz-card-welcome-login {
    align-content: center;
    height: 100%;
    background: linear-gradient(to right, var(--pilottapp-accent-color), var(--top-row-background-color));
}

@media handheld,
screen and (max-width: 1023px) {
    .rz-card-welcome-login {
        background: linear-gradient(to bottom, var(--pilottapp-accent-color), var(--top-row-background-color));
    }
}

@media (max-width: 1023px) {
    .rz-card-welcome-login {
        background: linear-gradient(to bottom, var(--pilottapp-accent-color), var(--top-row-background-color));
    }
}

@media (max-width: 768px) {

    div.rz-dialog:not(.rz-dialog-confirm):not(.rz-dialog-alert) {
        width: fit-content !important;
        inset-block-start: 30% !important;
    }
}

.button-menu-toggler {
    position: absolute !important;
    right: 0 !important;
}

@media (min-width: 641px) {
    .button-menu-toggler {
        display: none !important;
    }
}

@media handheld,
screen and (min-width: 641px) {
    .button-menu-toggler {
        display: none !important;
    }
}

.rz-data-grid-data .rz-grid-table thead tr th {
    background-color: var(--top-row-background-color) !important;
}

.rz-data-grid-data .rz-grid-table tbody .rz-data-row td {
    background-color: var(--top-row-background-color) !important;
}

.components-reconnect-show {
    display: block !important;
}

.rz-column-title-content {
    color: var(--mud-palette-text-primary) !important;
}

.rz-cell-data {
    color: var(--mud-palette-text-secondary) !important;
}

.rz-datatable-data td .rz-cell-data,
.rz-grid-table td .rz-cell-data {
    justify-self: center;
}

.rz-grid-table thead th .rz-column-title {
    justify-content: center;
    padding-inline: 0 !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

.rz-grid-filter-icon {
    margin-inline: 0;
}

.components-reconnect-overlay {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    overflow: hidden;
    animation: components-reconnect-fade-in;
}

.components-reconnect-overlay.components-reconnect-visible {
    display: block;
}

.components-reconnect-overlay::before {
    content: '';
    background-color: rgba(0, 0, 0, 0.4);
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    animation: components-reconnect-fadeInOpacity 0.5s ease-in-out;
    opacity: 1;
}

.components-reconnect-overlay p {
    margin: 0;
    text-align: center;
}

.components-reconnect-overlay button {
    border: 0;
    background-color: #6b9ed2;
    color: white;
    padding: 4px 24px;
    border-radius: 4px;
}

.components-reconnect-overlay button:hover {
    background-color: #3b6ea2;
}

.components-reconnect-overlay button:active {
    background-color: #6b9ed2;
}

.components-reconnect-dialog {
    position: relative;
    background-color: var(--mud-palette-background);
    width: 20rem;
    margin: 20vh auto;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 3px 6px 2px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    opacity: 0;
    animation: components-reconnect-slideUp 1.5s cubic-bezier(.05, .89, .25, 1.02) 0.3s, components-reconnect-fadeInOpacity 0.5s ease-out 0.3s;
    animation-fill-mode: forwards;
    z-index: 10001;
}

.components-rejoining-animation {
    display: block;
    position: relative;
    width: 80px;
    height: 80px;
}

.components-rejoining-animation div {
    position: absolute;
    border: 3px solid #0087ff;
    opacity: 1;
    border-radius: 50%;
    animation: components-rejoining-animation 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.components-rejoining-animation div:nth-child(2) {
    animation-delay: -0.5s;
}

@keyframes components-rejoining-animation {
    0% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    4.9% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 0;
    }

    5% {
        top: 40px;
        left: 40px;
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        top: 0px;
        left: 0px;
        width: 80px;
        height: 80px;
        opacity: 0;
    }
}

@keyframes components-reconnect-fadeInOpacity {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes components-reconnect-slideUp {
    0% {
        transform: translateY(30px) scale(0.95);
    }

    100% {
        transform: translateY(0);
    }
}

.nav-item :is(:hover, :focus) {
    font-weight: bold;
    background-color: var(--mud-palette-action-default-hover) !important;
}

.content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--content-background-color);
    overflow-x: hidden;
    overflow-y: auto;
    /* Do not use overscroll-behavior: contain here — it blocks native PTR. */
    -webkit-overflow-scrolling: touch;
}

.content > * {
    flex-shrink: 0;
    max-width: 100%;
}

/* Games: fill the article; nested tab panels own scroll (no native PTR). */
.content:has(.games-page-shell) {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.content:has(.games-page-shell) > * {
    flex: 1 1 auto;
    flex-shrink: 1;
    min-height: 0;
}

/*
 * Playground: fill the article but keep .content as the scrollport so Chrome
 * native pull-to-refresh works (same model as other pages).
 */
.content:has(.playground-page) {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.content:has(.playground-page) > * {
    flex: 1 1 auto;
    flex-shrink: 1;
    min-height: 0;
}

/*
 * Non-modal fixed cookie popup.
 * - Sibling of #mainLayout; .page has z-index:0 so the whole app (incl. Games
 *   tabs) stacks beneath this banner — the banner covers/hides the tab bar.
 * - Do NOT pad Games / Index: that pushed tabs / PilottApp above the banner.
 * - Other pages still get content padding so actions remain scrollable.
 */
:root {
    --cookie-consent-reserve: 5.5rem;
}

@media (max-width: 640px) {
    :root {
        --cookie-consent-reserve: 9.5rem;
    }
}

.cookie-consent {
    position: fixed !important;
    bottom: 0 !important;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    z-index: 10 !important;
    pointer-events: auto;
    /* Opaque so Games tabs underneath are fully hidden. */
    background: var(--content-background-color) !important;
}

@media (min-width: 641px) {
    .cookie-consent {
        left: 250px;
        width: auto;
    }
}

html:has(.cookie-consent) .content:not(:has(.games-page-shell)):not(:has(.playground-page)):not(:has(.index-page-container)),
body:has(.cookie-consent) .content:not(:has(.games-page-shell)):not(:has(.playground-page)):not(:has(.index-page-container)) {
    padding-bottom: calc(var(--cookie-consent-reserve) + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
}

/* SuitBet statement display (points label) */
.suit-bet-statement {
    display: inline-flex;
    align-items: baseline;
    gap: 0.15rem;
    font-size: clamp(0.85rem, 2.8vw, 1.1rem);
    color: var(--mud-palette-info-text);
    font-weight: 500;
    justify-content: center;
}

.suit-bet-statement-value {
    color: var(--mud-palette-info-text);
}

.suit-bet-statement-label {
    font-size: 0.75em;
    opacity: 0.9;
}