/* ==========================================================================
   TANYA DECOR — ИНТЕРАКТИВНЫЙ AI-АССИСТЕНТ
   ========================================================================== */

/* Обертка для перетаскивания и позиционирования по экрану */
.ai-bot {
    position: absolute;
    width: 140px;
    height: 140px;
    z-index: 9995;
    cursor: grab;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.2s ease-out;
    border-radius: 50%;
}

.ai-bot:active {
    cursor: grabbing;
}

/* Всплывающее облачко (Speech Bubble) */
.ai-bot .ai-speech-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.85);
    background: #ffffff;
    border: 1px solid #ebd5c1;
    border-radius: 16px;
    padding: 12px 18px;
    color: #1e1b18;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: pre-wrap;
    min-width: 210px;
    max-width: 280px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(197, 168, 128, 0.2);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.35s;
    z-index: 10;
}

.ai-bot .ai-speech-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    display: block;
    width: 0;
}

.ai-bot .ai-speech-bubble::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 9px 9px 0 9px;
    border-style: solid;
    border-color: #ebd5c1 transparent transparent transparent;
    display: block;
    width: 0;
}

.ai-bot .ai-speech-bubble.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-12px) scale(1);
}

/* Тело ассистента - Фото круглое с золотисто-бежевой рамкой */
.ai-body.ai-body-kira {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: visible;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 0 0 4px #ffffff, 0 0 0 6px #c5a880;
    animation: kira-float 4.5s ease-in-out infinite alternate;
    cursor: pointer;
    background: #fff;
}

.ai-body.ai-body-kira .kira-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.1));
}

.ai-body.ai-body-kira .kira-status-dot {
    position: absolute;
    bottom: 6px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: #10b981;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    z-index: 2;
}

@keyframes kira-float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-7px) rotate(1.5deg); }
    100% { transform: translateY(0px) rotate(-1.5deg); }
}

/* Оверлей фона для чата */
.expik-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9990;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.expik-overlay.show {
    opacity: 1;
}

/* Окно чата */
.expik-chat-window {
    position: absolute;
    width: 380px;
    max-width: calc(100vw - 30px);
    height: 520px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    z-index: 10005;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.expik-chat-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.expik-chat-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    border-bottom: 2px solid #c5a880;
}

.expik-chat-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.expik-chat-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.expik-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.expik-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.expik-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    word-break: break-word;
}

.expik-msg-ai {
    align-self: flex-start;
}

.expik-msg-ai .expik-msg-text {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 16px 16px 16px 4px;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.expik-msg-user {
    align-self: flex-end;
}

.expik-msg-user .expik-msg-text {
    background: linear-gradient(135deg, #c5a880 0%, #b29367 100%);
    color: #ffffff;
    border-radius: 16px 16px 4px 16px;
    padding: 10px 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    box-shadow: 0 4px 10px rgba(197, 168, 128, 0.3);
}

.expik-typing {
    font-size: 0.8rem;
    color: #64748b;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
}

.expik-chat-form {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
}

.expik-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.expik-chat-input:focus {
    border-color: #c5a880;
}

.expik-chat-mic {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.expik-chat-mic:hover {
    transform: scale(1.1);
}

.expik-chat-send {
    background: #1e293b;
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    transition: background 0.2s, transform 0.2s;
}

.expik-chat-send:hover {
    background: #c5a880;
    transform: scale(1.05);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .ai-bot {
        width: 85px;
        height: 85px;
    }
    .ai-bot .ai-speech-bubble {
        min-width: 170px;
        max-width: 220px;
        font-size: 0.76rem;
        padding: 8px 12px;
    }
    .ai-body.ai-body-kira .kira-status-dot {
        width: 13px;
        height: 13px;
        bottom: 3px;
        right: 4px;
        border-width: 2px;
    }
    .expik-chat-window {
        position: fixed !important;
        top: 15px !important;
        left: 50% !important;
        transform: translateX(-50%) scale(0.95) !important;
        width: calc(100vw - 24px) !important;
        max-width: 380px !important;
        height: 480px !important;
        max-height: 80vh !important;
        z-index: 10005 !important;
    }
    .expik-chat-window.open {
        transform: translateX(-50%) scale(1) !important;
    }
}
