* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Кнопка открытия чата */
.chat-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #222222;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 9998;
    overflow: hidden;
}

/* Градиентный слой поверх кнопки */
.chat-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #b28ed4 0%, #25D366 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.chat-toggle-btn svg {
    position: relative;
    z-index: 1;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Показываем градиент на футере */
.chat-toggle-btn.on-footer::before {
    opacity: 1;
}

.chat-toggle-btn.on-footer {
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.chat-toggle-btn.on-footer:hover {
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.7);
}

.chat-toggle-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Окно чата */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-widget.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Хедер чата */
.chat-widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #222222;
    color: white;
    border-radius: 16px 16px 0 0;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: #222222;
}

.chat-avatar img {
    width: 110%;
    height: 110%;
    object-fit: cover;
    display: block;
    clip-path: circle(50% at 50% 50%);
    transform: scale(1.1);
}

.chat-widget-info {
    flex: 1;
}

.chat-widget-info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 0.85rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #25D366;
    border-radius: 50%;
    display: inline-block;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Область сообщений */
.chat-widget-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9f9f9;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.chat-welcome h4 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: #222222;
}

.chat-welcome p {
    font-size: 0.95rem;
    color: #666;
    line-height: 1.5;
}

/* Сообщения */
.message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.user .message-content {
    background: #222222;
    color: white;
    border-radius: 16px 16px 4px 16px;
}

.message.bot .message-content {
    background: white;
    color: #222222;
    border: 1px solid #e0e0e0;
    border-radius: 16px 16px 16px 4px;
}

.message-time {
    font-size: 0.75rem;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Индикатор печатания */
.typing-indicator .message-content {
    font-style: italic;
    opacity: 0.7;
}

.typing-indicator .message-content::after {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 4px;
    background: #999;
    border-radius: 50%;
    animation: typing-dot 1.4s infinite;
}

@keyframes typing-dot {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Поле ввода */
.chat-widget-input {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    border-radius: 0 0 16px 16px;
}

.chat-widget-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d0d0d0;
    border-radius: 24px;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.chat-widget-input input:focus {
    border-color: #222222;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #222222;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

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

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

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

.chat-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* Мобильная кнопка открытия чата */
.mobile-chat-open-btn {
    display: none;
}

@media (max-width: 768px) {
    .mobile-chat-open-btn {
        display: block;
        position: fixed;
        bottom: 30px;
        left: 20px;
        right: 20px;
        background: #222222;
        color: white;
        padding: 18px 30px;
        border: none;
        border-radius: 50px;
        text-align: center;
        font-weight: 600;
        font-size: 16px;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        z-index: 9997;
        cursor: pointer;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        overflow: hidden;
    }
    
    /* Градиентный слой для мобильной кнопки */
    .mobile-chat-open-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, #b28ed4 0%, #25D366 100%);
        border-radius: 50px;
        opacity: 0;
        transition: opacity 0.4s ease;
        z-index: -1;
        pointer-events: none;
    }
    
    .mobile-chat-open-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    }
    
    /* Показываем градиент на футере для мобильной кнопки */
    .mobile-chat-open-btn.on-footer::before {
        opacity: 1;
    }
    
    .mobile-chat-open-btn.on-footer {
        box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
    }
    
    .mobile-chat-open-btn.on-footer:hover {
        box-shadow: 0 8px 32px rgba(37, 211, 102, 0.7);
    }
    
    .chat-toggle-btn {
        display: none !important;
    }
}

/* Мобильная адаптация */
@media (max-width: 480px) {
    .chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-widget-header {
        border-radius: 0;
    }

    .chat-widget-input {
        border-radius: 0;
    }

    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
    }
}

