/* ai-chat.css */
/* Core Container (Shared) */
.ai-chat-container {
  background-color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Page Mode (Default/Route) */
body.path-ai-chat .ai-chat-container {
  max-width: 800px;
  margin: 2rem auto;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  height: 600px;
}

/* Floating Widget Mode (Block) */
.ai-chat-widget-wrapper {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.ai-chat-widget-wrapper.ai-chat-page-root {
  position: static;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: auto;
}

.ai-chat-widget {
  width: 380px;
  height: 500px;
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  display: flex;
  flex-direction: column;
  background-color: #fff;
  overflow: hidden;

  /* Hidden state details override */
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ai-chat-widget.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  pointer-events: none;
  height: 0;
  /* Prevent layout issues */
  overflow: hidden;
}

/* Toggle Button */
.ai-chat-toggle-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #007bff;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background-color 0.2s;
  margin-top: 15px;
}

.ai-chat-toggle-btn:hover {
  background-color: #0056b3;
  transform: scale(1.05);
}

.ai-chat-toggle-btn svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.ai-chat-toggle-btn.hidden {
  display: none;
  /* Usually always visible, maybe different icon when open? */
}

/* Close/Minimize Button in Header */
.ai-chat-minimize-btn {
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
}

.ai-chat-minimize-btn:hover {
  color: #343a40;
}


/* --- Existing Styles Adjusted --- */

.ai-chat-header {
  padding: 1rem 1.25rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-chat-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #343a40;
  font-weight: 600;
}

.status-indicator {
  /* margin-right: auto; optional if next to title */
  margin-left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #28a745;
}

.ai-chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Messages */
.message {
  max-width: 85%;
}

.message.user-message {
  text-align: right;
}

.message-content {
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  color: #333333;
  /* Force dark text */
}

.message-content p {
  margin: 0;
  color: #333333;
  /* Ensure P tags inherit or have set color */
}

.message-time {
  font-size: 0.7rem;
  margin-top: 2px;
}

.message-time {
  font-size: 0.7rem;
  margin-top: 2px;
}

/* Input Area */
/* Input Area */
.ai-chat-input-area {
  padding: 15px;
  background-color: #fff;
  border-top: 1px solid #e9ecef;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: #f0f2f5;
  border-radius: 24px;
  padding: 5px 15px;
  transition: box-shadow 0.2s, background-color 0.2s;
}

.input-wrapper:focus-within {
  background-color: #fff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

#ai-chat-input {
  color: #000;
  box-sizing: border-box;
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  resize: none;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  max-height: 100px;
  line-height: 1.4;
  /* Reset height to allow auto-grow logic if needed, currently fixed 1 row */
}

#ai-chat-send-btn {
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  transition: transform 0.1s;
}

#ai-chat-send-btn:hover {
  background-color: rgba(0, 123, 255, 0.1);
}

#ai-chat-send-btn:active {
  transform: scale(0.95);
}

#ai-chat-send-btn:disabled {
  color: #adb5bd;
  cursor: default;
}

#ai-chat-send-btn:disabled:hover {
  background-color: transparent;
}

/* Typing Indicator */
.typing-indicator span {
  width: 5px;
  height: 5px;
  margin: 0 1px;
}