/* ============================================================
   СВОЁ ТАКСИ — animations.css
   Анимации AI-ядра: пульсация, орбиты, волны, переходы состояний.
   Все анимации — плавные, без резких скачков.
   ============================================================ */

/* ---------- Пульсация сферы (IDLE) ---------- */
@keyframes coreBreath {
    0%, 100% {
        box-shadow:
            0 0 32px rgba(255, 215, 0, 0.35),
            inset 0 0 24px rgba(255, 215, 0, 0.12);
    }
    50% {
        box-shadow:
            0 0 44px rgba(255, 215, 0, 0.5),
            inset 0 0 32px rgba(255, 215, 0, 0.18);
    }
}

body[data-ai-state="idle"] .ai-core__mic-btn {
    animation: coreBreath 4s ease-in-out infinite;
}

/* ---------- Пульсация иконки микрофона ---------- */
@keyframes micPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 14px rgba(255, 215, 0, 0.9));
    }
}

/* ---------- Орбиты: медленное вращение ---------- */
@keyframes orbitRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.ai-core__orbit--1 {
    animation: orbitRotate 60s linear infinite;
}
.ai-core__orbit--2 {
    animation: orbitRotate 45s linear infinite reverse;
}
.ai-core__orbit--3 {
    animation: orbitRotate 30s linear infinite;
}

/* В состоянии LISTENING орбиты ускоряются */
body[data-ai-state="listening"] .ai-core__orbit--1 {
    animation-duration: 18s;
}
body[data-ai-state="listening"] .ai-core__orbit--2 {
    animation-duration: 14s;
}
body[data-ai-state="listening"] .ai-core__orbit--3 {
    animation-duration: 10s;
}

body[data-ai-state="processing"] .ai-core__orbit--1 {
    animation-duration: 12s;
}
body[data-ai-state="processing"] .ai-core__orbit--2 {
    animation-duration: 9s;
}
body[data-ai-state="processing"] .ai-core__orbit--3 {
    animation-duration: 6s;
}

/* ---------- Концентрические волны (LISTENING) ---------- */
@keyframes waveRipple {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
        border-width: 2px;
    }
    100% {
        transform: translate(-50%, -50%) scale(3.4);
        opacity: 0;
        border-width: 0.5px;
    }
}

body[data-ai-state="listening"] .ai-core__wave {
    animation: waveRipple 2s ease-out infinite;
}

body[data-ai-state="listening"] .ai-core__wave--2 {
    animation-delay: 0.6s;
}

body[data-ai-state="listening"] .ai-core__wave--3 {
    animation-delay: 1.2s;
}

/* ---------- Лёгкое плавание всей сферы ---------- */
@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4px); }
}

.ai-core {
    animation: floatY 6s ease-in-out infinite;
}

body[data-ai-state="listening"] .ai-core,
body[data-ai-state="processing"] .ai-core {
    animation-duration: 2.5s;
}

/* ---------- Пульс центральной кнопки (LISTENING/PROCESSING) ---------- */
@keyframes micBtnActivePulse {
    0%, 100% {
        transform: scale(1.06);
    }
    50% {
        transform: scale(1.12);
    }
}

body[data-ai-state="listening"] .ai-core__mic-btn,
body[data-ai-state="processing"] .ai-core__mic-btn {
    animation: micBtnActivePulse 1.4s ease-in-out infinite;
}

/* ---------- Подставка-отражение: дышащая тень ---------- */
@keyframes reflectionBreath {
    0%, 100% {
        opacity: 0.85;
        transform: translateX(-50%) scaleX(1);
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) scaleX(1.06);
    }
}

.ai-core__reflection {
    animation: reflectionBreath 5s ease-in-out infinite;
}

/* ---------- Общие переходы между состояниями ---------- */
.ai-core__mic-btn,
.ai-status__text,
.service-tab,
.service-tab__icon {
    transition-property: transform, color, background, border-color, box-shadow;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Появление результата ---------- */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translate(-50%, 16px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* ---------- Ховер-эффекты на desktop (для не-touch устройств) ---------- */
@media (hover: hover) and (pointer: fine) {
    .ai-core__mic-btn:hover {
        transform: scale(1.04);
        box-shadow:
            0 0 48px rgba(255, 215, 0, 0.55),
            inset 0 0 28px rgba(255, 215, 0, 0.18);
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .ai-core,
    .ai-core__mic-btn,
    .ai-core__orbit,
    .ai-core__wave,
    .ai-core__reflection,
    .ai-core__mic-icon {
        animation: none !important;
    }
}
