/* ── Floating Chat Widget ── */
.chat-widget-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E90FF, #3CC7D4);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(30, 144, 255, 0.4);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: all 0.3s ease;
}
.chat-widget-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(30, 144, 255, 0.6);
}
.chat-widget-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4444;
  color: #fff;
  font-size: 0.7rem;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.chat-widget-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideIn 0.25s ease;
}
.chat-widget-panel.open {
  display: flex;
}
@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-widget-header {
  background: linear-gradient(135deg, #1E90FF, #3CC7D4);
  color: #fff;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-widget-header button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.chat-widget-header button:hover { opacity: 1; }

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
  max-height: 320px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
}
.chat-bubble.user {
  align-self: flex-end;
  background: #1E90FF;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.admin {
  align-self: flex-start;
  background: #f0f0f0;
  color: #333;
  border-bottom-left-radius: 4px;
}
.chat-bubble .time {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 4px;
  display: block;
}

.chat-widget-input {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  gap: 8px;
}
.chat-widget-input input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.chat-widget-input input:focus {
  border-color: #1E90FF;
}
.chat-widget-input button {
  background: #1E90FF;
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
  flex-shrink: 0;
}
.chat-widget-input button:hover { background: #1874CD; }
.chat-widget-input button:disabled { background: #ccc; cursor: not-allowed; }

.chat-name-input {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  gap: 8px;
}
.chat-name-input input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.9rem;
  outline: none;
}
.chat-name-input input:focus { border-color: #1E90FF; }
.chat-name-input button {
  background: #1E90FF;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

.chat-powered {
  text-align: center;
  padding: 6px 0 10px;
}

.chat-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #22c55e;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.chat-online-badge .dot {
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
  animation: chatPulse 1.5s ease-in-out infinite;
}

@keyframes chatPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Ripple animation for mobile (pulse rings around button) ── */
.chat-widget-btn.mobile-ripple::before,
.chat-widget-btn.mobile-ripple::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2.5px solid rgba(30, 144, 255, 0.5);
  animation: chatRipple 1.8s ease-out infinite;
  pointer-events: none;
  box-sizing: border-box;
}
.chat-widget-btn.mobile-ripple::after {
  animation-delay: 0.9s;
}
@keyframes chatRipple {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@media (max-width: 480px) {
  .chat-widget-panel {
    width: calc(100vw - 32px);
    right: 16px;
    bottom: 84px;
    max-height: 70vh;
  }
  .chat-widget-btn {
    width: 52px;
    height: 52px;
    font-size: 1.3rem;
    bottom: 16px;
    right: 16px;
  }
}
