/* Floating Chat - Light Blue Theme */
.floating-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-button {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  background: #5b9bd5;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(91, 155, 213, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(91, 155, 213, 0.5);
}

.chat-button.near-footer {
  border: 2px solid #ffffff;
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 22px;
  height: 22px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 520px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

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

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

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #5b9bd5;
  color: white;
}

.chat-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.chat-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.chat-status {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #a7f3d0;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Name Input Section */
.chat-name-input {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #ffffff;
}

.name-input-content {
  text-align: center;
  max-width: 280px;
}

.name-input-content i {
  font-size: 3rem;
  color: #5b9bd5;
  margin-bottom: 16px;
}

.name-input-content h4 {
  margin: 0 0 8px;
  color: #1e293b;
  font-size: 1.1rem;
}

.name-input-content p {
  margin: 0 0 20px;
  color: #64748b;
  font-size: 0.9rem;
}

.name-input-content form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.name-input-content input {
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 1rem;
  text-align: center;
}

.name-input-content input:focus {
  outline: none;
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.15);
}

.btn-start-chat {
  padding: 12px 20px;
  background: #5b9bd5;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-start-chat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(91, 155, 213, 0.35);
  background: #4a8ac4;
}

/* Chat Body */
.chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-track {
  background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Load More */
.load-more-container {
  text-align: center;
  padding: 10px 0;
}

.btn-load-more {
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  color: #64748b;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-load-more:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Chat Messages */
.chat-message {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message.sent {
  align-self: flex-end;
}

.chat-message.received {
  align-self: flex-start;
}

.chat-message.system {
  align-self: center;
  max-width: 90%;
}

.chat-message .message-content {
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.sent .message-content {
  background: #5b9bd5;
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received .message-content {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.chat-message.system .message-content {
  background: rgba(91, 155, 213, 0.08);
  border: 1px solid rgba(91, 155, 213, 0.2);
  color: #5b9bd5;
  font-size: 0.85rem;
  text-align: center;
  border-radius: 4px;
}

.chat-message .message-content a {
  color: inherit;
  text-decoration: underline;
}

.chat-message .message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.chat-message .message-content li {
  margin: 4px 0;
}

.message-time {
  font-size: 0.7rem;
  color: #94a3b8;
  padding: 0 4px;
}

.chat-message.sent .message-time {
  text-align: right;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

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

.typing-dots span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

.typing-text {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* Chat Footer */
.chat-footer {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.chat-input:focus {
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.1);
}

.chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input::placeholder {
  color: #94a3b8;
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: #5b9bd5;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(91, 155, 213, 0.35);
  background: #4a8ac4;
}

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

/* ==========================================
   V2 Chat Widget Classes (from blade component)
   ========================================== */

.floating-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-fab {
  width: 60px;
  height: 60px;
  border-radius: 4px;
  background: #5b9bd5;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(91, 155, 213, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 25px rgba(91, 155, 213, 0.5);
  background: #4a8ac4;
}

.chat-fab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  background: #ef4444;
  color: white;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Chat Container (V2 window) */
.chat-container {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 380px;
  height: 520px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.chat-container.active {
  display: flex;
  animation: slideUp 0.3s ease;
}

/* V2 Header */
.chat-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #5b9bd5;
  color: white;
}

.chat-hdr-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-hdr-avatar {
  width: 38px;
  height: 38px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chat-hdr-info h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.chat-hdr-info p {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-hdr-dot {
  width: 7px;
  height: 7px;
  background: #a7f3d0;
  border-radius: 50%;
  display: inline-block;
}

.chat-hdr-actions {
  display: flex;
  gap: 6px;
}

.chat-hdr-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.chat-hdr-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* V2 Name Screen */
.chat-name-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: #ffffff;
}

.chat-name-inner {
  text-align: center;
  max-width: 280px;
}

.chat-name-icon {
  font-size: 3rem;
  color: #5b9bd5;
  margin-bottom: 12px;
}

.chat-name-inner h4 {
  color: #1e293b;
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.chat-name-inner p {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.chat-name-inner input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 1rem;
  text-align: center;
  margin-bottom: 12px;
}

.chat-name-inner input:focus {
  outline: none;
  border-color: #5b9bd5;
  box-shadow: 0 0 0 3px rgba(91, 155, 213, 0.15);
}

.chat-name-inner button {
  width: 100%;
  padding: 12px;
  background: #5b9bd5;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-name-inner button:hover {
  background: #4a8ac4;
}

/* V2 Messages Area */
.chat-msgs {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.chat-msgs::-webkit-scrollbar {
  width: 5px;
}

.chat-msgs::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* V2 Message Bubbles */
.chat-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-msg.sent {
  align-self: flex-end;
}

.chat-msg.received {
  align-self: flex-start;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg.sent .chat-msg-bubble {
  background: #5b9bd5;
  color: white;
}

.chat-msg.received .chat-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}

.chat-msg-time {
  font-size: 0.65rem;
  color: #94a3b8;
  padding: 0 4px;
}

.chat-msg.sent .chat-msg-time {
  text-align: right;
}

/* V2 Footer */
.chat-ftr {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.chat-ftr input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.9rem;
  outline: none;
}

.chat-ftr input:focus {
  border-color: #5b9bd5;
}

.chat-ftr input::placeholder {
  color: #94a3b8;
}

.chat-ftr button {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  background: #5b9bd5;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chat-ftr button:hover:not(:disabled) {
  background: #4a8ac4;
}

.chat-ftr button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Snap Zones - managed by inline styles in the component */

/* Dark Mode Overrides */
[data-theme="dark"] .chat-window,
[data-theme="dark"] .chat-container {
  background: #4a8ac4;
  border-color: #2d4a6a;
}

[data-theme="dark"] .chat-body,
[data-theme="dark"] .chat-msgs {
  background: #5b9bd5;
}

[data-theme="dark"] .chat-name-input,
[data-theme="dark"] .chat-name-screen {
  background: #4a8ac4;
}

[data-theme="dark"] .name-input-content h4,
[data-theme="dark"] .chat-name-inner h4 {
  color: #fff;
}

[data-theme="dark"] .name-input-content p,
[data-theme="dark"] .chat-name-inner p {
  color: #94a3b8;
}

[data-theme="dark"] .name-input-content input,
[data-theme="dark"] .chat-name-inner input {
  background: #162d47;
  border-color: #2d4a6a;
  color: #fff;
}

[data-theme="dark"] .chat-footer,
[data-theme="dark"] .chat-ftr {
  background: #4a8ac4;
  border-color: #2d4a6a;
}

[data-theme="dark"] .chat-input,
[data-theme="dark"] .chat-ftr input {
  background: #162d47;
  border-color: #2d4a6a;
  color: #fff;
}

[data-theme="dark"] .chat-message.received .message-content,
[data-theme="dark"] .chat-msg.received .chat-msg-bubble {
  background: #4a8ac4;
  border-color: #2d4a6a;
  color: #fff;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chat-window,
  .chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .floating-chat {
    bottom: 15px;
    right: 15px;
  }

  .floating-chat-widget {
    bottom: 15px;
    right: 15px;
  }
}
