/* Robot AI agents — CSS bots that look busy */

.ai-agents {
    margin: 0 0 22px;
    padding: 22px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.ai-agents__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.ai-agents__head h2 {
    margin: 0 0 8px;
    font-size: clamp(22px, 3vw, 28px);
    letter-spacing: -0.03em;
    color: #0f172a;
}

.ai-agents__lead {
    margin: 0;
    color: #64748b;
    line-height: 1.6;
    max-width: 640px;
    font-size: 14px;
}

.ai-agents__hint {
    display: block;
    margin-top: 4px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: #94a3b8;
}

.ai-agents__live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(5, 150, 105, 0.25);
    background: rgba(5, 150, 105, 0.08);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    color: #047857;
    white-space: nowrap;
}

.ai-agents__live i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
    animation: ai-pulse 1.6s ease-in-out infinite;
}

@keyframes ai-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.ai-agents__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.ai-agent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 14px 14px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #f8fafc;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.ai-agent.is-active {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
    background: #fff;
}

.ai-agent__info {
    width: 100%;
}

.ai-agent__name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.ai-agent__name-row h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.ai-agent__role {
    display: block;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    color: #64748b;
    margin-bottom: 8px;
}

.ai-agent__badge {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-transform: lowercase;
}

.ai-agent__badge.is-working {
    color: #1d4ed8;
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.2);
}

.ai-agent__badge.is-idle {
    color: #64748b;
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.18);
}

.ai-agent__badge.is-done {
    color: #047857;
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.2);
}

.ai-agent__task {
    margin: 0 0 10px;
    min-height: 2.6em;
    font-size: 11px;
    line-height: 1.45;
    color: #334155;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.ai-agent__bar {
    height: 5px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
    margin-bottom: 10px;
}

.ai-agent__bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #22c55e);
    transition: width 0.6s ease;
}

.ai-agent__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 10px;
    color: #94a3b8;
}

.ai-agent__dots {
    display: inline-flex;
    gap: 3px;
}

.ai-agent__dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #94a3b8;
    animation: ai-dot 1.2s ease-in-out infinite;
}

.ai-agent__dots i:nth-child(2) { animation-delay: 0.15s; }
.ai-agent__dots i:nth-child(3) { animation-delay: 0.3s; }

.ai-agent__dots.is-paused i {
    animation: none;
    opacity: 0.35;
}

@keyframes ai-dot {
    0%, 100% { opacity: 0.25; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}

/* ===== Robot figure ===== */
.robot {
    --bot: #4f46e5;
    --bot-2: #2563eb;
    --eye: #67e8f9;
    width: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: robot-idle 3s ease-in-out infinite;
}

.robot--cyan { --bot: #0891b2; --bot-2: #2563eb; --eye: #a5f3fc; }
.robot--green { --bot: #059669; --bot-2: #0d9488; --eye: #bbf7d0; }
.robot--pink { --bot: #db2777; --bot-2: #7c3aed; --eye: #fbcfe8; }

.ai-agent.is-active .robot {
    animation: robot-work 0.7s ease-in-out infinite;
}

.ai-agent:not(.is-active) .robot__arms span {
    animation: none;
}

.robot__antenna {
    width: 3px;
    height: 12px;
    background: #94a3b8;
    border-radius: 2px;
    position: relative;
    margin-bottom: 2px;
}

.robot__antenna span {
    position: absolute;
    top: -5px;
    left: 50%;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: var(--bot);
    box-shadow: 0 0 10px var(--bot);
    animation: antenna-blink 1.4s ease-in-out infinite;
}

.robot__head {
    width: 52px;
    height: 40px;
    border-radius: 14px 14px 10px 10px;
    background: linear-gradient(160deg, var(--bot-2), var(--bot));
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    z-index: 2;
}

.robot__eyes {
    display: flex;
    gap: 10px;
}

.robot__eyes i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--eye);
    box-shadow: 0 0 8px var(--eye);
    animation: eye-blink 4s ease-in-out infinite;
}

.robot__mouth {
    width: 16px;
    height: 4px;
    border-radius: 0 0 8px 8px;
    background: rgba(15, 23, 42, 0.35);
}

.ai-agent.is-active .robot__mouth {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.28);
    animation: mouth-talk 0.45s ease-in-out infinite;
}

.robot__body {
    margin-top: -4px;
    width: 44px;
    height: 34px;
    border-radius: 8px 8px 12px 12px;
    background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
    border: 2px solid #94a3b8;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.robot__chest {
    width: 16px;
    height: 10px;
    border-radius: 4px;
    background: var(--bot);
    opacity: 0.85;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.25);
}

.robot__arms {
    position: absolute;
    inset: 6px -10px auto;
    display: flex;
    justify-content: space-between;
}

.robot__arms span {
    width: 8px;
    height: 18px;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--bot-2), var(--bot));
    transform-origin: top center;
}

.ai-agent.is-active .robot__arms span:first-child {
    animation: arm-left 0.7s ease-in-out infinite;
}

.ai-agent.is-active .robot__arms span:last-child {
    animation: arm-right 0.7s ease-in-out infinite;
}

@keyframes robot-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes robot-work {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-4px) rotate(1deg); }
}

@keyframes antenna-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

@keyframes eye-blink {
    0%, 46%, 54%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.15); }
}

@keyframes mouth-talk {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.7); }
}

@keyframes arm-left {
    0%, 100% { transform: rotate(18deg); }
    50% { transform: rotate(-25deg); }
}

@keyframes arm-right {
    0%, 100% { transform: rotate(-18deg); }
    50% { transform: rotate(25deg); }
}

/* Log feed */
.ai-agents__feed {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #0b1220;
    color: #e2e8f0;
}

.ai-agents__feed-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #121a2a;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    color: #94a3b8;
}

.ai-agents__feed-dots {
    display: flex;
    gap: 5px;
}

.ai-agents__feed-dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #334155;
    display: block;
}

.ai-agents__feed-dots i:nth-child(1) { background: #ef4444; }
.ai-agents__feed-dots i:nth-child(2) { background: #eab308; }
.ai-agents__feed-dots i:nth-child(3) { background: #22c55e; }

.ai-agents__feed-body {
    padding: 10px 12px 12px;
    min-height: 84px;
    max-height: 110px;
    overflow: hidden;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 11px;
    line-height: 1.7;
}

.ai-agents__feed-body .line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #cbd5e1;
    animation: ai-line-in 0.35s ease;
}

.ai-agents__feed-body .line .who { color: #60a5fa; }
.ai-agents__feed-body .line .ok { color: #34d399; }

@keyframes ai-line-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* ===== Sidebar compact ===== */
.ai-agents--sidebar {
    margin: 14px 0 0;
    padding: 12px;
    border-radius: 14px;
    box-shadow: none;
}

.ai-agents--sidebar .ai-agents__head {
    margin-bottom: 10px;
    align-items: center;
}

.ai-agents--sidebar .ai-agents__head h2 {
    margin: 0;
    font-size: 15px;
    letter-spacing: -0.02em;
}

.ai-agents--sidebar .ai-agents__live {
    padding: 5px 8px;
    font-size: 10px;
    gap: 6px;
}

.ai-agents--sidebar .ai-agents__live i {
    width: 6px;
    height: 6px;
}

.ai-agents--sidebar .ai-agents__grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-agents--sidebar .ai-agent {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
}

.ai-agents--sidebar .ai-agent.is-active {
    transform: none;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.08);
}

.ai-agents--sidebar .robot {
    width: 40px;
    flex-shrink: 0;
}

.ai-agents--sidebar .robot__antenna {
    height: 8px;
}

.ai-agents--sidebar .robot__antenna span {
    width: 6px;
    height: 6px;
    top: -4px;
    margin-left: -3px;
}

.ai-agents--sidebar .robot__head {
    width: 32px;
    height: 26px;
    border-radius: 10px 10px 8px 8px;
    gap: 3px;
}

.ai-agents--sidebar .robot__eyes {
    gap: 6px;
}

.ai-agents--sidebar .robot__eyes i {
    width: 5px;
    height: 5px;
}

.ai-agents--sidebar .robot__mouth {
    width: 10px;
    height: 3px;
}

.ai-agents--sidebar .ai-agent.is-active .robot__mouth {
    width: 7px;
    height: 7px;
}

.ai-agents--sidebar .robot__body {
    width: 28px;
    height: 22px;
    border-radius: 6px 6px 8px 8px;
}

.ai-agents--sidebar .robot__chest {
    width: 10px;
    height: 7px;
}

.ai-agents--sidebar .robot__arms {
    inset: 4px -7px auto;
}

.ai-agents--sidebar .robot__arms span {
    width: 6px;
    height: 12px;
}

.ai-agents--sidebar .ai-agent__name-row h3 {
    font-size: 12px;
}

.ai-agents--sidebar .ai-agent__badge {
    font-size: 9px;
    padding: 2px 6px;
}

.ai-agents--sidebar .ai-agent__role {
    font-size: 9px;
    margin-bottom: 4px;
}

.ai-agents--sidebar .ai-agent__task {
    min-height: 0;
    margin-bottom: 6px;
    font-size: 10px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-agents--sidebar .ai-agent__bar {
    height: 4px;
    margin-bottom: 6px;
}

.ai-agents--sidebar .ai-agent__meta {
    font-size: 9px;
}

.ai-agents--sidebar .ai-agents__feed-body {
    min-height: 64px;
    max-height: 88px;
    padding: 8px 10px 10px;
    font-size: 10px;
    line-height: 1.55;
}

@media (max-width: 1100px) {
    .ai-agents:not(.ai-agents--sidebar) .ai-agents__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .ai-agents:not(.ai-agents--sidebar) { padding: 16px; }
    .ai-agents:not(.ai-agents--sidebar) .ai-agents__head { flex-direction: column; }
    .ai-agents:not(.ai-agents--sidebar) .ai-agents__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .robot,
    .ai-agent.is-active .robot,
    .robot__antenna span,
    .robot__eyes i,
    .ai-agent.is-active .robot__mouth,
    .ai-agent.is-active .robot__arms span,
    .ai-agents__live i,
    .ai-agent__dots i {
        animation: none !important;
    }
}
