/* Real-time Chat Widget v2 Styles */
.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

.chat-widget-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  position: relative;
}

.chat-widget-button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

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

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

.chat-widget-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 550px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

.chat-widget-window.open {
  display: flex;
  animation: slideUp 0.3s ease;
}

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

.chat-widget-header {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-widget-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.chat-widget-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 5px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.chat-widget-close:hover {
  opacity: 1;
}

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

/* Форма начала чата */
.chat-widget-start {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-widget-start p {
  margin: 0 0 10px 0;
  color: #666;
}

.chat-widget-input {
  padding: 12px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.chat-widget-input:focus {
  outline: none;
  border-color: #dc3545;
}

.chat-widget-submit {
  padding: 12px 20px;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-widget-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.chat-widget-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Чат */
.chat-widget-chat {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f9fafb;
}

.chat-message {
  margin-bottom: 15px;
  animation: fadeIn 0.3s ease;
}

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

.chat-message-visitor {
  text-align: left;
}

.chat-message-manager {
  text-align: right;
}

.message-sender {
  font-size: 11px;
  color: #999;
  margin-bottom: 4px;
  font-weight: 600;
}

.message-content {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
  text-align: left;
}

.chat-message-visitor .message-content {
  background: white;
  color: #333;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-message-manager .message-content {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
}

.message-time {
  font-size: 10px;
  color: #999;
  margin-top: 4px;
}

/* Форма ввода сообщения */
.chat-input-form {
  display: flex;
  padding: 15px;
  border-top: 1px solid #e0e0e0;
  background: white;
  gap: 10px;
}

.chat-message-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.chat-message-input:focus {
  outline: none;
  border-color: #dc3545;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.chat-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-widget-status {
  padding: 10px 15px;
  font-size: 12px;
  color: #666;
  text-align: center;
  border-top: 1px solid #e0e0e0;
  background: #f9fafb;
}

/* Форма оценки консультации */
.chat-rating-form {
  padding: 20px;
  background: white;
  border-top: 1px solid #e0e0e0;
}

.rating-header h4 {
  margin: 0 0 10px 0;
  font-size: 16px;
  color: #333;
  text-align: center;
}

.rating-header p {
  margin: 0 0 15px 0;
  font-size: 13px;
  color: #666;
  text-align: center;
}

.rating-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}

.star-btn {
  width: 50px;
  height: 50px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  transform: scale(1.1);
  border-color: #dc3545;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.star-btn.active {
  border-color: #dc3545;
  background: #fff5f5;
  transform: scale(1.15);
}

.rating-comment {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.rating-comment:focus {
  outline: none;
  border-color: #dc3545;
}

.rating-submit-btn {
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.rating-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.rating-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Благодарность за отзыв */
.chat-rating-thanks {
  padding: 15px 20px;
  background: #f0f9ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  text-align: center;
  margin: 10px 15px;
  animation: fadeIn 0.3s ease;
}

.chat-rating-thanks h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #059669;
  font-weight: 600;
}

.chat-rating-thanks p {
  margin: 0;
  font-size: 13px;
  color: #374151;
  line-height: 1.5;
}

/* Мобильная адаптация */
@media (max-width: 480px) {
  .chat-widget-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
    bottom: 90px;
    right: 20px;
  }

  .rating-stars {
    gap: 8px;
  }

  .star-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
  }
}



