/* Agent Status Indicator - Floating above chat input */
.agent-status-container {
    position: absolute;
    bottom: 100%;
    /* Just above the input area */
    left: 0;
    right: 0;
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(to top, var(--color-bg-raised), transparent);
    pointer-events: none;
    /* Let clicks pass through if needed */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    animation: fadeInUp 0.3s var(--ease-out);
    z-index: 10;
}

.agent-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 12px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-primary-glow);
    border-radius: var(--radius-full);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    max-width: 90%;
}

.agent-status-icon {
    display: flex;
    align-items: center;
    color: var(--color-primary);
}

.agent-status-text {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: statusFlash 0.4s ease-out;
}

@keyframes statusFlash {
    0% {
        opacity: 0.4;
        transform: translateY(2px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pulse animation for the icon */
@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 var(--color-primary-glow);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 4px transparent;
    }

    100% {
        transform: scale(0.8);
        box-shadow: 0 0 0 0 transparent;
    }
}

.agent-spinner {
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: pulse-ring 1.5s infinite;
}

/* Typing Indicator inside Bubble (fallback/supplement) */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: var(--color-text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Reasoning / Execution Log - Gemini/Antigravity Style */
.execution-log-container {
    margin: 12px 0;
    border-radius: var(--radius-lg);
    background: rgba(var(--color-bg-raised-rgb, 18, 18, 26), 0.4);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: all 0.3s var(--ease-out);
    width: 100%;
    /* Wider logs as requested */
    max-width: 450px;
    box-shadow: var(--shadow-md);
}

/* Light Mode Overrides for Log */
[data-theme="light"] .execution-log-container {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.execution-log-header {
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .execution-log-header {
    background: rgba(0, 0, 0, 0.02);
}

.execution-log-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .execution-log-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.log-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

[data-theme="light"] .log-title-group {
    color: var(--color-text-secondary);
}

.log-chevron {
    transition: transform 0.3s ease;
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

.execution-log-container.expanded .log-chevron {
    transform: rotate(180deg);
}

.execution-log-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.execution-log-container.expanded .execution-log-content {
    max-height: 500px;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .execution-log-container.expanded .execution-log-content {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.log-list {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

/* Vertical line for the timeline */
.log-list::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 24px;
    bottom: 24px;
    width: 1px;
    background: linear-gradient(to bottom, var(--color-primary), transparent);
    opacity: 0.3;
}

.log-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    animation: logFadeIn 0.3s var(--ease-out) forwards;
}

@keyframes logFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.log-item-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4b5563;
    margin-top: 4px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    border: 2.5px solid var(--color-bg-card);
}

.log-item.thinking .log-item-icon {
    background: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-glow);
    animation: log-pulse 2s infinite;
}

@keyframes log-pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.log-item.action .log-item-icon {
    background: #8b5cf6;
    /* purple-500 */
}

.log-item.success .log-item-icon {
    background: #10b981;
    /* emerald-500 */
}

.log-item-text {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    font-weight: 500;
}

[data-theme="light"] .log-item-text {
    color: var(--color-text);
}

.log-timer {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    margin-left: 6px;
    opacity: 0.8;
}

.log-item-data {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.05);
    white-space: pre-wrap;
    max-width: 100%;
    overflow-x: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .log-item-data {
    background: rgba(0, 0, 0, 0.04);
    color: #475569;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Chat Bubble Enhancements */
.chat-msg {
    max-width: 92% !important;
    /* Slightly wider */
    padding: 12px 18px !important;
}

.chat-msg-text {
    font-size: 0.92rem !important;
    line-height: 1.6 !important;
}