/* Agent tutorial highlight layer — docs/TZ_SELF_DESCRIBING_HANDLES_2026-04-19.md
   --------------------------------------------------------------------------
   Used by modules/step-by-step/AgentTutorialLayer.js. Puts a pulsing ring
   around a UI element identified by [data-agent-handle="<id>"] and shows
   an inline tooltip with the agent's explanation text. Pointer events on
   the highlighted element pass through normally — user can still click
   the real button while the tour is active.

   Never interferes with existing tooltip / TooltipService CSS.
*/

.agent-tutorial-highlight {
    position: relative;
    z-index: 9000;
    outline: none !important;
    box-shadow:
        0 0 0 3px rgba(99, 102, 241, 0.9),
        0 0 0 6px rgba(99, 102, 241, 0.35),
        0 0 18px rgba(99, 102, 241, 0.5);
    border-radius: 6px;
    animation: agent-tutorial-pulse 1.4s ease-in-out infinite;
}

@keyframes agent-tutorial-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 3px rgba(99, 102, 241, 0.9),
            0 0 0 6px rgba(99, 102, 241, 0.35),
            0 0 18px rgba(99, 102, 241, 0.5);
    }
    50% {
        box-shadow:
            0 0 0 4px rgba(99, 102, 241, 1),
            0 0 0 10px rgba(99, 102, 241, 0.2),
            0 0 26px rgba(99, 102, 241, 0.7);
    }
}

.agent-tutorial-tooltip {
    position: fixed;
    z-index: 9001;
    max-width: 360px;
    padding: 12px 14px 10px;
    background: #1f2a44;
    color: #f3f4f6;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-size: 13px;
    line-height: 1.45;
    pointer-events: auto;
    transition: opacity 140ms ease;
}

.agent-tutorial-tooltip__header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 12px;
    color: #c7d2fe;
    margin-bottom: 6px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.agent-tutorial-tooltip__body {
    white-space: pre-wrap;
    word-break: break-word;
}

.agent-tutorial-tooltip__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 10px;
    color: #94a3b8;
    font-size: 11px;
}

.agent-tutorial-tooltip__close {
    background: transparent;
    border: none;
    color: #c7d2fe;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.agent-tutorial-tooltip__close:hover {
    background: rgba(199, 210, 254, 0.1);
}

.agent-tutorial-tooltip__progress {
    font-variant-numeric: tabular-nums;
}

.agent-tutorial-tooltip--fade-out {
    opacity: 0;
}

/* Respect reduced-motion preference — still highlight, no pulse. */
@media (prefers-reduced-motion: reduce) {
    .agent-tutorial-highlight {
        animation: none;
    }
}

/* Light theme adjustments — uses CSS variable if available, otherwise
   the dark default above is fine for most skins. */
[data-theme='light'] .agent-tutorial-tooltip {
    background: #ffffff;
    color: #1f2a44;
    border-color: rgba(79, 70, 229, 0.5);
    box-shadow: 0 10px 30px rgba(31, 42, 68, 0.2);
}

[data-theme='light'] .agent-tutorial-tooltip__header {
    color: #4f46e5;
}

[data-theme='light'] .agent-tutorial-tooltip__footer {
    color: #64748b;
}

/* ============================================================
   Execute mode — TZ_AGENT_UI_EXECUTE_MODE_2026-04-28
   Permission-gated scenario runner: confirm modal + progress toast.
   ============================================================ */

.agent-tutorial-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9100;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.agent-tutorial-confirm {
    max-width: 480px;
    width: 100%;
    background: #1f2a44;
    color: #f3f4f6;
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    padding: 20px 22px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.agent-tutorial-confirm__title {
    font-weight: 600;
    font-size: 15px;
    color: #c7d2fe;
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}

.agent-tutorial-confirm__steps {
    margin: 0 0 16px;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-tutorial-confirm__steps li {
    color: #e2e8f0;
}

.agent-tutorial-confirm__steps li.is-destructive {
    color: #fca5a5;
    font-weight: 600;
}

.agent-tutorial-confirm__buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.agent-tutorial-confirm__btn {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition:
        background-color 120ms ease,
        border-color 120ms ease;
}

.agent-tutorial-confirm__btn--cancel {
    background: transparent;
    color: #cbd5e1;
    border-color: rgba(203, 213, 225, 0.25);
}

.agent-tutorial-confirm__btn--cancel:hover {
    background: rgba(203, 213, 225, 0.08);
}

.agent-tutorial-confirm__btn--ok {
    background: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}

.agent-tutorial-confirm__btn--ok:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

.agent-tutorial-confirm__btn--ok:focus,
.agent-tutorial-confirm__btn--cancel:focus {
    outline: 2px solid rgba(99, 102, 241, 0.55);
    outline-offset: 2px;
}

[data-theme='light'] .agent-tutorial-confirm-overlay {
    background: rgba(15, 23, 42, 0.35);
}

[data-theme='light'] .agent-tutorial-confirm {
    background: #ffffff;
    color: #1f2a44;
    border-color: rgba(79, 70, 229, 0.4);
}

[data-theme='light'] .agent-tutorial-confirm__title {
    color: #4f46e5;
}

[data-theme='light'] .agent-tutorial-confirm__steps li {
    color: #1f2a44;
}

[data-theme='light'] .agent-tutorial-confirm__steps li.is-destructive {
    color: #b91c1c;
}

/* Bottom-right progress toast shown while a scenario is executing. */
.agent-tutorial-progress {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9050;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1f2a44;
    color: #f3f4f6;
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    max-width: 360px;
    cursor: default;
}

.agent-tutorial-progress__counter {
    font-weight: 600;
    color: #c7d2fe;
    flex-shrink: 0;
}

.agent-tutorial-progress__text {
    color: #e2e8f0;
}

.agent-tutorial-progress--ok {
    border-color: rgba(34, 197, 94, 0.6);
}

.agent-tutorial-progress--ok .agent-tutorial-progress__counter {
    color: #4ade80;
    font-size: 16px;
}

.agent-tutorial-progress--fail {
    border-color: rgba(248, 113, 113, 0.7);
    cursor: pointer;
}

.agent-tutorial-progress--fail .agent-tutorial-progress__counter {
    color: #f87171;
    font-size: 16px;
}

.agent-tutorial-progress--fail:hover {
    background: #2a3550;
}

[data-theme='light'] .agent-tutorial-progress {
    background: #ffffff;
    color: #1f2a44;
    border-color: rgba(79, 70, 229, 0.4);
    box-shadow: 0 8px 24px rgba(31, 42, 68, 0.18);
}

[data-theme='light'] .agent-tutorial-progress__counter {
    color: #4f46e5;
}

[data-theme='light'] .agent-tutorial-progress__text {
    color: #1f2a44;
}
