/* ========================================
   AGENTIC ACTIVITY FEED
   Glass Shell Design System
   ======================================== */

/* Toggle Switch */
.agentic-toggle-wrapper {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.agentic-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
}

.agentic-toggle input {
    display: none;
}

.agentic-toggle-slider {
    position: relative;
    width: 32px;
    height: 18px;
    background: #e2e8f0;
    border-radius: 9px;
    transition: background-color 180ms ease;
}

.agentic-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    transition: transform 180ms ease;
}

.agentic-toggle input:checked + .agentic-toggle-slider {
    background: #8b5cf6;
}

.agentic-toggle input:checked + .agentic-toggle-slider::after {
    transform: translateX(14px);
}

.agentic-toggle-label {
    color: #475569;
    font-weight: 500;
}

.agentic-toggle input:checked ~ .agentic-toggle-label {
    color: #8b5cf6;
}

/* Activity Feed Container */
.agentic-activity-feed {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    animation: agenticFeedEnter 200ms ease;
}

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

.agentic-feed-exit {
    animation: agenticFeedExit 200ms ease forwards;
}

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

.agentic-activity-feed.agentic-feed-complete {
    border-color: #a5b4fc;
    background: #eef2ff;
}

.agentic-activity-feed.agentic-feed-error {
    border-color: #fca5a5;
    background: #fef2f2;
}

/* Feed Header */
.agentic-feed-header {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #475569;
    margin-bottom: 6px;
}

.agentic-feed-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: agenticSpin 1.5s linear infinite;
}

@keyframes agenticSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.agentic-feed-complete .agentic-feed-icon {
    animation: none;
    color: #8b5cf6;
}

.agentic-feed-error .agentic-feed-icon {
    animation: none;
    color: #ef4444;
}

.agentic-feed-title {
    font-weight: 500;
}

/* Feed Items */
.agentic-feed-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agentic-activity-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    color: #475569;
    animation: agenticItemEnter 150ms ease;
}

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

.agentic-activity-item.agentic-item-complete {
    background: rgba(139, 92, 246, 0.08);
    color: #6d28d9;
}

/* Spinner */
.agentic-item-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid #e2e8f0;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: agenticItemSpin 0.8s linear infinite;
}

@keyframes agenticItemSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Complete Icon */
.agentic-item-icon {
    color: #8b5cf6;
    font-weight: bold;
    font-size: 0.75rem;
}

.agentic-item-text {
    flex: 1;
}

/* Chunk Preview */
.agentic-chunk-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-left: auto;
}

.agentic-chunk-id {
    display: inline-block;
    padding: 1px 4px;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 3px;
    font-size: 0.65rem;
    font-family: ui-monospace, monospace;
    color: #6d28d9;
}

/* Streaming Message Styles */
.agentic-streaming .message-content {
    min-height: 24px;
}

.streaming-cursor {
    display: inline-block;
    animation: cursorBlink 1s step-end infinite;
    color: #8b5cf6;
    font-weight: bold;
}

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

.agentic-message-activity {
    margin-bottom: 4px;
}

.agentic-message-activity:empty {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .agentic-activity-feed {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .agentic-chunk-preview {
        display: none;
    }
}

/* Dark mode support (if applicable) */
@media (prefers-color-scheme: dark) {
    .agentic-activity-feed {
        background: rgba(30, 41, 59, 0.8);
        border-color: rgba(71, 85, 105, 0.5);
    }

    .agentic-feed-header,
    .agentic-toggle-label,
    .agentic-activity-item {
        color: #cbd5e1;
    }

    .agentic-toggle-slider {
        background: #475569;
    }

    .agentic-activity-item {
        background: rgba(51, 65, 85, 0.5);
    }

    .agentic-activity-item.agentic-item-complete {
        background: rgba(139, 92, 246, 0.15);
        color: #c4b5fd;
    }

    .agentic-chunk-id {
        background: rgba(139, 92, 246, 0.2);
        color: #c4b5fd;
    }
}
