/* Ably Chat Styles */

.ably-widget-container {
  position: fixed;
  z-index: 9999;
}

.ably-widget-container.overlay {
  bottom: 20px;
  right: 20px;
}

.ably-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #0066ff;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.ably-chat-button:hover {
  background: #0052cc;
  transform: scale(1.05);
}

.ably-chat-window,
.ably-chatroom-container {
  width: 380px;
  height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ably-widget-container.overlay .ably-chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
}

.ably-chatroom-container {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.chat-header {
  background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

.ably-chatroom-container .chat-header {
  border-radius: 0;
}

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

.chat-status {
  font-size: 12px;
  opacity: 0.9;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

.chat-status.connected {
  background: rgba(76, 175, 80, 0.3);
}

.chat-status.error {
  background: rgba(244, 67, 54, 0.3);
}

.chat-close {
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

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

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

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: slideIn 0.2s ease;
}

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

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

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
}

.message-author {
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
}

.chat-message.own-message .message-author {
  color: #0066ff;
}

.message-time {
  font-size: 11px;
  color: #a0aec0;
}

.message-text {
  background: white;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: #2d3748;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
}

.chat-message.own-message .message-text {
  background: #0066ff;
  color: white;
}

.chat-input-container {
  display: flex;
  gap: 8px;
  padding: 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus {
  border-color: #0066ff;
}

.chat-input:disabled {
  background: #f5f7fa;
  cursor: not-allowed;
}

.chat-send-btn {
  padding: 10px 20px;
  background: #0066ff;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  background: #0052cc;
}

.chat-send-btn:disabled {
  background: #cbd5e0;
  cursor: not-allowed;
}

.ably-chat-error {
  padding: 20px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  color: #856404;
  text-align: center;
}

/* Responsive */
@media (max-width: 480px) {
  .ably-chat-window {
    width: calc(100vw - 40px);
    height: calc(100vh - 120px);
  }

  .ably-widget-container.overlay {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  .ably-chat-button {
    width: 50px;
    height: 50px;
  }
}
