/*
 * Styles for public/js/bv-ui.js (toasts, the confirm dialog, busy buttons).
 * Plain CSS so it needs no Tailwind build; loaded on every staff page.
 * Dark mode uses the same OKLCH ladder as the shell (docs/design-system.md).
 */

/* ── Toasts ────────────────────────────────────────────────────────────── */
.bv-toasts {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 10000;
    display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
    width: max-content; max-width: calc(100vw - 32px);
    pointer-events: none;
}
/* Above the new shell's phone tab bar. */
@media (max-width: 767px) { body.bv-shell .bv-toasts { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); } }

.bv-toast {
    pointer-events: auto;
    display: flex; align-items: center; gap: 10px;
    min-height: 44px; max-width: 100%; box-sizing: border-box;
    padding: 6px 6px 6px 18px;
    /* Half the height: a pill on one line, a rounded card when it wraps.
       Its buttons (32px) sit 6px in, so their 16px radius is concentric. */
    border-radius: 22px;
    background: #1d1d1d; color: #ffffff;
    font: 500 14px/1.35 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .25);
    animation: bv-toast-in .22s cubic-bezier(0, 0, .2, 1);
}
.bv-toast-error { background: #b42318; }
.bv-toast-warning .bv-toast-text::before {
    content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 9px; vertical-align: 1px;
    border-radius: 50%; background: #f0b64b;
}
.bv-toast-success .bv-toast-text::before {
    content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 9px; vertical-align: 1px;
    border-radius: 50%; background: #3fce9f;
}
.bv-toast-text { min-width: 0; overflow-wrap: anywhere; white-space: pre-line; }
.bv-toast-act, .bv-toast-x {
    flex: none; height: 32px; border: 0; border-radius: 999px; cursor: pointer;
    background: rgba(255, 255, 255, .14); color: #ffffff;
    font: 700 13px/1 inherit; font-family: inherit;
}
.bv-toast-act { padding: 0 14px; }
.bv-toast-x { width: 32px; display: grid; place-items: center; background: transparent; color: rgba(255, 255, 255, .8); }
.bv-toast-act:hover, .bv-toast-x:hover { background: rgba(255, 255, 255, .22); color: #ffffff; }
.bv-toast-act:focus-visible, .bv-toast-x:focus-visible { outline: 2px solid #ffffff; outline-offset: 1px; }
.bv-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes bv-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

html[data-theme="dark"] .bv-toast:not(.bv-toast-error) {
    background: oklch(0.35 0.018 258);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(255, 255, 255, .09);
}

/* ── Confirm dialog ────────────────────────────────────────────────────── */
dialog.bv-dialog {
    border: 0; padding: 22px; margin: auto;
    width: min(420px, calc(100vw - 32px)); box-sizing: border-box;
    border-radius: 20px;
    background: #ffffff; color: #1d1d1d;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
    font: 400 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: bv-dialog-in .18s cubic-bezier(0, 0, .2, 1);
}
dialog.bv-dialog::backdrop { background: rgba(15, 23, 42, .38); }
.bv-dialog h2 { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 700; letter-spacing: -.01em; white-space: pre-line; }
.bv-dialog p { margin: 8px 0 0; color: #4b5563; white-space: pre-line; }
.bv-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.bv-btn {
    height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
    font: 600 14px/1 inherit; font-family: inherit; border: 1px solid transparent;
}
.bv-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(0, 129, 198, .45); }
.bv-btn-secondary { background: #ffffff; color: #1d1d1d; border-color: rgba(15, 23, 42, .2); }
.bv-btn-secondary:hover { background: #f2f4f5; }
.bv-btn-primary { background: #0081c6; color: #ffffff; }
.bv-btn-primary:hover { background: #0069a3; }
.bv-btn-danger { background: #b42318; color: #ffffff; }
.bv-btn-danger:hover { background: #912018; }
.bv-prompt-input {
    display: block; box-sizing: border-box; width: 100%; margin-top: 14px;
    border: 1px solid rgba(15, 23, 42, .2); border-radius: 12px; padding: 10px 14px;
    font: inherit; font-size: 15px; color: inherit; background: #ffffff;
}
input.bv-prompt-input { height: 44px; border-radius: 999px; padding: 0 16px; }
.bv-prompt-input:focus { outline: none; border-color: #0081c6; box-shadow: 0 0 0 3px rgba(0, 129, 198, .25); }
.bv-btn:disabled { opacity: .45; cursor: not-allowed; }
html[data-theme="dark"] .bv-prompt-input { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .18); color: #f3f4f6; }
@keyframes bv-dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }

html[data-theme="dark"] dialog.bv-dialog {
    background: oklch(0.31 0.018 258); color: #f3f4f6;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(255, 255, 255, .09);
}
html[data-theme="dark"] .bv-dialog p { color: #bac1cc; }
html[data-theme="dark"] .bv-btn-secondary { background: transparent; color: #f3f4f6; border-color: rgba(255, 255, 255, .18); }
html[data-theme="dark"] .bv-btn-secondary:hover { background: rgba(255, 255, 255, .07); }
html[data-theme="dark"] dialog.bv-dialog::backdrop { background: rgba(0, 0, 0, .55); }

/* ── Busy buttons (double-submit lock, bvFetch busy) ──────────────────── */
button[data-bv-busy] { cursor: progress; }
button[data-bv-busy]::before {
    content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
    border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
    animation: bv-spin .7s linear infinite;
}
@keyframes bv-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .bv-toast, dialog.bv-dialog { animation: none; }
    button[data-bv-busy]::before { animation-duration: 2s; }
}

/* ── Skip link (both shells) ──────────────────────────────────────────── */
.bv-skip {
    position: fixed; left: 12px; top: 12px; z-index: 10001;
    padding: 10px 16px; border-radius: 999px;
    background: #1d1d1d; color: #ffffff; font: 600 14px/1 Inter, system-ui, sans-serif; text-decoration: none;
    transform: translateY(-200%);
}
.bv-skip:focus { transform: none; outline: 2px solid #0081c6; outline-offset: 2px; }

/* ── Lists (public/js/bv-list.js) ─────────────────────────────────────── */
/* The keyboard row: a primary-tinted fill and a 3px marker on its edge. */
[data-bv-list] [data-row].is-focus > :first-child { box-shadow: inset 3px 0 0 #0081c6; }
[data-bv-list] [data-row].is-focus { background: rgb(0 129 198 / .07); }
[data-bv-list] [data-row].is-ticked:not(.is-focus) { background: rgb(15 23 42 / .035); }
html[data-theme="dark"] [data-bv-list] [data-row].is-focus { background: rgb(46 163 230 / .14); }
html[data-theme="dark"] [data-bv-list] [data-row].is-focus > :first-child { box-shadow: inset 3px 0 0 #2ea3e6; }
html[data-theme="dark"] [data-bv-list] [data-row].is-ticked:not(.is-focus) { background: rgb(255 255 255 / .04); }
/* Dark mode: the bulk bar and filter chips float above the list, so they
   take the ladder's raised step (not near-black, which vanished on the panel). */
html[data-theme="dark"] [data-bulk-bar] { background: oklch(0.36 0.02 258) !important; box-shadow: inset 0 1px 0 rgb(255 255 255 / .07); }
html[data-theme="dark"] [data-filter-chips] > li:has(> a[aria-label^="Remove filter"]) { background: oklch(0.36 0.02 258); }
