/**
 * AI Assistant Widget Styles
 * СамоЗанятые.РФ
 */

/* ==================== AI Assistant Widget ==================== */

.ai-assistant-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Кнопка открытия чата */
.ai-assistant-trigger {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ai-assistant-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.ai-assistant-trigger:active {
    transform: scale(0.95);
}

/* Анимированный персонаж (SVG) */
.ai-assistant-avatar {
    width: 45px;
    height: 45px;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

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

/* Пульсирующий эффект */
.ai-assistant-trigger::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: pulse 2s ease-out infinite;
    opacity: 0;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Бейдж с уведомлением */
.ai-assistant-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Окно чата */
.ai-assistant-chat {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-assistant-chat.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Заголовок чата */
.ai-assistant-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    color: white;
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-assistant-header-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 3s ease-in-out infinite;
}

.ai-assistant-header-info {
    flex: 1;
}

.ai-assistant-header-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ai-assistant-header-info p {
    margin: 5px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.ai-assistant-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-assistant-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Область сообщений */
.ai-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f7f9fc;
}

/* Сообщение */
.ai-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-message-content {
    flex: 1;
}

.ai-message-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message.user .ai-message-avatar {
    background: #e0e7ff;
}

.ai-message.user .ai-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-message-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 5px;
    display: block;
}

/* Индикатор печатания */
.ai-typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
}

.ai-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: typing 1.4s ease-in-out infinite;
}

.ai-typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.ai-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Форма ввода */
.ai-assistant-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 20px 20px;
}

.ai-assistant-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-assistant-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-assistant-input:focus {
    border-color: #667eea;
}

.ai-assistant-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-assistant-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-assistant-send:active {
    transform: scale(0.95);
}

.ai-assistant-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

/* Быстрые ответы */
.ai-quick-replies {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.ai-quick-reply {
    padding: 8px 16px;
    border-radius: 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-quick-reply:hover {
    background: #e0e7ff;
    border-color: #667eea;
    color: #667eea;
}

/* Приветственное сообщение */
.ai-welcome-message {
    text-align: center;
    padding: 30px 20px;
}

.ai-welcome-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    animation: float 3s ease-in-out infinite;
}

.ai-welcome-message h4 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #1e293b;
}

.ai-welcome-message p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .ai-assistant-widget {
        bottom: 20px;
        right: 20px;
    }
    
    .ai-assistant-chat {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 90px;
        right: 0;
    }
    
    .ai-assistant-trigger {
        width: 60px;
        height: 60px;
    }
    
    .ai-assistant-avatar {
        width: 35px;
        height: 35px;
    }
}

/* Скроллбар */
.ai-assistant-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-assistant-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.ai-assistant-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
