/* Плавающий чат */
.floating-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

/* Кнопка чата */
.chat-button {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1001;
}

.chat-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chat-icon {
    width: 24px;
    height: 24px;
}

.chat-label {
    font-weight: 500;
    font-size: 0.9rem;
}

.chat-badge {
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    position: absolute;
    top: -5px;
    right: -5px;
}

/* Окно чата */
.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.chat-window.active {
    display: flex;
    animation: chatSlideUp 0.3s ease;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Заголовок чата */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--background);
    border-bottom: 1px solid var(--border-light);
}

.consultant-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.consultant-avatar {
    position: relative;
}

.consultant-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.online-status {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border: 2px solid white;
    border-radius: 50%;
}

.consultant-details h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}

.consultant-status {
    font-size: 0.8rem;
    color: var(--text-light);
}

.chat-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.3s ease;
}

.chat-close:hover {
    color: var(--text-color);
    background: var(--background-light);
}

/* Сообщения */
.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--background-light);
}

.message {
    display: flex;
    max-width: 80%;
}

.message.consultant-message {
    align-self: flex-start;
}

.message.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    position: relative;
}

.consultant-message .message-content {
    background: white;
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.user-message .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content p {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Поле ввода */
.chat-input-container {
    padding: 1rem;
    background: white;
    border-top: 1px solid var(--border-light);
}

.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-question {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-question:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 0.5rem 0.75rem;
}

.chat-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 0.9rem;
    padding: 0.25rem;
}

.chat-input::placeholder {
    color: var(--text-light);
}

.send-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.send-button:hover {
    background: var(--primary-dark);
}

.send-button:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

/* Адаптивность */
@media (max-width: 768px) {
    .floating-chat {
        bottom: 20px;
        right: 20px;
    }

    .chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        right: 0;
        bottom: 80px;
    }

    .chat-button {
        padding: 0.875rem 1.25rem;
    }

    .chat-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .floating-chat {
        bottom: 15px;
        right: 15px;
    }

    .chat-window {
        width: calc(100vw - 30px);
        height: 75vh;
        bottom: 70px;
    }
}

/* Анимация уведомления */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.online-status.pulse {
    animation: pulse 2s infinite;
}