/**
 * AI Lawyer Styles
 *
 * This stylesheet contains all styles for the AI Lawyer module.
 *
 * Styling Strategy:
 * 1. PRIORITIZE using existing classes from /styles/components.css
 * 2. Only add custom styles when components.css doesn't cover the use case
 * 3. Follow existing HTJZ design system and patterns
 *
 * Components Styled:
 * - Conversation Hub (Component 1):
 *   - Past conversations list
 *   - "Start New Conversation" button
 *   - Empty state
 *
 * - Chat Interface (Component 2):
 *   - Message bubbles (user vs assistant)
 *   - Starter hint cards
 *   - Message input and send button
 *   - Typing indicator
 *   - Skeleton loaders
 *   - Error states and retry buttons
 *
 * Responsive: Mobile-first approach with breakpoints for tablet and desktop
 */

/* CHAT INTERFACE */
/* Container */
.htjz-chat-shell {
  max-width: 1100px;
  margin: 32px auto;
  border-radius: 8px;
  padding: 24px;
  background: white;
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
  border: 1px solid #0d1f2e24;
}

/* Big title */
.htjz-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0;
  background: #0d1f2e;
  border-radius: 8px;
  border: 1px solid #0d1f2e24;
  padding: 8px;
}

.htjz-back-btn {
  color: #0f1724;
  font-size: 14px;
  font-weight: 600;
}

/* .htjz-back-btn:hover {
  background: #e0eff9;
  color: #0b6aa3;
} */

.htjz-bot-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.htjz-chat-title {
  font-size: 28px;
  font-weight: 600;
  color: #ffffff;
}

/* Main chat card */
.htjz-chat-card {
  background: #f2f6f9;
  border: 1px solid #0d1f2e24;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

/* Loading overlay */
.htjz-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  gap: 16px;
}

.htjz-loading-overlay.hidden {
  display: none;
}

/* Spinner */
.htjz-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #0b6aa3;
  border-radius: 50%;
  animation: htjz-spin 0.8s linear infinite;
}

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

.htjz-loading-text {
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
}

/* Chat viewport */
.htjz-chat-viewport {
  min-height: 400px;
  max-height: 520px;
  overflow: auto;
  padding: 16px 8px;
}

/* System intro list */
.htjz-system-list {
  background: #f7fbfc;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  color: #334155;
  font-size: 14px;
}

.htjz-system-list .item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.htjz-system-list .item:last-child {
  margin-bottom: 0;
}

.htjz-system-list .ico {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
}

.htjz-ico-success {
  background: #16a34a;
}

.htjz-ico-note {
  background: #f97316;
}

.htjz-ico-ready {
  background: #94a3b8;
}

/* Empty message area placeholder */
.htjz-empty-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  color: #94a3b8;
  font-size: 14px;
  border-radius: 8px;
  background: transparent;
}

/* Suggestion panel */
.htjz-suggestions {
  margin: 8px;
  border-radius: 8px;
  padding: 16px;
  background: #e0eff9;
}

.htjz-suggestions h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #0f1724;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.htjz-suggest-pill {
  margin-right: 4px;
  display: inline-block;
  background: #f3f7f8;
  border-radius: 8px;
  padding: 8px 16px;
  color: #0f1724;
  cursor: pointer;
  border: 1px solid #0d1f2e24;
  font-size: 14px;
}

/* Input row */
.htjz-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.htjz_input {
  width: 100%;
  padding: 10px;
  border: 1px solid #0d1f2e24;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  font-size: 13px;
  transition: all 0.2s linear;
}
.htjz-input-card {
  background: #f2f6f9;
  border: 1px solid #0d1f2e24;
  border-radius: 8px;
  padding: 8px;
  margin-top: 16px;
}

.htjz-attach-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid #0d1f2e24;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #334155;
  position: relative;
  overflow: hidden;
}

.htjz-attach-btn img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.htjz-attach-btn input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  top: 0;
  left: 0;
}

.htjz-send-btn {
  background: #4f7a2f;
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.htjz-send-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Hover states */
.htjz-send-btn:hover,
.htjz-attach-btn:hover,
.htjz-suggest-pill:hover,
.htjz_button:hover {
  background-color: #b4d2e7;
  color: #0d1f2e;
}

/* File attachment preview */
.htjz-file-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f3f7f8;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: #334155;
}

.htjz-file-preview .file-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.htjz-file-preview .remove-file {
  cursor: pointer;
  color: #ef4444;
  font-weight: bold;
}

/* Message bubbles */
.htjz-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.htjz-msg {
  max-width: 74%;
  padding: 8px 16px;
  border-radius: 8px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.htjz-msg.user {
  margin-left: auto;
  background: #b4d2e7;
  border-bottom-right-radius: 6px;
}

.htjz-msg.ai {
  background: #ffffff;
  color: #082635;
  border-bottom-left-radius: 6px;
}

.htjz-load-more-btn {
  margin: 0 auto 12px auto;
  padding: 8px 16px;
  background: none;
  box-shadow: none;
  color: #082635;
  text-decoration: underline;
}

.htjz-load-more-btn:hover {
  background: none;
  box-shadow: none;
  color: #082635;
}

.htjz-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Typing indicator */
.htjz-typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f2f6f9;
  border-radius: 8px;
  border-bottom-left-radius: 6px;
  max-width: 74px;
}

.htjz-typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: htjz-typing-bounce 1.4s infinite ease-in-out;
}

.htjz-typing-indicator .dot:nth-child(1) {
  animation-delay: 0s;
}

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

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

@keyframes htjz-typing-bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Chat title editing */
.htjz-chat-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.htjz-chat-title {
  flex: 1;
  outline: none;
  border-radius: 8px;
  padding: 4px 8px;
  transition: background 0.2s;
  cursor: text;
}

.htjz-chat-title:hover {
  background: rgba(180, 210, 231, 0.1);
}

.htjz-chat-title:focus {
  background: rgba(180, 210, 231, 0.2);
}

.htjz-chat-title:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  font-weight: 400;
}

.htjz-edit-title-btn {
  width: 40px;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-size: 16px;
  transition: opacity 0.2s, background 0.2s;
}

.htjz-chat-title-wrapper:hover .htjz-edit-title-btn {
  opacity: 1;
}

.htjz-edit-title-btn:hover {
  background: rgba(180, 210, 231, 0.3);
}

/* Responsive */
@media (max-width: 720px) {
  .htjz-chat-title {
    font-size: 22px;
  }
  .htjz-chat-viewport {
    max-height: 360px;
  }
}

.prompt-category-filters {
  justify-content: center;
}

.htjz-conversations {
  margin-bottom: 50px;
}

.htjz-conversation-title {
  font-weight: 600;
  font-size: 15px;
  color: #0d1f2e;
}
