/* Activity Search — a centered modal (admin-only), opened via BridgeAudit.open()
 * from the lower-left #audit-fab button. Uses recordings.html's CSS custom
 * properties (--bg-card, --text-primary, --accent-blue, …) so it tracks the
 * page's light/dark theme. */

#audit-fab {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 900;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease, box-shadow 0.15s ease, bottom 0.15s ease;
}

#audit-fab[hidden] { display: none; }
#audit-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38); }
#audit-fab svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
#audit-fab.above-footer { bottom: var(--fab-lift, 80px); }

/* Full-viewport dimmed backdrop that centers the panel. */
.aud-backdrop {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    animation: aud-fade 0.12s ease-out;
}

.aud-panel {
    z-index: 951;
    width: min(880px, 100%);
    max-height: min(84vh, 900px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    animation: aud-rise 0.14s ease-out;
}

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

@keyframes aud-rise {
    from { opacity: 0; transform: translateY(12px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.aud-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.aud-title { font-weight: 600; font-size: 17px; flex: 1; color: var(--text-primary); }
.aud-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.aud-close:hover { color: var(--text-primary); }

.aud-controls {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aud-search {
    display: flex;
    gap: 8px;
}
.aud-search input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}
.aud-search input::placeholder { color: var(--text-muted); }
.aud-search input:focus {
    outline: none;
    border-color: var(--accent-blue);
}
.aud-search button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: var(--accent-blue);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.aud-search button.busy { opacity: 0.75; }  /* in-flight hint; stays clickable */

.aud-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.aud-chip {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.aud-chip:hover { border-color: var(--accent-blue); color: var(--text-primary); }
.aud-chip.active {
    background: var(--accent-blue);
    color: #fff;
    border-color: transparent;
}

.aud-meta {
    padding: 10px 22px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
    flex-shrink: 0;
}
.aud-meta[hidden] { display: none; }

.aud-results {
    overflow-y: auto;
    flex: 1;
    padding: 6px 0;
}

.aud-hit {
    padding: 12px 22px;
    border-bottom: 1px solid var(--border);
}
.aud-hit:last-child { border-bottom: none; }

.aud-hit-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    flex-wrap: wrap;
}
.aud-badge {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--bg-card-hover);
    color: var(--accent-blue);
}
.aud-badge.blocked { background: rgba(220, 60, 60, 0.18); color: #ff6b6b; }
.aud-badge.redacted { background: rgba(200, 140, 0, 0.2); color: #e0a032; }

.aud-hit-line {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
}
.aud-hit-link {
    font-size: 12px;
    color: var(--accent-blue);
    text-decoration: none;
    margin-left: auto;
    white-space: nowrap;
}
.aud-hit-link:hover { text-decoration: underline; }

.aud-empty, .aud-error {
    padding: 32px 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}
.aud-error { color: #ff6b6b; }

.aud-more {
    display: block;
    width: calc(100% - 44px);
    margin: 10px 22px 6px;
    padding: 9px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
}
.aud-more:hover { border-style: solid; border-color: var(--accent-blue); }
