/* Чат виджет */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

/* Кружочек чата */
.chat-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #73AD85 0%, #4CAF70 50%, #2E7D4F 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(115, 173, 133, 0.4);
    transition: all 0.3s ease;
    position: relative;
    animation: pulse 2s infinite;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(115, 173, 133, 0.6);
}

.chat-bubble-icon {
    font-size: 1.5rem;
    color: #ffffff !important;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    border: 2px solid white;
    animation: bounce 1s infinite;
}

.chat-badge.hidden {
    display: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(115, 173, 133, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(115, 173, 133, 0.8);
    }
    100% {
        box-shadow: 0 4px 20px rgba(115, 173, 133, 0.4);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-3px);
    }
    60% {
        transform: translateY(-2px);
    }
}

/* Контейнер чата */
.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    color: #333;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    pointer-events: none;
}

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

.chat-header {
    background: linear-gradient(135deg, #73AD85 0%, #4CAF70 50%, #2E7D4F 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.chat-icon {
    font-size: 1.2rem;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#chatClose {
	font-family: Arial, sans-serif !important;
}
.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    animation: messageSlide 0.3s ease;
}

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

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

.bot-message {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message .message-content {
    background: linear-gradient(135deg, #73AD85 0%, #4CAF70 50%, #2E7D4F 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message .message-content {
    background: #f1f3f4;
    color: #333;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 0.75rem;
    color: #666;
    margin-top: 5px;
    text-align: right;
}

.bot-message .message-time {
    text-align: left;
}

.chat-input-container {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

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

#chatInput {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

#chatInput:focus {
    border-color: #73AD85;
}

.send-button {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #73AD85 0%, #4CAF70 50%, #2E7D4F 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-button:hover {
    transform: scale(1.1);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

.typing-indicator.show {
    display: flex;
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #73AD85;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

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

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Адаптивность для чата */
@media (max-width: 768px) {
    .chat-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 40px);
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
}

.message-content {
    font-size: 14px;
    line-height: 1.3;
}

.typing-indicator::after {
  content: '🖊';
  display: inline-block;
  position: relative;
  animation: move 1s linear infinite;
  font-size: 16px;
}

@keyframes move {
  0%   { left: 0; }
  50%  { left: 5px; }
  100% { left: 0; }
}

/* Ссылки внутри сообщений пользователя */
.message.user-message .message-content a,
.message.user-message .message-content a:visited {
  color: #fff !important;
}

.message.user-message .message-content a:hover,
.message.user-message .message-content a:focus {
  text-decoration-thickness: 2px;
  opacity: .9;
}

/* По умолчанию чат скрыт */
#chatWidget {
  display: none !important;
}

/* На десктопах (ширина > 1024px) чат показываем */
@media (min-width: 1025px) {
  #chatWidget {
    display: block !important;
  }
}
