/* Redesign 2026-10-15, second handover: report. Built from tokens.css; shared components live in ui.css. */

/* ── Report dialog (29, 30, 31-PrijavaSadrzaja) ─────────────────────────────
   A native <dialog>: a centred card on a desktop, a bottom sheet on a phone
   (BottomSheet: handle, 86 % height at most, the action row stays). The
   reasons are radio cards; the chosen one carries `.is-selected` (set by
   report_dialog_controller.js) as well as `:has(:checked)`, so the selected
   style never depends on one or the other alone. */
.rdialog {
    width: min(600px, calc(100vw - 2 * var(--space-4)));
    max-width: none;
    max-height: calc(100dvh - 110px - var(--space-6));
    /* Pinned under the header as in the design, not centred: a centred
       dialog jumps whenever an error line appears or goes. */
    margin: 110px auto auto;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 60px -20px rgba(11, 37, 64, .45);
    overflow: hidden;
}
.rdialog:focus { outline: none; }
.rdialog::backdrop { background: rgba(11, 37, 64, .5); }
.rdialog[open] { display: flex; }

.rdialog__panel {
    position: relative;
    display: flex; flex-direction: column;
    width: 100%; min-height: 0;
}
.rdialog__handle { display: none; }

.rdialog__close {
    position: absolute; top: var(--space-4); right: var(--space-4); z-index: 1;
    display: flex; align-items: center; justify-content: center;
    width: var(--touch-target); height: var(--touch-target);
    padding: 0; border: 0; border-radius: var(--radius-md);
    background: none; color: var(--ink-2); cursor: pointer;
}
.rdialog__close:hover { background: var(--ground); }

.rdialog__form, .rdialog__sent { display: flex; flex-direction: column; min-height: 0; }
.rdialog__form[hidden], .rdialog__sent[hidden] { display: none; }

.rdialog__head { padding: 26px 76px 0 26px; }
.rdialog__title { margin: 0; font: 800 22px/30px var(--font-sans); color: var(--ink); }
.rdialog__sub { margin: 2px 0 0; font: 500 15px/22px var(--font-sans); color: var(--muted); }

.rdialog__body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    padding: var(--space-4) 26px 0;
}

.rdialog__reasons { display: flex; flex-direction: column; gap: var(--space-2); margin: 0; padding: 0; border: 0; min-width: 0; }

.rreason {
    position: relative;
    display: flex; flex-direction: column; gap: 2px;
    min-height: var(--touch-target);
    padding: 11px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--duration-fast), background-color var(--duration-fast);
}
@media (hover: hover) { .rreason:hover { border-color: var(--ink-2); } }
.rreason__input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rreason__label { font: 700 15px/22px var(--font-sans); color: var(--ink); }
.rreason__hint { font: 500 13px/18px var(--font-sans); color: var(--muted); }
.rreason:has(.rreason__input:checked),
.rreason.is-selected { border-color: var(--blue-700) !important; background: var(--blue-100) !important; box-shadow: inset 0 0 0 1px var(--blue-700); }
.rreason:has(.rreason__input:focus-visible) { outline: 2px solid var(--blue-700); outline-offset: 2px; }

.rdialog__label { display: block; margin: var(--space-5) 0 var(--space-2); font: 800 13px/18px var(--font-sans); color: var(--ink); }
.rdialog__need { font-weight: 600; color: var(--muted); }
.rdialog__need.is-required { font-weight: 800; color: var(--ink); }

.rdialog__comment {
    display: block; width: 100%; min-height: 86px;
    padding: 12px 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    background: var(--surface); color: var(--ink);
    font: 500 15px/22px var(--font-sans);
    resize: vertical;
}
.rdialog__comment::placeholder { color: var(--muted); opacity: 1; }
.rdialog__comment:focus-visible { outline: 2px solid var(--blue-700); outline-offset: 2px; border-color: var(--blue-700); }
.rdialog__comment.is-invalid { border-color: var(--red-700) !important; }
.rdialog__comment.is-invalid:focus-visible { outline-color: var(--red-700); }

.rdialog__error { margin: var(--space-2) 0 0; font: 600 13px/18px var(--font-sans); color: var(--red-700); }
.rdialog__error[hidden] { display: none; }

.rdialog__note { margin: var(--space-5) 0 0; font: 500 13px/19px var(--font-sans); color: var(--muted); }

.rdialog__actions {
    display: flex; justify-content: flex-end; gap: var(--space-2);
    padding: var(--space-4) 26px 26px;
}
.rdialog__actions .btn { min-width: 0; }

.rdialog__sent {
    align-items: center; text-align: center;
    padding: 56px 26px 30px;
}
.rdialog__tickring { fill: var(--green-100); }
.rdialog__tickdot { fill: var(--green-600); }
.rdialog__tickmark { fill: none; stroke: var(--surface); }
.rdialog__senttitle { margin: var(--space-4) 0 0; font: 800 22px/30px var(--font-sans); color: var(--ink); }
.rdialog__sentbody { max-width: 440px; margin: var(--space-2) 0 var(--space-6); font: 500 15px/22px var(--font-sans); color: var(--ink-2); }

.rdialog :focus-visible { outline: 2px solid var(--blue-700); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
    .rdialog[open] { animation: rdialog-in var(--duration-base) var(--ease-out); }
    .rdialog[open]::backdrop { animation: rdialog-fade var(--duration-base) var(--ease-out); }
    .rdialog__sent:not([hidden]) .rdialog__tick { animation: rdialog-pop var(--duration-slow) var(--ease-spring); }
}
@keyframes rdialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes rdialog-fade { from { opacity: 0; } }
@keyframes rdialog-pop { from { transform: scale(.6); opacity: 0; } }

/* Phone: the same dialog as a bottom sheet. */
@media (max-width: 700px) {
    .rdialog {
        width: 100vw; max-height: 86dvh;
        margin: auto 0 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        box-shadow: var(--shadow-sheet);
    }
    .rdialog__handle {
        display: block; position: absolute; top: var(--space-2); left: 50%;
        width: 40px; height: 4px; margin-left: -20px;
        border-radius: var(--radius-pill); background: var(--border-strong);
    }
    .rdialog__close { top: var(--space-3); right: var(--space-2); }
    .rdialog__head { padding: 26px 60px 0 var(--space-4); }
    .rdialog__title { font-size: 20px; line-height: 28px; }
    .rdialog__body { padding: var(--space-4) var(--space-4) 0; }
    /* 16 px or iOS Safari zooms the page when the field gets focus. */
    .rdialog__comment { font-size: 16px; }
    .rdialog__actions {
        padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
        border-top: 1px solid var(--border);
    }
    .rdialog__actions .btn { flex: 1 1 0; }
    .rdialog__sent { padding: 48px var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom)); }
    .rdialog__sent .btn { width: 100%; }

    @media (prefers-reduced-motion: no-preference) {
        .rdialog[open] { animation: rdialog-up var(--duration-slow) var(--ease-out); }
    }
}
@keyframes rdialog-up { from { transform: translateY(100%); } }
