/* Interactive face boxes over an image (see Item.razor + js/face-overlay.js). */
.js-face-container {
    position: relative;
    display: block;
    line-height: 0;
}

.js-face-container img {
    width: 100%;
    height: auto;
    display: block;
}

.face-box {
    position: absolute;
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    cursor: pointer; /* finger pointer over a box */
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    pointer-events: none; /* not interactive until shown */
}

/* Boxes are only shown (and clickable) while the container is "active". */
.js-face-container.show-faces .face-box {
    opacity: 1;
    pointer-events: auto;
}

.face-box:hover {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7);
}

.face-box .face-label {
    position: absolute;
    bottom: 100%;
    left: -2px;
    margin-bottom: 4px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font: 500 12px/1.4 system-ui, sans-serif;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.1s ease;
    pointer-events: none;
}

.face-box:hover .face-label {
    opacity: 1; /* name appears when hovering the box */
}

/* Hover-to-reveal trash on cluster cards (Unknown clusters page). */
.cluster-card {
    position: relative;
}

.cluster-trash {
    position: absolute;
    top: 0;
    right: 8px;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.cluster-card:hover .cluster-trash {
    opacity: 1;
}

/* Person name/merge autocomplete dropdown. */
.js-person-ac {
    position: relative;
    display: inline-block;
}

/* Face-assign autocomplete on the item page (full-width inside the face card). */
.js-face-ac {
    position: relative;
    display: block;
    width: 100%;
}

/* Red text until a valid (named) person is entered/selected. */
.fac-input.fac-invalid {
    color: #c62828;
}

/* Split wizard: similarity threshold slider + capture cards. */
.split-threshold {
    accent-color: #594ae2;
}


.split-cap-card {
    position: relative;
    width: 110px;
    cursor: pointer;
    display: block;
}

.split-cap-card img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.split-cap-card .split-cap {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Dim the captures that are not selected to move. */
.split-cap-card:has(.split-cap:not(:checked)) img {
    opacity: 0.4;
}

.split-cap-card .split-sim {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
}

.ac-dropdown,
.fac-dropdown,
.split-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    margin-top: 4px;
    min-width: 280px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    cursor: pointer;
}

.ac-item:hover {
    background: var(--mud-palette-action-default-hover);
}

.ac-item img,
.ac-item .ac-noimg {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--mud-palette-background-grey);
    flex: 0 0 auto;
}

/* Add/Rename = green; Merge = purple. */
.ac-btn {
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    font: 500 0.875rem/1.75 inherit;
    color: #fff;
    cursor: pointer;
    background: #2e7d32; /* green */
    transition: background 0.15s ease;
    white-space: nowrap;
}

.ac-btn:hover {
    background: #276a2b;
}

.ac-btn--merge {
    background: #594ae2; /* purple */
}

.ac-btn--merge:hover {
    background: #4a3cc4;
}

/* Ghost = "not granted" access chip (click to grant). */
.ac-btn--ghost {
    background: transparent;
    border: 1px solid var(--mud-palette-lines-default);
    color: var(--mud-palette-text-secondary);
}

.ac-btn--ghost:hover {
    background: var(--mud-palette-action-default-hover);
}

/* Tag chips. */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--mud-palette-action-default-hover);
    border-radius: 14px;
    padding: 2px 8px 2px 12px;
    font-size: 0.8rem;
}

.tag-chip a {
    text-decoration: none;
    color: inherit;
}

.tag-chip-x {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--mud-palette-text-secondary);
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
}

.tag-chip-x:hover {
    color: var(--mud-palette-error);
}

.tag-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: inherit;
    background: var(--mud-palette-action-default-hover);
    border-radius: 14px;
    padding: 3px 12px;
    font-size: 0.82rem;
}

.tag-filter.active {
    background: #594ae2;
    color: #fff;
}

/* Small leading label for chip rows (Tags / Years). */
.chip-row-label {
    color: var(--mud-palette-text-secondary);
    min-width: 44px;
    margin-right: 4px;
}

/* History-aware Back control (rendered as a <button>, styled like a link). */
.js-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--mud-palette-primary);
    font: 500 0.9rem/1.6 inherit;
}

.js-back:hover {
    text-decoration: underline;
}

/* Activity dashboard. */
.act-h {
    font: 600 0.95rem/1.6 system-ui, sans-serif;
    margin: 18px 0 6px;
}

.act-h .act-muted {
    font-weight: 400;
}

.act-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    font-size: 0.88rem;
}

.act-muted {
    color: var(--mud-palette-text-secondary);
    white-space: nowrap;
}

.act-fail span:last-child {
    color: var(--mud-palette-error);
}

.act-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 2px;
}

.act-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--mud-palette-action-default-hover);
    overflow: hidden;
}

.act-bar-fill {
    height: 100%;
    background: var(--mud-palette-primary);
    transition: width 0.4s ease;
}

/* Processing-status badge on the item page. */
.proc-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font: 600 0.72rem/1.5 system-ui, sans-serif;
    color: #fff;
    white-space: nowrap;
}

/* Active nav item in the app bar. */
.nav-active {
    font-weight: 600;
    border-bottom: 2px solid currentColor;
    padding-bottom: 2px;
}

/* Style the app's plain (non-MudBlazor) form controls to fit the dark theme.
   Scoped to exclude MudBlazor's own inputs (which carry mud-* classes). */
input:not([class*="mud"]),
select:not([class*="mud"]),
textarea:not([class*="mud"]) {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: 6px;
    font: inherit;
}

input:not([class*="mud"]):focus,
select:not([class*="mud"]):focus,
textarea:not([class*="mud"]):focus {
    outline: none;
    border-color: var(--mud-palette-primary);
}

input::placeholder {
    color: var(--mud-palette-text-secondary);
}

/* Make the native date picker glyph legible on a dark surface. */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.85);
    cursor: pointer;
}

/* Fullscreen image lightbox (js/lightbox.js). */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
}

.lightbox-overlay.open {
    display: flex;
}

body.lightbox-locked {
    overflow: hidden;
}

.lightbox-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* The stage shrink-wraps the fit-to-screen image so the face layer aligns exactly. */
.lightbox-stage {
    position: relative;
    display: inline-block;
    line-height: 0;
}

/* Zoom to fit: scale the image down to the viewport (overrides .js-face-container img width:100%). */
.lightbox-stage img.lightbox-img {
    width: auto;
    height: auto;
    max-width: 96vw;
    max-height: 86vh;
    display: block;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

/* Face boxes overlay, aligned to the displayed image. */
.lightbox-faces {
    position: absolute;
    inset: 0;
}

.lightbox-caption {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
    font: 500 0.9rem/1.4 system-ui, sans-serif;
}

.lightbox-caption .lightbox-details {
    color: #b9b2ff;
    text-decoration: none;
    white-space: nowrap;
}

.lightbox-caption .lightbox-details:hover {
    text-decoration: underline;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-nav {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    width: 56px;
    height: 88px;
    margin: 0 8px;
    border-radius: 8px;
    cursor: pointer;
    flex: 0 0 auto;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Media card thumbnail + type/duration overlays. */
.media-thumb {
    position: relative;
    line-height: 0;
}

.media-thumb-placeholder {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mud-palette-background-grey);
}

.media-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

.media-badge-play {
    background: rgba(89, 74, 226, 0.85); /* purple accent for video */
}

.media-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    padding: 1px 6px;
    border-radius: 4px;
    font: 600 11px/1.5 system-ui, sans-serif;
    color: #fff;
    background: rgba(0, 0, 0, 0.72);
}

/* Horizontal "Netflix-style" shelves on the library home. */
.shelf {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}

.shelf-card {
    flex: 0 0 160px;
    width: 160px;
    scroll-snap-align: start;
}

.shelf-card-wide {
    flex: 0 0 220px;
    width: 220px;
    scroll-snap-align: start;
}

.people-shelf-item {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

/* In-app changelog page. */
.changelog .cl-ver {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 1.4rem 0 0.2rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}
.changelog .cl-ver:first-child { margin-top: 0; }
.changelog .cl-sec {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mud-palette-primary);
    margin: 0.9rem 0 0.3rem;
}
.changelog .cl-list { margin: 0 0 0.4rem 1.1rem; }
.changelog .cl-list li { margin: 0.15rem 0; line-height: 1.45; }
.changelog code {
    background: var(--mud-palette-background-grey);
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    font-size: 0.85em;
}
