/**
 * ===================================
 * Аудит-Pro - Чат виджет
 * ===================================
 */

/* Основные стили чат-виджета */
#chatWidget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Размеры виджета */
#chatWidget.small .chat-toggle {
    width: 50px;
    height: 50px;
}

#chatWidget.medium .chat-toggle {
    width: 60px;
    height: 60px;
}

#chatWidget.large .chat-toggle {
    width: 70px;
    height: 70px;
}

/* Кнопка чата - адаптирована под стиль Аудит-Pro */
.chat-toggle {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    animation: chatPulse 2s infinite;
    border: none;
    position: relative;
    overflow: hidden;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
}

.chat-toggle:active {
    transform: scale(0.95);
}

.chat-toggle i {
    color: white;
    font-size: 20px;
    z-index: 2;
    position: relative;
}

#chatWidget.small .chat-toggle i {
    font-size: 18px;
}

#chatWidget.large .chat-toggle i {
    font-size: 28px;
}

/* Анимация пульсации - усиленная для привлечения внимания */
@keyframes chatPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
        transform: scale(1);
    }
    25% {
        box-shadow: 0 4px 25px rgba(99, 102, 241, 0.5);
        transform: scale(1.05);
    }
    50% {
        box-shadow: 0 4px 40px rgba(99, 102, 241, 0.9);
        transform: scale(1.15);
    }
    75% {
        box-shadow: 0 4px 25px rgba(99, 102, 241, 0.5);
        transform: scale(1.05);
    }
}

/* Позиционирование для разных размеров */
#chatWidget.small,
#chatWidget.medium,
#chatWidget.large {
    right: 20px;
}

/* Всплывающее окно чата */
.chat-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    padding: 20px;
    width: 320px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.chat-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Заголовок чата */
.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.chat-header-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 50%; /* Сделано круглым */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.chat-header-icon i {
    color: white;
    font-size: 20px;
}

.chat-header-text h4 {
    font-weight: 700;
    color: #1f2937;
    font-size: 16px;
    margin: 0;
}

.chat-header-text p {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

/* Каналы связи */
.chat-channels {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    border: 1px solid transparent;
}

.chat-channel:hover {
    background: #f3f4f6;
    transform: translateX(5px);
    border-color: rgba(99, 102, 241, 0.2);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.1);
}

/* Иконки каналов - сделаны круглыми */
.chat-channel-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%; /* Сделано круглым */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chat-channel:hover .chat-channel-icon {
    transform: scale(1.1);
}

/* Цвета иконок каналов */
.chat-channel-icon.whatsapp {
    background: #25D366;
    color: white;
}

.chat-channel-icon.telegram {
    background: #0088cc;
    color: white;
}

.chat-channel-icon.email {
    background: #6b7280;
    color: white;
}

.chat-channel-icon.phone {
    background: #10b981;
    color: white;
}

/* Текст каналов */
.chat-channel-text {
    flex: 1;
}

.chat-channel-text strong {
    display: block;
    font-size: 14px;
    color: #1f2937;
    font-weight: 600;
}

.chat-channel-text span {
    font-size: 12px;
    color: #9ca3af;
}

/* Кнопка закрытия */
.chat-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    padding: 0;
}

.chat-close:hover {
    background: #e5e7eb;
    transform: scale(1.1);
}

/* Подсказка */
.chat-tooltip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    right: 100%;
    margin-right: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chat-toggle:hover ~ .chat-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    .chat-popup {
        width: calc(100vw - 40px);
        max-width: 320px;
        right: -10px;
    }
    
    #chatWidget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-popup {
        bottom: 70px;
    }
}

@media (max-width: 480px) {
    .chat-popup {
        width: calc(100vw - 20px);
        right: -5px;
        padding: 15px;
    }
    
    .chat-channel {
        padding: 10px;
    }
    
    .chat-header-icon {
        width: 40px;
        height: 40px;
    }
    
    .chat-channel-icon {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* Дополнительные эффекты */
.chat-channel:active {
    transform: scale(0.98) translateX(2px);
}

/* Анимация появления для каналов */
.chat-channel {
    animation: slideInRight 0.3s ease-out;
}

.chat-channel:nth-child(1) { animation-delay: 0.1s; }
.chat-channel:nth-child(2) { animation-delay: 0.2s; }
.chat-channel:nth-child(3) { animation-delay: 0.3s; }
.chat-channel:nth-child(4) { animation-delay: 0.4s; }

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Темная тема (опционально) */
@media (prefers-color-scheme: dark) {
    .chat-popup {
        background: #1f2937;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .chat-header {
        border-bottom-color: #374151;
    }
    
    .chat-channel {
        background: #374151;
        color: #f9fafb;
    }
    
    .chat-channel:hover {
        background: #4b5563;
    }
    
    .chat-header-text h4 {
        color: #f9fafb;
    }
    
    .chat-channel-text strong {
        color: #f9fafb;
    }
}
