/* ════════════════════════════════════════════════════════════
 * ui-misc.css — Biosis RCL component stilleri
 * Bölümler: UiRadar, Offender avatar
 * (ui-components.css monolitinden bölündü — 2026-06-02)
 * ════════════════════════════════════════════════════════════ */

/*
 * UiRadar — wrapper styling. The canvas itself is sized via JS using
 * ResizeObserver + DPR, so we only set the outer wrapper here.
 *
 * Wrapper is positioned-relative so the offline overlay can stack on
 * top with absolute positioning. Border + radius give the radar its
 * "framed instrument" look so it reads as a card-internal element
 * regardless of which page it sits in.
 */

/*
 * The wrapper is sized by its mode-driven `aspect-ratio` rather than a
 * fixed pixel height. Width tracks the parent (100%); height derives
 * from the aspect, so the radar always fits its container without the
 * mobile-vs-desktop "tiny radar inside huge box" or "scrollbar inside
 * fixed-height box" failure modes the previous fixed-height approach
 * caused.
 *
 * `--ui-radar-max-h` (set inline by the parameter `MaxHeight`) caps
 * height on wide containers. Without an accompanying max-width, the
 * browser would clamp height but leave width alone — breaking the
 * aspect ratio — so the rule below also caps max-width to
 * `max-h * aspect` so the wrapper shrinks both dimensions in lockstep.
 *
 * `margin-inline: auto` centres the radar inside its card on screens
 * wider than the cap.
 */
.ui-radar {
    position: relative;
    width: 100%;
    margin-inline: auto;
    background: var(--va-bg);
    border: 1px solid var(--va-border);
    border-radius: 10px;
    overflow: hidden;
    /* Default cap is huge so an unset MaxHeight doesn't constrain the
       wrapper. Pages that pass MaxHeight override via inline style. */
    --ui-radar-max-h: 9999px;
    max-height: var(--ui-radar-max-h);
    /* Ready-state fade-in. The wrapper starts invisible so the user
       never sees the half-painted "tiny canvas → resize → big canvas"
       sequence on init. The JS adds `is-ready` after layout has
       converged (two rAFs + 150 ms safety) and the canvas has been
       sized at least once. */
    opacity: 0;
    transition: opacity 220ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ui-radar.is-ready { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    .ui-radar { transition: none; }
}

.ui-radar--half {
    aspect-ratio: 2 / 1;
    /* Cap by both the height-derived ideal AND the parent width — the
       latter prevents the canvas from expanding past a narrow card on
       mobile (where the height cap × 2 would otherwise exceed the
       viewport). */
    max-width: min(calc(var(--ui-radar-max-h) * 2), 100%);
}
.ui-radar--full {
    aspect-ratio: 1 / 1;
    max-width: min(var(--ui-radar-max-h), 100%);
}

.ui-radar__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ui-radar__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    /* Tinted scrim so the JS-painted radar still bleeds through and the
       operator sees that the canvas is alive but the device isn't
       reporting. */
    background: color-mix(in oklab, var(--va-bg) 70%, transparent);
    color: var(--va-text-muted);
    pointer-events: none;
}

.ui-radar__overlay svg {
    width: 2.4rem;
    height: 2.4rem;
    color: var(--va-accent);
    opacity: 0.4;
}

.ui-radar__overlay-text {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* === Ui/Selects/UiLocalePicker.razor.css === */
/* ═══════════════════════════════════════════════════════════════════
 * Offender avatar + name cell — SHARED across Offenders / Alarms grids.
 * Moved out of Offenders.razor.css (scoped) into the RCL component
 * stylesheet so both pages reuse the exact same markup + classes without
 * duplicating scoped CSS. The image/initials fallback is class-driven
 * (img onerror swaps `.is-hidden`), so no inline style= is needed.
 * ═══════════════════════════════════════════════════════════════════ */
.offender-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.offender-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid var(--va-border-light);
}
.offender-avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklab, var(--va-accent) 20%, var(--va-elevated));
    color: var(--va-accent);
    font-size: 0.8125rem;
    font-weight: 700;
}
/* Fallback toggling: hide initials by default; the <img> onerror reveals
   them and hides itself by swapping these utility classes. */
.offender-avatar--initials.is-hidden { display: none; }
.offender-avatar.is-hidden { display: none; }

/* ═══════════════════════════════════════════════════════════════════
 * UiEditModal form helpers (Offenders add/edit modal body).
 * Page-agnostic, lives with the modal CSS in the RCL stylesheet.
 * ═══════════════════════════════════════════════════════════════════ */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--va-sp-4);
    padding: var(--va-sp-4) 0;
}
.modal-form .form-row { display: flex; flex-direction: column; gap: 6px; }
.modal-form .form-label { font-size: 0.8125rem; font-weight: 500; color: var(--va-text-dim); }

/* Photo upload field inside the edit modal */
.photo-field {
    display: flex;
    align-items: center;
    gap: var(--va-sp-4);
}
.photo-field__preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid var(--va-border-light);
    background: var(--va-elevated);
}
.photo-field__preview--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--va-accent);
    background: color-mix(in oklab, var(--va-accent) 18%, var(--va-elevated));
}
.photo-field__controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.photo-field__hint {
    font-size: 0.75rem;
    color: var(--va-text-dim);
    margin: 0;
}
.photo-field__input {
    font-size: 0.8125rem;
    color: var(--va-text-dim);
}
.photo-field__input::file-selector-button {
    margin-inline-end: 10px;
    padding: 6px 12px;
    border-radius: var(--va-radius, 8px);
    border: 1px solid var(--va-border);
    background: var(--va-elevated);
    color: var(--va-text);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}
.photo-field__input::file-selector-button:hover {
    border-color: var(--va-accent);
    color: var(--va-accent);
}

/* Edit-pencil row action — sits beside the detail chevron in the grid */
.row-action-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
