/* Viewer for the action trace (Alt + B). Kept independent of the rest of the layout so
   it stays readable even on pages whose styling is broken by the bug being reported. */

.action-trace-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000000;
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.action-trace-overlay.is-open {
    display: block;
}

.action-trace-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.action-trace-window {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    width: min(920px, 94vw);
    height: min(78vh, 900px);
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
    color: #1f2328;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.action-trace-header {
    position: relative;
    padding: 14px 48px 12px 18px;
    border-bottom: 1px solid #e3e5e8;
}

.action-trace-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.action-trace-environment {
    margin: 4px 0 0;
    font-size: 0.72rem;
    line-height: 1.35;
    opacity: 0.65;
    word-break: break-word;
}

.action-trace-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.action-trace-close:hover {
    background: rgba(0, 0, 0, 0.08);
}

.action-trace-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-bottom: 1px solid #e3e5e8;
}

.action-trace-search {
    flex: 1 1 180px;
    min-width: 140px;
    padding: 6px 10px;
    border: 1px solid #cfd3d8;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 0.8rem;
}

.action-trace-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
}

.action-trace-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #cfd3d8;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
}

.action-trace-button:hover {
    background: rgba(0, 0, 0, 0.06);
}

.action-trace-button--danger {
    color: #b41c2b;
    border-color: #e3b3b8;
}

.action-trace-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 18px 16px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.action-trace-group {
    position: sticky;
    top: 0;
    margin: 12px 0 4px;
    padding: 4px 0;
    background: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.55;
}

.action-trace-entry {
    display: flex;
    gap: 10px;
    padding: 3px 0 3px 10px;
    border-left: 3px solid transparent;
}

.action-trace-time {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    opacity: 0.5;
}

.action-trace-text {
    flex: 1;
    word-break: break-word;
}

.action-trace-entry--navigation {
    border-left-color: #388cfa;
    font-weight: 600;
}

.action-trace-entry--click,
.action-trace-entry--tab {
    border-left-color: #9aa0a6;
}

.action-trace-entry--field {
    border-left-color: #009f42;
}

.action-trace-entry--dialog {
    border-left-color: #6e2b65;
}

.action-trace-entry--success {
    border-left-color: #009f42;
}

.action-trace-entry--warning {
    border-left-color: #f0ad4e;
}

.action-trace-entry--error {
    border-left-color: #b41c2b;
    color: #b41c2b;
}

.action-trace-entry--tech {
    font-size: 0.75rem;
    opacity: 0.6;
}

.action-trace-empty {
    margin: 24px 0;
    text-align: center;
    opacity: 0.6;
}

.action-trace-footer {
    padding: 8px 18px;
    border-top: 1px solid #e3e5e8;
    font-size: 0.72rem;
    opacity: 0.6;
}

[data-theme='dark'] .action-trace-window {
    background: #22242a;
    color: #e6e7ea;
}

[data-theme='dark'] .action-trace-header,
[data-theme='dark'] .action-trace-toolbar,
[data-theme='dark'] .action-trace-footer {
    border-color: #3a3d44;
}

[data-theme='dark'] .action-trace-search,
[data-theme='dark'] .action-trace-button {
    border-color: #4a4d55;
}

[data-theme='dark'] .action-trace-button:hover,
[data-theme='dark'] .action-trace-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme='dark'] .action-trace-button--danger {
    color: #ef8a94;
    border-color: #6b3238;
}

[data-theme='dark'] .action-trace-entry--error {
    color: #ef8a94;
}
