:root {
    --mud-appbar-height: 64px;
}

html {
    scrollbar-gutter: stable;
}

/* Lock the month / per-row selects to a fixed footprint so their neighbouring
   controls don't drift as the displayed text changes width. Used to keep the
   common filter toolbar aligned across My Photos, Calendar Admin, and Overview. */
.fc-month-fixed {
    flex: 0 0 180px;
    width: 180px;
}
.fc-perrow-fixed {
    flex: 0 0 110px;
    width: 110px;
}
.fc-month-fixed .mud-input-control,
.fc-month-fixed .mud-select,
.fc-perrow-fixed .mud-input-control,
.fc-perrow-fixed .mud-select {
    width: 100%;
}

/* This drawer lives in an interactive island while MudLayout is static, so MudBlazor's
   container cascade never adds the `mud-drawer-fixed` class. Without it MudBlazor falls back
   to `position: absolute` (.mud-drawer:not(.mud-drawer-fixed)), which scrolls with the page and
   can scroll the menu out of view. Restore the fixed positioning the base .mud-drawer already
   declares so the menu stays put when shown. */
.mud-drawer.mud-drawer-pos-left {
    position: fixed;
    top: var(--mud-appbar-height);
    height: calc(100vh - var(--mud-appbar-height));
}

/* On narrow screens (<600px) MudBlazor shrinks the app bar to 56px, but --mud-appbar-height stays
   64px (forced inline on .mud-layout by mudLayoutSync), which leaves an 8px gap above the drawer.
   Pin the drawer to the real 56px app-bar height here so it sits snug under the bar. */
@media (max-width: 599.98px) {
    .mud-drawer.mud-drawer-pos-left {
        top: 56px;
        height: calc(100vh - 56px);
    }
}

.fc-field {
    margin-bottom: 1rem;
}

.fc-field > label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--mud-palette-text-secondary);
}

.fc-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--mud-palette-text-primary);
    background-color: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--mud-default-borderradius, 4px);
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
}

.fc-input:focus {
    border-color: var(--mud-palette-primary);
    box-shadow: 0 0 0 1px var(--mud-palette-primary);
}

.fc-input:disabled {
    background-color: var(--mud-palette-action-disabled-background);
    color: var(--mud-palette-action-disabled);
    cursor: not-allowed;
}

.fc-checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.fc-validation-message,
.fc-validation-summary {
    color: var(--mud-palette-error);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.fc-validation-summary ul {
    margin: 0;
    padding-left: 1.25rem;
}

.fc-input-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fc-input-with-icon .fc-input {
    flex: 1;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--mud-palette-success);
}

.invalid {
    outline: 1px solid var(--mud-palette-error);
}

.validation-message {
    color: var(--mud-palette-error);
}

.recovery-code {
    font-family: 'Courier New', monospace;
    background: var(--mud-palette-action-default-hover);
    padding: 2px 6px;
    border-radius: 4px;
    margin: 2px 0;
    display: inline-block;
}

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

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Photo grid + tile + lightbox — shared between My Photos and Calendar Manager pages. */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
    gap: 8px;
}
.photo-grid > * { min-width: 0; }
.photo-tile { cursor: pointer; overflow: hidden; min-width: 0; }
.photo-tile-img-wrap { min-width: 0; }
.photo-tile-selected { outline: 2px solid var(--mud-palette-primary); }
.photo-tile-img-wrap { position: relative; }
.photo-tile-img-wrap img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-tile-check { position: absolute; top: 4px; left: 4px; background: rgba(255,255,255,0.85); border-radius: 50%; }
.photo-tile-zoom {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 120ms ease;
}
.photo-tile-trash {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 120ms ease;
    color: var(--mud-palette-error);
}
.photo-tile:hover .photo-tile-zoom,
.photo-tile:hover .photo-tile-trash { opacity: 1; }
.photo-tile-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1400;
    cursor: zoom-out;
    padding: 2rem;
}
.photo-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
