/* Floating Interactive Chat Widget */
.floating-chat-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  font-family: var(--default-font, inherit);
}

/* Tooltip speech bubble */
.chat-bubble-tooltip {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 260px;
  background: var(--surface-color, #ffffff);
  color: var(--default-color, #1e293b);
  padding: 12px 30px 12px 14px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(13, 110, 253, 0.2);
  font-size: 13px;
  line-height: 1.4;
  animation: chatTooltipFadeIn 0.4s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.chat-bubble-tooltip::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  background: var(--surface-color, #ffffff);
  border-right: 1px solid rgba(13, 110, 253, 0.2);
  border-bottom: 1px solid rgba(13, 110, 253, 0.2);
  transform: rotate(45deg);
}

.chat-bubble-tooltip .tooltip-close {
  position: absolute;
  top: 6px;
  right: 10px;
  cursor: pointer;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
}

.chat-bubble-tooltip .tooltip-close:hover {
  color: #ef4444;
}

/* Floating button */
.floating-chat-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d6efd 0%, #0052cc 100%);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(13, 110, 253, 0.4);
  cursor: pointer;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  outline: none;
}

.floating-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(13, 110, 253, 0.55);
}

.floating-chat-btn .chat-icon-close {
  display: none;
  font-size: 20px;
}

.floating-chat-btn.is-active {
  background: #1e293b;
  transform: rotate(90deg);
}

.floating-chat-btn.is-active .chat-icon-open {
  display: none;
}

.floating-chat-btn.is-active .chat-icon-close {
  display: block;
}

/* Pulse animation around button */
.chat-pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #0d6efd;
  opacity: 0;
  animation: chatPulse 2.5s infinite;
  pointer-events: none;
}

.floating-chat-btn.is-active .chat-pulse-ring {
  animation: none;
  display: none;
}

/* Chat Card Widget */
.chat-widget-card {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 330px;
  max-width: calc(100vw - 40px);
  background: var(--surface-color, #ffffff);
  border-radius: 20px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow: hidden;
  transform: translateY(20px) scale(0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.chat-widget-card.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Widget Header */
.chat-widget-header {
  background: linear-gradient(135deg, #0d6efd 0%, #0052cc 100%);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
}

.chat-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.8);
}

.chat-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.chat-user-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}

.chat-user-status {
  font-size: 11px;
  opacity: 0.9;
  display: block;
  margin-top: 2px;
}

.chat-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  padding: 0 4px;
}

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

/* Widget Body */
.chat-widget-body {
  padding: 18px;
  background: var(--surface-color, #ffffff);
}

.channels-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--heading-color, #475569);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: block;
}

.channel-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.channel-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  border-radius: 12px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.25s ease;
  color: #ffffff !important;
}

.channel-btn i {
  font-size: 18px;
  margin-bottom: 3px;
}

.channel-btn.telegram {
  background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
}

.channel-btn.phone {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.channel-btn.email {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.channel-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.chat-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0 12px;
  font-size: 11px;
  color: #94a3b8;
}

.chat-divider::before,
.chat-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.chat-divider span {
  padding: 0 8px;
}

/* Quick form */
.chat-quick-form .chat-form-group {
  margin-bottom: 10px;
}

.chat-input,
.chat-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  color: var(--default-color, #1e293b);
  background: var(--surface-color, #ffffff);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.chat-input:focus,
.chat-textarea:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.chat-send-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: #0d6efd;
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s, transform 0.2s;
}

.chat-send-btn:hover {
  background: #0b5ed7;
  transform: translateY(-1px);
}

.chat-form-status {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
}

.chat-form-status.success {
  background: #d1fae5;
  color: #065f46;
}

.chat-form-status.error {
  background: #fee2e2;
  color: #991b1b;
}

/* Keyframe animations */
@keyframes chatPulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

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

@media (max-width: 576px) {
  .floating-chat-container {
    bottom: 20px;
    right: 20px;
  }
  .chat-widget-card {
    right: -10px;
    width: calc(100vw - 32px);
  }
}
