/* INTENTOS Studio — live agent UX (composer bar, typewriter, file reveals) */

.studio-composer-bar {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 0.55rem;
    border-bottom: 1px solid var(--t-border);
    background: transparent;
    flex-shrink: 0;
}

.studio-composer-bar__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 1.25rem;
}

.studio-composer-bar__status {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--t-muted);
    min-width: 0;
}

.studio-composer-bar__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6366f1;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55);
}

.studio-composer-bar.is-active .studio-composer-bar__status-dot {
    animation: studioLivePulse 1.4s ease-in-out infinite;
}

.studio-composer-bar__status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.studio-composer-bar__plan {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--t-surface-2);
    border: 1px solid var(--t-border);
    color: var(--t-text);
    flex-shrink: 0;
}

.studio-composer-bar__plan.is-pro {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(168, 85, 247, 0.12));
    border-color: rgba(99, 102, 241, 0.35);
}

.studio-composer-bar__auto {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--t-surface-2);
    border: 1px solid var(--t-border);
    color: var(--t-text-muted);
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.studio-composer-bar.is-active .studio-composer-bar__auto {
    color: var(--t-text);
    border-color: color-mix(in srgb, #6366f1 45%, var(--t-border));
}

.studio-composer-bar__picker,
.studio-composer-bar__models,
.studio-composer-bar__meter,
.studio-composer-picker,
.studio-composer-picker__label,
.studio-model-chip,
.studio-model-chip__role {
    display: none !important;
}

/* Avatar pulse while agent works */
.agent-avatar-wrap.is-live {
    position: relative;
}

.agent-avatar-wrap.is-live::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 2px solid rgba(99, 102, 241, 0.45);
    animation: studioAvatarRing 1.8s ease-out infinite;
    pointer-events: none;
}

.agent-avatar-wrap.is-live .agent-avatar {
    animation: studioAvatarBob 2.2s ease-in-out infinite;
}

/* Typewriter agent bubble — legacy class hooks */
.studio-msg__body.is-streaming,
.chat-agent.is-streaming {
    position: relative;
}

.chat-typing-enhanced {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.chat-typing-enhanced__label {
    font-size: 0.68rem;
    opacity: 0.72;
    font-weight: 500;
}

/* File tree reveal */
.studio-file.is-reveal {
    animation: studioFileReveal 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.studio-filetree-folder {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.55;
    padding: 0.45rem 0.5rem 0.15rem 0.35rem;
    margin-top: 0.15rem;
}

.studio-file .studio-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-filetree-folder.is-reveal {
    animation: studioFileReveal 0.35s ease both;
}

.studio-filetree-group.is-reveal {
    animation: studioFileReveal 0.35s ease both;
}

.studio-code-flash .CodeMirror {
    animation: studioCodeFlash 0.9s ease;
}

#codeWrap.is-refining,
.studio-code-wrap.is-refining {
    outline: 2px solid rgba(129, 140, 248, 0.45);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.2);
}

.studio-file.is-generating {
    opacity: 0.85;
    color: #a5b4fc;
}

.studio-file.is-generating .studio-file-pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #818cf8;
    margin-right: 0.35rem;
    animation: studioLivePulse 1s ease-in-out infinite;
}

.studio-file.is-ready {
    color: #6ee7b7;
}

.studio-reasoning {
    margin-bottom: 0.55rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--t-surface-2) 70%, transparent);
    border: 1px solid color-mix(in srgb, var(--t-border) 50%, transparent);
    border-left: 2px solid color-mix(in srgb, #818cf8 55%, var(--t-border));
    font-size: 0.6875rem;
    line-height: 1.5;
    color: var(--t-text-muted);
    max-height: 6.5rem;
    overflow: auto;
}

.studio-reasoning__label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.58rem;
    opacity: 0.8;
    margin-bottom: 0.2rem;
    color: var(--t-text-muted);
}

.studio-reasoning.hidden { display: none; }

.studio-stream-bubble .studio-type-cursor,
.studio-msg__body .studio-type-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 1px;
    vertical-align: text-bottom;
    background: var(--t-text-muted);
    animation: studioTypeBlink 0.85s step-end infinite;
}

@keyframes studioLivePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.55); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

@keyframes studioAvatarRing {
    0% { transform: scale(0.92); opacity: 0.9; }
    70% { transform: scale(1.18); opacity: 0; }
    100% { transform: scale(1.18); opacity: 0; }
}

@keyframes studioAvatarBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

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

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

@keyframes studioCodeFlash {
    0% { box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.55); }
    100% { box-shadow: inset 0 0 0 0 rgba(99, 102, 241, 0); }
}

@media (max-width: 860px) {
    .studio-composer-bar__models {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.15rem;
        -webkit-overflow-scrolling: touch;
    }
    .studio-model-chip {
        flex-shrink: 0;
    }
}
