/* bug-report.css — "Report a problem" form: a guest help button + popover, and
   a modal dialog in the admin, opened from an icon in the sidebar footer.
   Token-driven, CSP-safe. */

.bug-report [x-cloak] { display: none !important; }

/* Guest: a small round "?" in the top-right corner, clear of the bottom nav,
   the chat button and the issue FAB. */
.bug-report--guest { position: fixed; top: var(--space-3, 12px); right: var(--space-3, 12px); z-index: 1100; }
.bug-report__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--touch-target, 44px);
    height: var(--touch-target, 44px);
    border: 1px solid var(--border, #e2e2e6);
    border-radius: var(--radius-pill, 999px);
    background: var(--bg-card, #fff);
    color: var(--text, #1a1a2e);
    opacity: 0.9;
    cursor: pointer;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.2));
}
.bug-report__btn:hover { opacity: 1; }
.bug-report__btn:focus-visible { outline: var(--focus-ring, 2px solid #4c9ffe); outline-offset: 2px; }
.bug-report__icon { width: 22px; height: 22px; display: block; }

.bug-report--guest .bug-report__panel {
    position: absolute;
    top: calc(var(--touch-target, 44px) + var(--space-2, 8px));
    right: 0;
    width: min(400px, calc(100vw - var(--space-3, 12px) * 2));
    max-height: calc(100vh - var(--touch-target, 44px) - var(--space-6, 32px));
    overflow-y: auto;
    padding: var(--space-5, 24px);
    background: var(--bg-card, #fff);
    color: var(--text, #1a1a2e);
    border: 1px solid var(--border, #e2e2e6);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-lg, 0 20px 45px rgba(0, 0, 0, 0.3));
}

/* Admin: a centred modal over a dimmed page. */
.bug-report__backdrop { position: fixed; inset: 0; z-index: 1100; background: rgba(0, 0, 0, 0.5); }
.bug-report--dialog .bug-report__panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1101;
    width: min(560px, calc(100vw - var(--space-3, 12px) * 2));
    max-height: calc(100vh - var(--space-6, 32px));
    overflow-y: auto;
    padding: var(--space-5, 24px);
    background: var(--bg-card, #fff);
    color: var(--text, #1a1a2e);
    border: 1px solid var(--border, #e2e2e6);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-lg, 0 20px 45px rgba(0, 0, 0, 0.3));
}
.bug-report__capture { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2, 8px); }
.bug-report__preview {
    display: block; max-width: 100%; max-height: 220px; object-fit: contain;
    border: 1px solid var(--border, #e2e2e6); border-radius: var(--radius-md, 8px);
}

/* Sidebar footer icon that opens the dialog (bottom left). */
.bug-report__trigger {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: var(--touch-target, 44px); min-height: var(--touch-target, 44px);
    margin-top: var(--space-2, 8px); margin-left: calc(var(--space-2, 8px) * -1);
    background: none; border: none; border-radius: var(--radius-md, 8px);
    color: inherit; opacity: 0.75; cursor: pointer;
}
.bug-report__trigger:hover { opacity: 1; }
.bug-report__trigger:focus-visible { outline: var(--focus-ring, 2px solid #4c9ffe); outline-offset: 2px; }
.bug-report__trigger[aria-busy="true"] { opacity: 0.4; cursor: progress; }

.bug-report__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3, 12px); margin-bottom: var(--space-4, 16px); }
.bug-report__title { font-size: var(--fs-lg, 1.125rem); font-weight: 700; line-height: 1.2; margin: 0; }
.bug-report__subtitle { font-size: var(--fs-sm, 0.875rem); color: var(--text-muted, #6b6b76); margin: var(--space-1, 4px) 0 0; }
.bug-report__close {
    border: none; background: transparent; color: var(--text-muted, #6b6b76);
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    min-width: var(--touch-target, 44px); min-height: var(--touch-target, 44px);
}
.bug-report__close:focus-visible { outline: var(--focus-ring, 2px solid #4c9ffe); }

.bug-report__field { margin-bottom: var(--space-4, 16px); }
.bug-report__label { display: block; font-size: var(--fs-sm, 0.875rem); font-weight: 600; margin-bottom: var(--space-2, 8px); }
.bug-report__input {
    width: 100%; padding: var(--space-2, 8px) var(--space-3, 12px);
    border: 1px solid var(--border, #e2e2e6); border-radius: var(--radius-md, 8px);
    background: var(--bg-surface, #f6f6f8); color: var(--text, #1a1a2e);
    font: inherit; resize: vertical;
}
.bug-report__input:focus-visible { outline: var(--focus-ring, 2px solid #4c9ffe); outline-offset: 1px; }
.bug-report__file { display: inline-flex; align-items: center; gap: var(--space-2, 8px); min-height: var(--touch-target, 44px); cursor: pointer; font-size: var(--fs-sm, 0.875rem); }
.bug-report__hint { font-size: var(--fs-sm, 0.875rem); color: var(--text-muted, #6b6b76); margin: 0 0 var(--space-4, 16px); }
.bug-report__hint--error, .bug-report__error { color: var(--state-error-fg, #c0392b); }
.bug-report__error {
    margin: 0 0 var(--space-3, 12px); padding: var(--space-2, 8px) var(--space-3, 12px);
    border-radius: var(--radius-md, 8px); background: var(--state-error-bg, #fdecea); font-size: var(--fs-sm, 0.875rem);
}
/* Off-screen rather than display:none, which some bots skip. */
.bug-report__trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.bug-report__done h3 { margin: 0 0 var(--space-2, 8px); }
.bug-report__done p { margin: 0 0 var(--space-4, 16px); }
