/* BelitParking: mobile first (360–430 px), desktop from 960 px. */

:root {
    --bp-sidebar-width: 240px;
    --bp-bottom-nav-height: 64px;
}

h1:focus {
    outline: none;
}

/* Touch targets of at least 44 px (docs/04). */
.bp-touch {
    min-height: 44px;
}

/* Content: leave room for the bottom navigation on mobile. */
.bp-main {
    padding-bottom: calc(var(--bp-bottom-nav-height) + env(safe-area-inset-bottom));
}

/* Desktop side menu */
.bp-sidebar {
    display: none;
}

/* Mobile bottom navigation */
.bp-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    display: flex;
    height: calc(var(--bp-bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background-color: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
}

.bp-bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 48px;
    color: var(--mud-palette-text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
}

.bp-bottom-nav a.active {
    color: var(--mud-palette-primary);
    font-weight: 600;
}

@media (min-width: 960px) {
    .bp-sidebar {
        display: block;
        position: fixed;
        top: var(--mud-appbar-height);
        left: 0;
        bottom: 0;
        width: var(--bp-sidebar-width);
        overflow-y: auto;
        background-color: var(--mud-palette-surface);
        border-right: 1px solid var(--mud-palette-lines-default);
    }

    .bp-main {
        margin-left: var(--bp-sidebar-width);
        padding-bottom: 0;
    }

    .bp-bottom-nav {
        display: none;
    }
}

/* Static pages (sign-in, errors) */
.bp-empty-layout {
    min-height: 100vh;
    background-color: var(--mud-palette-background);
}

.bp-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 400px;
    margin: 0 auto;
    padding: 15vh 16px 32px;
}

.bp-login-logo {
    font-size: 4rem !important;
}

.bp-dev-login {
    max-width: 480px;
    margin: 0 auto;
    padding: 32px 16px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 3000;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: #ffecb3;
    color: #000;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: 1rem;
    background: #b32121;
    color: #fff;
}

.blazor-error-boundary::after {
    content: "Došlo je do greške.";
}

/* ---- M4: employee screens ---- */

/* Day cards on the home page: the state is visible at a glance. */
.bp-day-card {
    border-left: 6px solid var(--mud-palette-primary);
}

.bp-day-card.bp-day-ok {
    border-left-color: var(--mud-palette-success);
}

.bp-day-card.bp-day-wait {
    border-left-color: var(--mud-palette-warning);
}

.bp-day-card.bp-day-off {
    border-left-color: var(--mud-palette-lines-default);
    opacity: 0.75;
}

.bp-state {
    font-weight: 600;
}

/* Upcoming days: date and status, then the switches. */
.bp-upcoming-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.bp-upcoming-row:last-child {
    border-bottom: none;
}

.bp-upcoming-date {
    flex: 1 1 140px;
    min-width: 140px;
}

.bp-upcoming-switches {
    display: flex;
    flex-wrap: nowrap;
    margin-left: auto;
}

.bp-upcoming-row.bp-day-off {
    opacity: 0.6;
}

/* Ranking and waitlist: position, name, details; above the line green, below grey. */
.bp-rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    background-color: var(--mud-palette-surface);
    border-left: 4px solid var(--mud-palette-lines-default);
}

.bp-rank-in {
    border-left-color: var(--mud-palette-success);
}

.bp-rank-out {
    opacity: 0.85;
}

.bp-rank-position {
    min-width: 2em;
    font-weight: 600;
    text-align: right;
}

.bp-capacity-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    color: var(--mud-palette-text-secondary);
    font-size: 0.8rem;
}

.bp-capacity-line::before,
.bp-capacity-line::after {
    content: "";
    flex: 1;
    border-top: 2px dashed var(--mud-palette-lines-default);
}

/* Lists with rows (history, transactions). */
.bp-history-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    color: inherit;
    text-decoration: none;
}

.bp-history-row:last-child {
    border-bottom: none;
}

.bp-clickable {
    cursor: pointer;
}

/* Cards on phones, a table on wider screens (docs/04 §6). */
.bp-only-desktop {
    display: none;
}

@media (min-width: 720px) {
    .bp-only-mobile {
        display: none;
    }

    .bp-only-desktop {
        display: block;
    }
}

.bp-period {
    max-width: 280px;
}

/* Rules page (Markdown). */
.bp-markdown {
    line-height: 1.6;
    color: var(--mud-palette-text-primary);
}

.bp-markdown h1 {
    font-size: 1.6rem;
    font-weight: 500;
    margin: 0 0 12px;
}

.bp-markdown h2 {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 28px 0 8px;
}

.bp-markdown p,
.bp-markdown ul,
.bp-markdown ol {
    margin: 0 0 12px;
}

.bp-markdown ul,
.bp-markdown ol {
    padding-left: 1.4em;
}

.bp-markdown li {
    margin-bottom: 4px;
}

.bp-markdown table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 0.875rem;
}

.bp-markdown th,
.bp-markdown td {
    padding: 6px 10px;
    border: 1px solid var(--mud-palette-lines-default);
    text-align: left;
    white-space: nowrap;
}

.bp-markdown th {
    background-color: var(--mud-palette-background-gray);
}

/* Points table: names and headers on one line; the table scrolls sideways when it does not fit. */
.bp-points-table th,
.bp-points-table td {
    white-space: nowrap;
}

/* ---- M5: admin page "Mejlovi" ---- */

/* Sentence case like the buttons ("Izgled", not "IZGLED"). */
.mud-tab {
    text-transform: none;
}

.bp-email-search {
    flex: 1 1 220px;
    max-width: 360px;
}

.bp-min-w-0 {
    min-width: 0;
}

.bp-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bp-nowrap {
    white-space: nowrap;
}

.bp-break {
    overflow-wrap: anywhere;
}

.bp-inline-icon {
    vertical-align: text-bottom;
}

/* Label and value pairs: side by side, stacked on narrow phones. */
.bp-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 16px;
    margin: 0;
}

.bp-facts dt {
    color: var(--mud-palette-text-secondary);
}

.bp-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 400px) {
    .bp-facts {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .bp-facts dd {
        margin-bottom: 8px;
    }
}

/* The email as the recipient sees it; emails have a white background in light and dark mode. */
.bp-email-preview {
    display: block;
    width: 100%;
    height: 640px;
    border: 0;
    background-color: #f3f5f8;
}

.bp-email-text {
    margin: 0;
    padding: 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
}

/* ---- M6: admin pages ---- */

/* Forms stay readable on a wide screen; on a phone they use the full width. */
.bp-admin-form {
    max-width: 640px;
}

.bp-admin-field {
    flex: 1 1 220px;
    max-width: 360px;
}

.bp-admin-date {
    flex: 1 1 150px;
    max-width: 220px;
}

/* Past days and deactivated accounts. */
.bp-muted {
    opacity: 0.65;
}

/* ---- M7: API keys ---- */

/* A new key, shown once: readable and wrapped on a phone. */
.bp-key {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    overflow-wrap: anywhere;
    user-select: all;
}
