/* Mouse Wheel Test styles */

.mouse-wheel-tool {
    --mwt-surface: var(--color-surface);
    --mwt-surface-muted: var(--color-surface-muted);
    --mwt-border: var(--color-border);
    --mwt-border-strong: var(--color-border-strong);
    --mwt-text: var(--color-text);
    --mwt-muted: var(--color-muted);
    --mwt-accent: var(--color-secondary-accent);
    --mwt-accent-strong: var(--color-link);
    --mwt-success: var(--color-success);
    --mwt-warning: var(--color-warning);
    --mwt-error: var(--color-error);
    --mwt-up: #5b8cff;
    --mwt-down: #d87955;
    --mwt-neutral: #8c97a8;
    color: var(--mwt-text);
}

.mouse-wheel-tool .tool-description {
    margin: 0 0 1.5rem;
    color: var(--mwt-muted);
}

.wheel-dashboard {
    display: grid;
    gap: 1.25rem;
    padding: clamp(1rem, 2vw, 1.75rem);
    background: var(--mwt-surface);
    border: 1px solid var(--mwt-border);
    border-radius: var(--tool-radius);
    box-shadow: var(--tool-shadow);
}

.wheel-status-row,
.wheel-card-header,
.wheel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.wheel-status-text,
.wheel-instructions,
.wheel-note {
    margin: 0;
    color: var(--mwt-muted);
}

.wheel-status-text {
    font-size: 1rem;
    font-weight: 700;
}

.wheel-status-badge,
.wheel-card-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--mwt-border);
    border-radius: 999px;
    background: var(--mwt-surface-muted);
    color: var(--mwt-text);
    font-size: 0.875rem;
    font-weight: 750;
    line-height: 1.1;
    white-space: nowrap;
}

.wheel-status-badge::before {
    width: 0.55rem;
    height: 0.55rem;
    margin-inline-end: 0.45rem;
    border-radius: 50%;
    background: var(--mwt-accent);
    content: "";
}

.wheel-status-badge.active::before {
    background: var(--mwt-success);
}

.wheel-status-badge.paused::before,
.wheel-status-badge.warning::before {
    background: var(--mwt-warning);
}

.wheel-status-badge.stopped::before {
    background: var(--mwt-muted);
}

.wheel-actions {
    justify-content: flex-start;
}

.wheel-actions .btn {
    min-width: 8.5rem;
}

.wheel-capture {
    position: relative;
    min-height: 20rem;
    overflow: hidden;
    border: 2px solid var(--mwt-border-strong);
    border-radius: calc(var(--tool-radius) - 0.1rem);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--mwt-accent) 5%, transparent), transparent 50%),
        var(--mwt-surface-muted);
    outline: none;
    overscroll-behavior: contain;
    isolation: isolate;
}

.wheel-capture:focus-visible,
.wheel-capture[data-capture-state="active"] {
    border-color: color-mix(in srgb, var(--mwt-accent) 75%, var(--mwt-border-strong));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mwt-accent) 20%, transparent);
}

.wheel-capture[data-capture-state="paused"] {
    border-style: dashed;
}

#wheel-canvas {
    display: block;
    width: 100%;
    height: 20rem;
}

.wheel-empty-state {
    position: absolute;
    inset: 50% auto auto 50%;
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    width: min(90%, 22rem);
    transform: translate(-50%, -50%);
    color: var(--mwt-muted);
    text-align: center;
    pointer-events: none;
}

.wheel-empty-icon {
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--mwt-border);
    border-radius: 50%;
    color: var(--mwt-accent-strong);
    font-size: 1.6rem;
    font-weight: 800;
}

.wheel-capture.has-events .wheel-empty-state {
    opacity: 0;
}

.wheel-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    gap: 0.75rem;
}

.wheel-metric,
.wheel-detail-card {
    min-width: 0;
    background: var(--mwt-surface-muted);
    border: 1px solid var(--mwt-border);
    border-radius: 0.9rem;
}

.wheel-metric {
    display: grid;
    gap: 0.35rem;
    padding: 0.85rem 1rem;
}

.wheel-metric--warning .wheel-metric-value {
    color: color-mix(in srgb, var(--mwt-warning) 78%, var(--mwt-text));
}

.wheel-metric-label {
    margin: 0;
    color: var(--mwt-muted);
    font-size: 0.85rem;
    font-weight: 650;
}

.wheel-metric-value {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--mwt-text);
    font-size: 1.15rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.wheel-diagnostics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.wheel-detail-card {
    display: grid;
    align-content: start;
    gap: 0.85rem;
    padding: 1rem;
}

.wheel-card-header {
    align-items: flex-start;
}

.wheel-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.wheel-card-pill {
    min-height: 1.75rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.wheel-card-pill.is-warning {
    border-color: color-mix(in srgb, var(--mwt-warning) 55%, var(--mwt-border));
    background: color-mix(in srgb, var(--mwt-warning) 12%, var(--mwt-surface-muted));
    color: var(--mwt-text);
}

.wheel-event-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    margin: 0;
}

.wheel-event-details div {
    min-width: 0;
}

.wheel-event-details dt {
    color: var(--mwt-muted);
    font-size: 0.82rem;
    font-weight: 650;
}

.wheel-event-details dd {
    margin: 0.2rem 0 0;
    overflow-wrap: anywhere;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.wheel-history-wrap {
    overflow-x: auto;
}

.wheel-history {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.wheel-history th,
.wheel-history td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid var(--mwt-border);
    text-align: start;
    white-space: nowrap;
}

.wheel-history th {
    color: var(--mwt-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.wheel-history td {
    font-variant-numeric: tabular-nums;
}

.wheel-history tbody tr:last-child td {
    border-bottom: 0;
}

.wheel-note {
    padding: 0.85rem 1rem;
    border-inline-start: 3px solid var(--mwt-warning);
    background: color-mix(in srgb, var(--mwt-warning) 8%, var(--mwt-surface));
    font-size: 0.92rem;
}

.wheel-note strong {
    color: var(--mwt-text);
}

@media (max-width: 760px) {
    .wheel-diagnostics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .wheel-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .wheel-actions .btn {
        width: 100%;
    }

    .wheel-capture,
    #wheel-canvas {
        min-height: 15rem;
        height: 15rem;
    }

    .wheel-event-details {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mouse-wheel-tool *,
    .mouse-wheel-tool *::before,
    .mouse-wheel-tool *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
