/*
 * Floating "Report a bug" button and its dialog — see assets/js/bug-report.js.
 *
 * Everything is namespaced .pmbr- and sets its own font, sizing and colours,
 * because this lands on every page — the dashboard (Bootstrap + app.css), the
 * marketing page and the bare /app/ page — and must look the same on all of them.
 */

.pmbr-root {
    --pmbr-blue: #3b7ddd;
    --pmbr-blue-dark: #2f64b1;
    --pmbr-ink: #1e293b;
    --pmbr-muted: #64748b;
    --pmbr-line: #dbe2ea;
    --pmbr-soft: #f5f7fb;
    --pmbr-danger: #dc3545;
    --pmbr-success: #1c8b63;
    --pmbr-size: 48px;
    --pmbr-gap: 16px;
    --pmbr-lift: 0px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    color: var(--pmbr-ink);
}

.pmbr-root *,
.pmbr-root *::before,
.pmbr-root *::after {
    box-sizing: border-box;
}

/* ── Floating button ──────────────────────────────────────────────────
   Below Bootstrap's modal backdrop (1050) on purpose: when a modal or a
   SweetAlert is open, its own buttons sit bottom-right and must never be
   covered by this one. */
.pmbr-fab {
    position: fixed;
    right: calc(var(--pmbr-gap) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--pmbr-gap) + env(safe-area-inset-bottom, 0px) + var(--pmbr-lift));
    z-index: 1045;
    width: var(--pmbr-size);
    height: var(--pmbr-size);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--pmbr-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(11, 21, 36, .22), 0 1px 3px rgba(11, 21, 36, .18);
    opacity: .88;
    /* Vertical drag is handled in JS; stop the browser scrolling the page
       underneath while a finger moves the button. */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity .15s ease, transform .15s ease, background-color .15s ease, bottom .2s ease;
}

.pmbr-fab:hover,
.pmbr-fab:focus-visible {
    opacity: 1;
    background: var(--pmbr-blue-dark);
    transform: scale(1.06);
}

.pmbr-fab:focus-visible {
    outline: 3px solid #fff;
    box-shadow: 0 0 0 6px var(--pmbr-blue), 0 6px 18px rgba(11, 21, 36, .22);
}

.pmbr-fab.pmbr-dragging {
    opacity: 1;
    transition: none;
    cursor: grabbing;
}

.pmbr-fab svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.pmbr-fab[hidden] {
    display: none;
}

@media (pointer: fine) {
    .pmbr-root { --pmbr-size: 44px; }
    .pmbr-fab svg { width: 22px; height: 22px; }
}

@media (max-width: 575.98px) {
    .pmbr-root { --pmbr-gap: 12px; }
}

/* ── Dialog ────────────────────────────────────────────────────────────
   Above everything else on the page, the cookie-consent banner included
   (2147483000): the banner sits along the bottom edge, exactly where this
   dialog's Send button is — and on a phone, where the dialog is a bottom
   sheet, it would hide the whole footer. The dialog is modal and opened on
   purpose, so covering the banner while it is open is correct; the banner
   is back, untouched, the moment it closes. */
.pmbr-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483200;
    background: rgba(11, 21, 36, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: pmbr-fade .18s ease both;
}

.pmbr-overlay[hidden] {
    display: none;
}

.pmbr-dialog {
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(11, 21, 36, .3);
    overflow: hidden;
    animation: pmbr-rise .22s ease both;
}

.pmbr-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--pmbr-line);
}

.pmbr-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--pmbr-ink);
    line-height: 1.3;
}

.pmbr-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--pmbr-muted);
}

.pmbr-close {
    margin: -4px -6px 0 auto;
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pmbr-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.pmbr-close:hover,
.pmbr-close:focus-visible {
    background: var(--pmbr-soft);
    color: var(--pmbr-ink);
}

/* The form and success views each fill the space under the header, and only
   their body scrolls — so the Send / Close buttons stay pinned in view however
   short the screen is. min-height: 0 is what lets a flex child shrink below its
   content height; without it the footer is pushed out of the dialog and clipped. */
.pmbr-view-form,
.pmbr-view-success {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pmbr-view-form[hidden],
.pmbr-view-success[hidden] {
    display: none;
}

.pmbr-head,
.pmbr-foot {
    flex: none;
}

.pmbr-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pmbr-field {
    margin: 0 0 14px;
}

.pmbr-label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--pmbr-ink);
}

.pmbr-optional {
    font-weight: 400;
    color: var(--pmbr-muted);
}

.pmbr-input,
.pmbr-select,
.pmbr-textarea {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--pmbr-line);
    border-radius: 8px;
    background: #fff;
    color: var(--pmbr-ink);
    font: inherit;
    /* 16px stops iOS Safari zooming the page when the field is focused. */
    font-size: 16px;
    line-height: 1.4;
}

.pmbr-textarea {
    min-height: 120px;
    resize: vertical;
}

.pmbr-input:focus,
.pmbr-select:focus,
.pmbr-textarea:focus {
    outline: none;
    border-color: var(--pmbr-blue);
    box-shadow: 0 0 0 3px rgba(59, 125, 221, .2);
}

.pmbr-hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--pmbr-muted);
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.pmbr-shot-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pmbr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    margin: 0;
    padding: 8px 14px;
    border: 1px solid var(--pmbr-line);
    border-radius: 8px;
    background: #fff;
    color: var(--pmbr-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.pmbr-btn:hover,
.pmbr-btn:focus-visible {
    background: var(--pmbr-soft);
}

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

.pmbr-btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
}

.pmbr-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.pmbr-btn-primary {
    background: var(--pmbr-blue);
    border-color: var(--pmbr-blue);
    color: #fff;
}

.pmbr-btn-primary:hover,
.pmbr-btn-primary:focus-visible {
    background: var(--pmbr-blue-dark);
    border-color: var(--pmbr-blue-dark);
}

.pmbr-shots {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.pmbr-shots:empty {
    display: none;
}

.pmbr-shot {
    position: relative;
    margin: 0;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--pmbr-line);
    border-radius: 8px;
    overflow: hidden;
    background: var(--pmbr-soft);
}

.pmbr-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pmbr-shot-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(11, 21, 36, .72);
    color: #fff;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
}

.pmbr-shot-remove:focus-visible {
    outline: 2px solid #fff;
    box-shadow: 0 0 0 4px var(--pmbr-blue);
}

.pmbr-note {
    margin: 0;
    font-size: 12px;
    color: var(--pmbr-muted);
}

.pmbr-status {
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}

.pmbr-status:empty {
    display: none;
}

.pmbr-status.is-error {
    background: #fdecee;
    color: #8a1c27;
}

.pmbr-status.is-info {
    background: #eaf2fc;
    color: #1f4f96;
}

.pmbr-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--pmbr-line);
    background: #fff;
}

.pmbr-success {
    padding: 28px 20px 8px;
    text-align: center;
}

.pmbr-success-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #e3f5ee;
    color: var(--pmbr-success);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pmbr-success-icon svg {
    width: 28px;
    height: 28px;
}

.pmbr-ref {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--pmbr-soft);
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
}

.pmbr-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pmbr-spin .8s linear infinite;
}

.pmbr-btn:not(.pmbr-btn-primary) .pmbr-spinner {
    border-color: rgba(59, 125, 221, .25);
    border-top-color: var(--pmbr-blue);
}

/* Honeypot: present for bots, unreachable for people and assistive tech. */
.pmbr-hp {
    position: absolute !important;
    left: -10000px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.pmbr-sr {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

html.pmbr-open,
html.pmbr-open body {
    overflow: hidden !important;
}

@media (max-width: 575.98px) {
    .pmbr-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .pmbr-dialog {
        max-width: none;
        max-height: 92vh;
        max-height: 92dvh;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .pmbr-foot .pmbr-btn {
        flex: 1;
    }
}

@keyframes pmbr-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pmbr-rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

@keyframes pmbr-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .pmbr-overlay,
    .pmbr-dialog,
    .pmbr-fab {
        animation: none;
        transition: none;
    }
}

@media print {
    .pmbr-root {
        display: none !important;
    }
}
