/* ==========================================
   CHAT INTERFACE
   ========================================== */

.chat-container {
  max-width: 900px;
  margin: 0 auto;
}

.chat-header {
  text-align: center;
  margin-bottom: var(--space-md);
}

.chat-header h1 {
  color: var(--violet-dark);
  margin-bottom: var(--space-xs);
  font-size: 2.5rem;
}

.chat-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.quota-info {
  background: var(--violet-light);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  text-align: center;
  margin-bottom: var(--space-md);
  border-left: 4px solid var(--violet-primary);
  color: var(--dark-primary);
}

.quota-info strong {
  color: var(--violet-dark);
}

.chat-box {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 600px;
}

.btn-clear-chat {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 10;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  opacity: 0.7;
}

.btn-clear-chat:hover {
  opacity: 1;
  background: var(--violet-light);
  border-color: var(--violet-primary);
  color: var(--violet-dark);
  transform: rotate(-45deg);
}

.btn-clear-chat:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.btn-clear-chat.loading svg {
  animation: spin 0.8s linear infinite;
}

.btn-clear-chat svg {
  width: 18px;
  height: 18px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.chat-message {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  max-width: 80%;
  animation: messageSlide var(--transition-base);
}

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

.chat-message.user {
  background-color: var(--violet-light);
  border: 2px solid var(--violet-primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: var(--dark-primary);
}

.chat-message.assistant {
  background-color: var(--gray-light);
  border: 2px solid var(--yellow-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-message-role {
  font-weight: var(--font-weight-bold);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-message.user .chat-message-role {
  color: var(--violet-dark);
}

.chat-message.assistant .chat-message-role {
  color: var(--text-primary);
}

.chat-message-content {
  color: var(--text-primary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Force dark text on light violet background for user messages */
.chat-message.user .chat-message-content {
  color: var(--dark-primary);
}

.chat-input-container {
  padding: var(--space-md);
  background: var(--gray-light);
  border-top: 2px solid var(--violet-light);
}

.chat-form {
  display: flex;
  gap: var(--space-sm);
}

.chat-input {
  flex: 1;
  padding: var(--space-sm);
  border: 2px solid var(--violet-light);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  transition: all var(--transition-base);
}

.chat-input:focus {
  outline: none;
  border-color: var(--violet-primary);
  box-shadow: 0 0 0 3px var(--violet-light);
}

.chat-submit {
  padding: var(--space-sm) var(--space-md);
  background: var(--yellow-primary);
  color: var(--dark-primary);
  border: none;
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.chat-submit:hover {
  background: var(--yellow-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.chat-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.loading-indicator {
  padding: var(--space-sm);
  text-align: center;
  color: var(--violet-primary);
  font-style: italic;
}

.login-prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.login-prompt p {
  margin: 0;
  color: var(--text-secondary);
}

.btn-login {
  padding: var(--space-xs) var(--space-md);
  background: var(--yellow-primary);
  color: var(--dark-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-bold);
  transition: all var(--transition-base);
}

.btn-login:hover {
  background: var(--yellow-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================
   ANIMATIONS & LOADING STATES
   ========================================== */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--violet-light);
  border-top-color: var(--violet-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================
   RESPONSIVE - MOBILE
   ========================================== */

@media (max-width: 768px) {
  .chat-box {
    height: 500px;
  }

  .chat-message {
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .chat-header h1 {
    font-size: 2rem;
  }
}
