/* Chat container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 500px;
  max-height: 70vh;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Chat header */
.chat-header {
  background: #161616;
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chat-header-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  animation: dot-pulse 2s infinite;
}

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

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

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

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Message bubbles */
.chat-bubble {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  line-height: 1.5;
  font-size: 0.9rem;
  word-wrap: break-word;
  animation: bubble-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chat-bubble-assistant {
  align-self: flex-start;
  background: #f3f4f6;
  color: #161616;
  border-bottom-left-radius: 0.25rem;
}

.chat-bubble-user {
  align-self: flex-end;
  background: #161616;
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.chat-bubble a {
  color: #DB2032;
  text-decoration: underline;
  word-break: break-all;
}

.chat-bubble-user a {
  color: #fca5a5;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1rem;
  align-self: flex-start;
  background: #f3f4f6;
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
  animation: bubble-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Input area */
.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 1.5rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: 'Inter', sans-serif;
}

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

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #DB2032;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
  background: #B91C29;
}

.chat-send-btn:active:not(:disabled) {
  transform: scale(0.93);
}

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

/* Error message */
.chat-error {
  align-self: center;
  background: #fef2f2;
  color: #dc2626;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  text-align: center;
  animation: bubble-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Character count */
.chat-char-count {
  font-size: 0.7rem;
  color: #9ca3af;
  text-align: right;
  padding: 0 1rem 0.25rem;
  transition: color 0.2s;
}

.chat-char-count.near-limit {
  color: #f59e0b;
}

.chat-char-count.at-limit {
  color: #dc2626;
}
