/* Chat system styles */
.chat-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
}

.chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color, #00d4aa), #00a88a);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 25px rgba(0, 212, 170, 0.4);
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.chat-toggle:hover {
  transform: scale(1.1);
}

.chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: var(--dark-bg, #0f0f1a);
}

.chat-box {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 500px;
  background: var(--card-bg, #1a1a2e);
  border-radius: 16px;
  border: 1px solid var(--border-color, #2a2a4a);
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

.chat-box.is-open {
  display: flex;
}

.chat-header {
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-color, #00d4aa), #00a88a);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header h3 {
  color: var(--dark-bg, #0f0f1a);
  font-weight: 700;
  margin: 0;
}

.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-close svg {
  width: 20px;
  height: 20px;
  fill: var(--dark-bg, #0f0f1a);
}

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  animation: fadeIn 0.3s ease-out;
  word-wrap: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--primary-color, #00d4aa);
  color: var(--dark-bg, #0f0f1a);
}

.chat-message.other {
  align-self: flex-start;
  background: var(--border-color, #2a2a4a);
}

.chat-message .username {
  font-size: 0.7rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  opacity: 0.8;
}

.chat-message .text {
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-timestamp {
  font-size: 0.65rem;
  opacity: 0.6;
  margin-top: 0.25rem;
  text-align: right;
}

.chat-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border-color, #2a2a4a);
  display: flex;
  gap: 0.5rem;
}

.chat-input-area .input {
  flex: 1;
}

.chat-input-area .button {
  padding: 0.5rem 1rem;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--border-color, #2a2a4a);
  border-radius: 12px;
  align-self: flex-start;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  background: var(--text-secondary, #a0a0b0);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Scrollbar for chat */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color, #2a2a4a);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color, #00d4aa);
}

/* Mobile responsive */
@media screen and (max-width: 480px) {
  .chat-widget {
    bottom: 20px;
    right: 20px;
  }
  
  .chat-box {
    width: calc(100vw - 40px);
    right: -10px;
    height: 400px;
  }
  
  .chat-toggle {
    width: 50px;
    height: 50px;
  }
  
  .chat-toggle svg {
    width: 24px;
    height: 24px;
  }
}
