/**
 * PolicyBox Reader styles — part 4/7: Typing indicator, streaming response, progressive loading, router progress, skeletons, collapsed nav history.
 * Split from reader.css (2026-06). Load order matters (cascade);
 * link tags in layouts/policy_reader.html preserve the original order.
 */

/* =============================================================================
   TYPING INDICATOR - Perceived latency improvement
   ============================================================================= */

.typing-indicator-node {
    padding: 0.75rem 1rem;
    background: var(--color-bg-tertiary);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    width: fit-content;
    animation: fadeInMessage 0.3s ease;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem;
}

/* Rotating phrase label */
.typing-indicator .typing-label {
    font-size: 0.875rem;
    font-style: italic;
    color: var(--color-text-secondary);
    margin-right: 4px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.typing-indicator .typing-label.phrase-changing {
    opacity: 0.3;
    transform: translateY(-2px);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0.4;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0s; }
.typing-dot:nth-child(3) { animation-delay: 0.2s; }
.typing-dot:nth-child(4) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Streaming response thinking indicator */
.thinking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    padding-left: 0.5rem;
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.thinking-indicator .thinking-label {
    font-weight: 500;
    color: var(--color-text-primary);
}

.thinking-indicator .thinking-divider {
    color: var(--color-text-secondary);
    opacity: 0.5;
    margin: 0 2px;
}

.thinking-indicator .thinking-phrase {
    font-style: italic;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.thinking-indicator .thinking-phrase.phrase-changing {
    opacity: 0.3;
    transform: translateY(-2px);
}

.thinking-indicator .ellipsis-animation {
    display: inline-block;
    animation: ellipsisPulse 1.5s ease-in-out infinite;
}

@keyframes ellipsisPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Tier-specific styling */
.thinking-indicator.tier-1 { color: var(--color-success, #22c55e); }
.thinking-indicator.tier-2 { color: var(--color-info, #3b82f6); }
.thinking-indicator.tier-3 { color: var(--color-text-secondary); }

/* Elapsed time in thinking indicator */
.thinking-elapsed {
    font-size: 0.8rem;
    color: var(--color-text-tertiary, #9ca3af);
    font-variant-numeric: tabular-nums;
    margin-left: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.thinking-elapsed.visible {
    opacity: 1;
}

/* Progress bar below thinking indicator */
.thinking-progress-bar {
    width: 100%;
    height: 3px;
    background: var(--color-bg-tertiary, #e5e7eb);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.thinking-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary, #3b82f6), var(--color-primary-light, #60a5fa));
    border-radius: 2px;
    transition: width 0.3s ease-out;
}

/* Indeterminate sliding animation */
.thinking-progress-fill.indeterminate {
    width: 40%;
    animation: thinkingProgressSlide 1.5s ease-in-out infinite;
}

@keyframes thinkingProgressSlide {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(250%); }
    100% { transform: translateX(250%); }
}

/* TTS Pipeline Steps */
.tts-pipeline-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    animation: pipelineStepFadeIn 0.3s ease-out;
}

.pipeline-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.pipeline-text {
    font-style: italic;
}

@keyframes pipelineStepFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dark mode */
[data-theme="dark"] .thinking-progress-bar {
    background: var(--color-bg-tertiary, #374151);
}

[data-theme="dark"] .thinking-elapsed {
    color: var(--color-text-tertiary, #6b7280);
}

/* =============================================================================
   DEGRADATION NOTICE - Subtle note when response quality may be reduced
   ============================================================================= */

.response-degradation-notice {
    font-size: 0.8rem;
    color: var(--color-text-tertiary, #9ca3af);
    font-style: italic;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border-light, #e5e7eb);
    line-height: 1.4;
}

[data-theme="dark"] .response-degradation-notice {
    color: var(--color-text-tertiary, #6b7280);
    border-top-color: var(--color-border-light, #374151);
}

/* =============================================================================
   SUBMIT BUTTON SENDING STATE - Instant feedback
   ============================================================================= */

.submit-btn.btn-sending {
    background: var(--color-accent);
    opacity: 0.8;
    cursor: wait;
    min-width: 80px;
}

.sending-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Button spinner for action buttons (e.g., suggest questions) */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: var(--color-primary, #2563eb);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* =============================================================================
   STREAMING RESPONSE STYLES - Real-time text display
   ============================================================================= */

/* Streaming node visual indicator */
.conversation-node.streaming {
    border-left: 3px solid var(--color-accent);
    padding-left: 1rem;
    background: var(--color-bg-tertiary);
    border-radius: 8px;
    padding: 0.875rem 1rem;
}

/* Streaming indicator dot (pulsing) */
.streaming-indicator {
    display: inline-block;
    color: var(--color-accent);
    animation: streamingPulse 1.5s ease-in-out infinite;
    margin-left: 8px;
    font-size: 0.875rem;
}

@keyframes streamingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Streaming content - show text as it arrives */
.conversation-node.streaming .streaming-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Blinking cursor at end of streaming content */
.conversation-node.streaming .streaming-content::after {
    content: '▋';
    display: inline;
    color: var(--color-accent);
    animation: streamingBlink 1s step-end infinite;
    margin-left: 2px;
}

/* Remove cursor when streaming completes */
.conversation-node:not(.streaming) .streaming-content::after {
    display: none;
}

/* Hide cursor when thinking indicator is showing */
.conversation-node.streaming .streaming-content:has(.thinking-indicator)::after {
    display: none;
}

/* Reduce whitespace when showing thinking indicator (before content arrives) */
.conversation-node.streaming:has(.thinking-indicator) {
    padding: 0.5rem 0;
}

.conversation-node.streaming .streaming-content:has(.thinking-indicator) {
    line-height: 1.2;
    min-height: auto;
    white-space: normal;
}

@keyframes streamingBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* =============================================================================
   PROGRESSIVE LOADING ENHANCEMENTS
   ============================================================================= */

/* Streaming text content wrapper */
.streaming-text-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Word count indicator during streaming */
.streaming-word-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--color-text-tertiary, #9ca3af);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border-light, #f3f4f6);
    opacity: 0.7;
}

.streaming-word-count .word-count-value {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* "Still working..." message after delay */
.still-working-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-bg-tertiary, #f9fafb);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    animation: stillWorkingFadeIn 0.3s ease-out;
}

.still-working-indicator svg {
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

@keyframes stillWorkingFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Skeleton paragraph placeholders */
.skeleton-paragraphs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.skeleton-line {
    height: 1rem;
    background: linear-gradient(
        90deg,
        var(--color-bg-secondary, #e5e7eb) 25%,
        var(--color-bg-tertiary, #f3f4f6) 50%,
        var(--color-bg-secondary, #e5e7eb) 75%
    );
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-line:nth-child(1) { width: 95%; }
.skeleton-line:nth-child(2) { width: 88%; }
.skeleton-line:nth-child(3) { width: 92%; }
.skeleton-line:nth-child(4) { width: 70%; animation-delay: 0.1s; }

/* Fade-in animation for streamed content */
.streaming-content.content-arriving {
    animation: contentFadeIn 0.2s ease-out;
}

@keyframes contentFadeIn {
    from {
        opacity: 0.7;
    }
    to {
        opacity: 1;
    }
}

/* Dark mode skeleton */
[data-theme="dark"] .skeleton-line {
    background: linear-gradient(
        90deg,
        #374151 25%,
        #4b5563 50%,
        #374151 75%
    );
    background-size: 200% 100%;
}

[data-theme="dark"] .still-working-indicator {
    background: var(--color-bg-secondary, #1f2937);
}

/* =============================================================================
   ROUTER PROGRESS - Intermediate content preview during DAG processing
   ============================================================================= */

.router-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem;
}

.router-progress-container .thinking-indicator {
    padding-left: 0;
}

/* Progress bar */
.router-progress-bar {
    width: 100%;
    height: 3px;
    background: var(--color-bg-tertiary, #e5e7eb);
    border-radius: 2px;
    overflow: hidden;
}

.router-progress-bar .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary, #3b82f6), var(--color-primary-light, #60a5fa));
    border-radius: 2px;
    transition: width 0.3s ease-out;
}

/* Categories preview (shown after classification) */
.router-categories-preview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.router-categories-preview .categories-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.router-categories-preview .categories-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.router-categories-preview .category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    color: var(--color-primary, #3b82f6);
    background: var(--color-primary-bg, rgba(59, 130, 246, 0.1));
    border-radius: 4px;
    animation: categoryBadgeFadeIn 0.3s ease-out;
}

@keyframes categoryBadgeFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Preview content (greyed out partial answers) */
.router-preview-content {
    padding: 0.75rem;
    background: var(--color-bg-secondary, #f9fafb);
    border-radius: 6px;
    border-left: 3px solid var(--color-primary, #3b82f6);
    opacity: 0.7;
    animation: previewSlideIn 0.4s ease-out;
}

.router-preview-content .preview-category-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary, #3b82f6);
    margin-bottom: 0.375rem;
}

.router-preview-content .preview-text {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
    font-style: italic;
}

@keyframes previewSlideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 0.7;
        transform: translateX(0);
    }
}

/* Faded skeleton (shown below preview) */
.skeleton-paragraphs.skeleton-faded {
    opacity: 0.4;
}

.skeleton-paragraphs.skeleton-faded .skeleton-line {
    height: 0.75rem;
}

/* Search targets display (after classification) */
.router-search-targets {
    padding: 0.75rem;
    background: var(--color-bg-secondary, #f0f9ff);
    border-radius: 8px;
    border-left: 3px solid var(--color-info, #3b82f6);
    margin-bottom: 0.75rem;
    animation: searchTargetsFadeIn 0.4s ease-out;
}

.router-search-targets .search-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.router-search-targets .search-categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.router-search-targets .search-category-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    padding: 0.25rem 0;
}

.router-search-targets .search-icon {
    font-size: 0.9rem;
    opacity: 0.8;
}

.router-search-targets .search-category-name {
    font-weight: 500;
}

@keyframes searchTargetsFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Previews container for accumulated partial answers */
.router-previews-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.router-previews-container .router-preview-content {
    animation: previewSlideIn 0.4s ease-out both;
}

/* Synthesis indicator */
.router-synthesis-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--color-primary-bg, #eff6ff) 0%, var(--color-bg-secondary, #f9fafb) 100%);
    border-radius: 8px;
    margin-top: 0.5rem;
    animation: synthesisGlow 2s ease-in-out infinite;
}

.router-synthesis-indicator .synthesis-icon {
    font-size: 1.1rem;
    animation: synthesisIconPulse 1.5s ease-in-out infinite;
}

.router-synthesis-indicator .synthesis-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-primary, #3b82f6);
}

@keyframes synthesisGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
    50% {
        box-shadow: 0 0 12px 2px rgba(59, 130, 246, 0.15);
    }
}

@keyframes synthesisIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Dark mode search targets */
[data-theme="dark"] .router-search-targets {
    background: var(--color-bg-tertiary, #1e3a5f);
}

[data-theme="dark"] .router-synthesis-indicator {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, var(--color-bg-tertiary, #1f2937) 100%);
}

/* Dark mode router progress */
[data-theme="dark"] .router-preview-content {
    background: var(--color-bg-tertiary, #1f2937);
}

[data-theme="dark"] .router-progress-bar {
    background: var(--color-bg-tertiary, #374151);
}

[data-theme="dark"] .router-categories-preview .category-badge {
    background: rgba(59, 130, 246, 0.2);
}

/* Streaming node header styling (shown during streaming) */
.conversation-node.streaming .node-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0;
    border-bottom: none;
}

.conversation-node.streaming .node-meta {
    display: flex;
    align-items: center;
}

.conversation-node.streaming .node-type {
    display: inline;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.conversation-node.streaming .node-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.875rem;
}

/* ===========================
   Skeleton Loading (Next Steps)
   =========================== */

/* Skeleton container (shown while fetching metadata) */
.skeleton-next-steps .next-steps-title {
    animation: skeleton-fade 1.5s ease-in-out infinite;
}

/* Skeleton cards (shimmer effect) */
.next-step-card.skeleton {
    height: 80px;
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 25%,
        var(--color-border-light) 50%,
        var(--color-bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border: none;
    cursor: default;
    pointer-events: none;
}

.next-step-card.skeleton:hover {
    transform: none;
    box-shadow: none;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes skeleton-fade {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ===========================
   Card Reveal Animations
   =========================== */

/* Populated cards (slide in with stagger) */
.next-step-card.populated {
    animation: card-reveal 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

.next-step-card.populated:nth-child(1) { animation-delay: 0ms; }
.next-step-card.populated:nth-child(2) { animation-delay: 100ms; }
.next-step-card.populated:nth-child(3) { animation-delay: 200ms; }

@keyframes card-reveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content reveal animation (after streaming completes) */
.node-content.revealing p,
.node-content.revealing ul,
.node-content.revealing ol,
.node-content.revealing h2,
.node-content.revealing h3 {
    animation: content-reveal 0.3s ease-out forwards;
}

@keyframes content-reveal {
    from {
        opacity: 0.8;
    }
    to {
        opacity: 1;
    }
}

/* ===========================
   Dark Mode - Skeleton
   =========================== */

[data-theme="dark"] .next-step-card.skeleton {
    background: linear-gradient(
        90deg,
        #2d2d2d 25%,
        #3d3d3d 50%,
        #2d2d2d 75%
    );
    background-size: 200% 100%;
}

/* ===========================
   Scripted Suggestions
   Using next-steps design for hardcoded navigation options
   =========================== */

/* Container modifier for scripted suggestions */
.next-steps-container.scripted-suggestions {
    margin-top: 0;
    padding-top: 0;
    border-top: none; /* Remove border for standalone suggestions */
}

/* Fade out animation for suggestions */
.next-steps-container.suggestions-fade-out {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

/* Visibility animation trigger */
.next-steps-container.suggestions-visible {
    opacity: 1;
}

/* ===========================
   Collapsed Navigation History
   Shows previous choices as compact, expandable summaries
   =========================== */

.next-steps-container.collapsed {
    max-height: 52px !important;
    overflow: hidden;
    opacity: 0.7;
    cursor: pointer;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.15)) !important;
    border-radius: 8px;
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
    padding: 0 !important; /* Override parent padding */
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.15)) !important; /* Keep border consistent */
    transition: max-height 0.3s ease, opacity 0.2s ease, border-color 0.2s ease;
    background: var(--surface-secondary, rgba(0, 0, 0, 0.03));
}

.next-steps-container.collapsed:hover {
    opacity: 1;
    border-color: var(--color-warning, #f59e0b);
    background: rgba(245, 158, 11, 0.05);
}

.next-steps-container.collapsed .next-steps-grid {
    display: none;
}

.next-steps-container.collapsed .next-steps-header {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    display: block !important;
}

/* Expanded state for collapsed containers */
.next-steps-container.collapsed.expanded {
    max-height: none !important; /* Remove height constraint */
    opacity: 1;
    overflow: visible;
    padding-bottom: 1rem !important;
    background: var(--surface-primary, #fff);
    border: 1px solid var(--color-warning, #f59e0b);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10; /* Ensure it appears above subsequent content */
    margin-bottom: 1rem !important;
}

.next-steps-container.collapsed.expanded .next-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    padding: 1rem;
    gap: 0.75rem;
    background: var(--surface-primary, #fff);
    margin-top: 0; /* Override base margin since we have padding on container */
}

/* Collapsed summary bar */
.collapsed-summary {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary, #666) !important;
    min-height: 48px;
    box-sizing: border-box;
    width: 100%;
    background: transparent;
}

/* Ensure collapsed container shows the summary */
.next-steps-container.collapsed .collapsed-summary {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.collapsed-summary .collapsed-label {
    opacity: 0.8;
    white-space: nowrap;
    font-size: 0.8rem;
}

.collapsed-summary .collapsed-hint {
    opacity: 0.5;
    font-size: 0.75rem;
    font-style: italic;
    white-space: nowrap;
}

.collapsed-summary .collapsed-title {
    color: var(--text-primary, #333);
    font-weight: 500;
}

.collapsed-summary .expand-icon {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.6;
}

.next-steps-container.collapsed:hover .expand-icon {
    opacity: 1;
}

.next-steps-container.collapsed.expanded .expand-icon {
    transform: rotate(90deg);
}

/* Re-enable cards in expanded collapsed container */
.next-steps-container.collapsed.expanded .next-step-card {
    pointer-events: auto;
    opacity: 1;
}

/* Visited/selected card state - orange to indicate previously explored */
.next-step-card.visited {
    border-color: var(--color-warning, #f59e0b);
    background: rgba(245, 158, 11, 0.08);
    position: relative;
}

.next-step-card.visited::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--color-warning, #f59e0b);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.next-step-card.visited .next-step-type {
    background: var(--color-warning, #f59e0b);
    color: white;
}

.next-step-card.visited:hover {
    border-color: var(--color-warning-dark, #d97706);
    background: rgba(245, 158, 11, 0.12);
}

/* Override white text from .next-step-selected when card is also .visited */
.next-step-card.visited.next-step-selected {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--color-warning, #f59e0b);
}

.next-step-card.visited.next-step-selected .next-step-title,
.next-step-card.visited.next-step-selected .next-step-description,
.next-step-card.visited.next-step-selected .next-step-rationale {
    color: var(--color-warning-dark, #92400e) !important;
}

.next-step-card.visited.next-step-selected .next-step-arrow svg {
    stroke: var(--color-warning-dark, #92400e) !important;
}

/* Collapsed summary with multiple visited titles */
.collapsed-summary .visited-titles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
    align-items: center;
}

.collapsed-summary .visited-title {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning-dark, #b45309);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Scripted cards use same animation as populated */
.next-step-card.scripted {
    animation: card-reveal 0.4s ease-out forwards;
    opacity: 0;
    transform: translateY(10px);
}

/* Staggered animation for scripted cards */
.next-step-card.scripted:nth-child(1) { animation-delay: 0ms; }
.next-step-card.scripted:nth-child(2) { animation-delay: 100ms; }
.next-step-card.scripted:nth-child(3) { animation-delay: 200ms; }
.next-step-card.scripted:nth-child(4) { animation-delay: 300ms; }
.next-step-card.scripted:nth-child(5) { animation-delay: 400ms; }

/* Hide info icon for scripted cards (no rationale available) */
.next-step-card.scripted .next-step-info-icon {
    display: none;
}

/* Ensure description wrapper doesn't expect info icon */
.next-step-card.scripted .next-step-description-wrapper {
    padding-right: 0;
}

/* BanterBox Help Card - Subtle, almost invisible until hovered */
.next-step-card.banterbox-help {
    grid-column: 1 / -1;
    background: transparent;
    border: none;
    margin-top: 0.25rem;
    padding: 0.5rem 0.75rem;
    opacity: 0.4;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.next-step-card.banterbox-help .next-step-number {
    background: transparent;
    border: none;
    padding: 0;
    align-self: center;
}

.next-step-card.banterbox-help .next-step-number .banterbox-favicon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.next-step-card.banterbox-help:hover .next-step-number .banterbox-favicon {
    opacity: 1;
}

.next-step-card.banterbox-help .next-step-title {
    color: var(--color-text-tertiary);
    font-size: 0.75rem;
    font-weight: 400;
}

.next-step-card.banterbox-help .next-step-description {
    color: var(--color-text-tertiary);
    font-size: 0.6875rem;
    line-height: 1.3;
}

.next-step-card.banterbox-help .next-step-arrow {
    color: var(--color-text-tertiary);
    opacity: 0.5;
    align-self: center;
}

.next-step-card.banterbox-help .next-step-arrow svg {
    width: 12px;
    height: 12px;
}

.next-step-card.banterbox-help:hover {
    opacity: 1;
    background: var(--color-bg-tertiary);
    transform: none;
    box-shadow: none;
}

.next-step-card.banterbox-help:hover .next-step-arrow {
    opacity: 1;
}
