/* ==========================================================================
   Unfallbericht — Backend (Liste, Detail, QR-Widget, Freigabelinks).
   ========================================================================== */

.severity-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--fs-12);
    font-weight: var(--fw-semibold);
    color: #fff;
}

/* ── QR-Widget (Standort-Tab) ─────────────────────────────────────────── */
.accident-qr-empty {
    padding: var(--space-4);
    text-align: center;
    color: var(--text-muted);
}

.accident-qr-box {
    display: flex;
    gap: var(--space-5);
    align-items: flex-start;
    flex-wrap: wrap;
}

.accident-qr-image {
    width: 200px;
    height: 200px;
    padding: var(--space-3);
    background: #fff;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
}

.accident-qr-image svg { width: 100%; height: 100%; }

.accident-qr-meta { flex: 1; min-width: 240px; }

.accident-qr-actions {
    display: flex;
    gap: var(--space-2);
}

/* ── QR mit Standortauswahl (Dashboard, Liste) ───────────────────────── */
.aqr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 200px;
    gap: var(--space-5);
    align-items: start;
}
.aqr-controls .form-group:last-of-type { margin-bottom: var(--space-3); }

.aqr-code {
    padding: var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: #fff;   /* QR braucht hellen Grund, auch im Dark Mode */
}
.aqr-code:has(.aqr-missing),
.aqr-code:has(.text-danger) {
    background: transparent;
}
.aqr-svg svg {
    display: block;
    width: 100%;
    height: auto;
}
.aqr-missing { padding: var(--space-4) 0; }
.aqr-missing p { font-size: var(--fs-13); }

.aqr-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2);
}
.aqr-buttons .btn { justify-content: center; }

@media (max-width: 640px) {
    /* Reihenfolge: Standort wählen → QR-Code → Link → Aktionen */
    .aqr { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
    .aqr-controls { display: contents; }
    .aqr-controls .form-group { margin-bottom: 0; }
    .aqr-controls .form-group:first-child { order: 1; }
    .aqr-code {
        order: 2;
        justify-self: center;
        width: min(240px, 100%);
    }
    .aqr-controls .form-group:nth-child(2) { order: 3; }
    .aqr-buttons { order: 4; }
    .aqr-buttons .btn {
        flex-direction: column;
        gap: 2px;
        min-height: 56px;
        font-size: var(--fs-12);
    }
}

/* Drucken: nur den QR-Block, Rest der Seite ausblenden */
@media print {
    body.aqr-print-mode * { visibility: hidden; }
    body.aqr-print-mode .aqr-printing,
    body.aqr-print-mode .aqr-printing * { visibility: visible; }
    body.aqr-print-mode .aqr-printing {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }
    body.aqr-print-mode .aqr-printing .aqr-buttons { display: none; }
}

/* ── Detailansicht ────────────────────────────────────────────────────── */
.ar-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3);
}

.ar-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.ar-field-label {
    font-size: var(--fs-11);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.ar-field-value {
    font-size: var(--fs-15);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    white-space: pre-line;
    line-height: 1.4;
}

.ar-field-wide { grid-column: 1 / -1; }

.ar-file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.ar-file-card {
    position: relative;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface-raised);
}

.ar-file-card > a {
    display: block;
    color: inherit;
    text-decoration: none;
}

.ar-file-delete {
    position: absolute;
    top: var(--space-1);
    right: var(--space-1);
    z-index: 1;
    width: 22px;
    height: 22px;
    line-height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
}

.ar-file-delete:hover { background: var(--danger); }

.ar-file-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.ar-file-card .ar-file-video {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-sunken);
    color: var(--text-muted);
    font-size: var(--fs-12);
    text-transform: uppercase;
}

.ar-file-name {
    padding: var(--space-2);
    font-size: var(--fs-12);
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ar-share-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--space-3);
}

.ar-share-row.is-expired { opacity: 0.65; }

.ar-share-head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ar-share-expiry {
    font-size: var(--fs-13);
    color: var(--text-muted);
}

.ar-share-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.ar-share-url {
    flex: 1 1 260px;
    min-width: 200px;
    font-family: var(--font-mono);
    font-size: var(--fs-13);
}

.ar-share-duration {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px dashed var(--border-default);
}

.ar-share-duration label {
    font-size: var(--fs-12);
    color: var(--text-muted);
}

.ar-share-duration .ar-share-hours {
    width: 90px;
}

.ar-share-duration .ar-share-password {
    width: 160px;
    font-family: var(--font-mono);
}

.ar-share-create {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ar-share-create input {
    width: 180px;
    font-family: var(--font-mono);
}

.ar-comment-row {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    margin-bottom: var(--space-3);
}

.ar-comment-head {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2);
    font-size: var(--fs-12);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.ar-comment-author { font-weight: 600; }

.ar-comment-body {
    font-size: var(--fs-14);
    white-space: pre-wrap;
}

.ar-comment-form {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.ar-comment-form textarea {
    flex: 1;
}

@media (max-width: 640px) {
    .ar-comment-form {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header:has(.ar-share-create) { align-items: stretch; }
    .ar-share-create {
        flex-wrap: wrap;
        width: 100%;
    }
    .ar-share-create input { flex: 1 1 100%; width: auto; }
    .ar-share-create .btn { flex: 1 1 auto; }

    .ar-share-row { padding: var(--space-3) var(--space-4); }
    .ar-share-url { min-width: 0; flex-basis: 100%; }
    .ar-share-duration .ar-share-hours,
    .ar-share-duration .ar-share-password { flex: 1 1 auto; width: auto; min-width: 0; }
}
