/**
 * Alerts — bulk-action toolbar and its confirmation dialog.
 *
 * Lifted out of ``alerts/_alerts_page_content_generic.html`` where it lived as
 * a 219-line inline ``<style>`` block. The block carried its own TODO —
 * "Promote into a real stylesheet once we wire the backend in the next pass" —
 * and three things made it worth acting on:
 *
 * * That template is HTMX-swapped, so the whole block re-shipped on every
 *   fragment update of the alerts list rather than being fetched once.
 * * A ``<style>`` block is not a stylesheet to the tooling: biome does not
 *   format it, and the design-drift scan can only see it as template text.
 * * ``.alert-bulk-toolbar`` and friends are also driven by
 *   ``static/js/alert-bulk-actions.js``, so the rules had one foot in a
 *   template and the other in a script.
 *
 * Linked last in ``base.html`` deliberately. The block sat in ``<body>``, after
 * every head stylesheet, so it won any specificity tie; loading last preserves
 * that ordering.
 */

.alert-bulk-toolbar {
    display: none;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.875rem;
    /* Dark slate bar (matches the app sidebar) so it stands out
       clearly against the light page — the earlier white bar was
       too subtle. Flat: solid fill, no shadow (design-system rule);
       the colour contrast alone reads it as a distinct surface. */
    background: var(--bg-sidebar);
    border: 1px solid var(--fg-1);
    border-radius: 10px;
    /* Floating bottom action bar (Gmail/Drive style). Was a
       top-sticky opaque bar, which — once given a solid fill —
       covered the Severity filter row directly below it on select.
       Anchoring to the viewport bottom keeps it visible while
       scrolling the list yet never overlaps the top filters
       (Severity / search / KPIs). Fixed + viewport-centred so it's
       decoupled from the collapsible sidebar width. */
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100vw - 2rem);
    z-index: 30;
}
.alert-bulk-toolbar[data-active="true"] {
    display: flex;
}
.alert-bulk-toolbar-count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--coverage-strong-fg);
    flex-shrink: 0;
    padding: 0.125rem 0.625rem;
    background: var(--coverage-strong-bg);
    border-radius: 9999px;
}
.alert-bulk-toolbar-comment {
    flex: 1;
    min-width: 14rem;
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border-medium);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    background: var(--bg-card);
    resize: none;
    line-height: 1.4;
}
.alert-bulk-toolbar-comment:focus {
    outline: none;
    border-color: var(--color-brand-green);
    box-shadow: 0 0 0 2px rgba(37, 175, 136, 0.15);
}
.alert-bulk-toolbar-btn {
    flex-shrink: 0;
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.alert-bulk-toolbar-btn-ack {
    background: var(--sev-medium-bg);
    border: 1px solid var(--sev-medium-border);
    color: var(--status-warning-fg);
}
.alert-bulk-toolbar-btn-ack:hover {
    background: var(--warning-softer-bg);
}
.alert-bulk-toolbar-btn-fp {
    background: var(--status-neutral-bg);
    border: 1px solid var(--border-medium);
    color: var(--fg-body-strong);
}
.alert-bulk-toolbar-btn-fp:hover {
    background: var(--border-base);
}
.alert-bulk-toolbar-btn-resolve {
    background: var(--coverage-strong-bg);
    border: 1px solid var(--policy-stricter-bg);
    color: var(--coverage-strong-fg);
}
.alert-bulk-toolbar-btn-resolve:hover {
    background: var(--policy-stricter-bg);
}
.alert-bulk-toolbar-clear {
    flex-shrink: 0;
    padding: 0.25rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--border-medium);
    font-size: var(--fs-sm);
    cursor: pointer;
    margin-left: auto;
}
.alert-bulk-toolbar-clear:hover {
    color: var(--fg-on-dark);
    text-decoration: underline;
}

/* Bulk-action confirmation modal */
.alert-bulk-confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    align-items: center;
    justify-content: center;
}
.alert-bulk-confirm-modal[data-open="true"] {
    display: flex;
}
.alert-bulk-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
}
.alert-bulk-confirm-card {
    position: relative;
    background: var(--bg-card);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-width: 32rem;
    width: calc(100% - 2rem);
    padding: 1.25rem 1.5rem 1.25rem;
}
.alert-bulk-confirm-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--fg-1);
    margin: -1.25rem -1.5rem 0.5rem -1.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 0.5rem 0.5rem 0 0;
    transition:
        background-color 200ms ease,
        color 200ms ease;
}
/* Flash states painted by alert-bulk-actions.js after the PATCH /alerts
   response — mirrors the modal-header-bar treatment in base.html so the
   single-alert and bulk flows feel like the same UX language. */
.alert-bulk-confirm-card[data-flash="success"] .alert-bulk-confirm-title {
    background-color: var(--color-brand-green-hover);
    color: var(--fg-on-dark);
}
.alert-bulk-confirm-card[data-flash="error"] .alert-bulk-confirm-title {
    background-color: var(--danger-fg);
    color: var(--fg-on-dark);
}
.alert-bulk-confirm-summary {
    font-size: var(--fs-base);
    color: var(--fg-body-strong);
    line-height: 1.5;
    margin: 0 0 0.75rem;
}
.alert-bulk-confirm-summary strong {
    color: var(--fg-1);
}
.alert-bulk-confirm-devices {
    font-size: 0.8125rem;
    color: var(--fg-3);
    margin-bottom: 0.75rem;
    background: var(--bg-page);
    border: 1px solid var(--border-base);
    border-radius: 0.375rem;
}
.alert-bulk-confirm-devices-empty {
    padding: 0.5rem 0.75rem;
    color: var(--fg-5);
    font-style: italic;
}
.alert-bulk-confirm-devices-head {
    padding: 0.5rem 0.75rem 0.375rem;
    border-bottom: 1px solid var(--border-base);
    color: var(--fg-body-strong);
    font-size: var(--fs-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.alert-bulk-confirm-device-list {
    /* ~10 rows visible (each row ~1.875rem incl padding); the rest
       scroll into view. The scroll-hint below the list calls out
       how many are off-screen so the operator knows to scroll. */
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    max-height: 18.75rem;
    overflow-y: auto;
}
.alert-bulk-confirm-device-item {
    padding: 0.3125rem 0.875rem;
    color: var(--fg-heading);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--status-neutral-bg);
}
.alert-bulk-confirm-device-item:last-child {
    border-bottom: none;
}
.alert-bulk-confirm-scroll-hint {
    padding: 0.4375rem 0.75rem;
    border-top: 1px solid var(--border-base);
    background: var(--banner-warning-bg);
    color: var(--pill-warning-fg);
    font-size: var(--fs-sm);
    font-weight: 500;
    text-align: center;
}
.alert-bulk-confirm-comment {
    font-size: 0.8125rem;
    color: var(--fg-3);
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    background: var(--banner-warning-bg);
    border-left: 3px solid var(--warning-mid);
    border-radius: 0.25rem;
}
.alert-bulk-confirm-comment-empty {
    background: var(--status-neutral-bg);
    border-left-color: var(--border-medium);
    color: var(--fg-4);
    font-style: italic;
}
.alert-bulk-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.alert-bulk-confirm-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: var(--fs-base);
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.15s ease;
}
.alert-bulk-confirm-btn-cancel {
    background: var(--bg-card);
    border-color: var(--border-medium);
    color: var(--fg-body-strong);
}
.alert-bulk-confirm-btn-cancel:hover {
    background: var(--status-neutral-bg);
}
.alert-bulk-confirm-btn-go {
    background: var(--color-brand-green-hover);
    color: var(--fg-on-dark);
}
.alert-bulk-confirm-btn-go:hover {
    background: var(--color-brand-green-deep);
}
