/* CMCL RAG Chat Widget Styles */
/* Matches the CMCL navy/gold design system */

.cmcl-chat-widget {
  display: flex;
  flex-direction: column;
  height: 650px;
  max-height: 80vh;
  background: linear-gradient(180deg, rgba(12, 30, 61, 0.98) 0%, rgba(6, 18, 36, 0.99) 100%);
  border: 1px solid rgba(212, 168, 75, 0.3);
  border-radius: 12px;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.cmcl-chat-header {
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(212, 168, 75, 0.12) 0%, rgba(212, 168, 75, 0.04) 100%);
  border-bottom: 1px solid rgba(212, 168, 75, 0.3);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cmcl-chat-header-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #d4a84b 0%, #b8923d 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cmcl-chat-header-icon svg {
  width: 24px;
  height: 24px;
  color: #0a1628;
}

.cmcl-chat-header-text h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #d4a84b;
  margin: 0 0 0.2rem 0;
}

.cmcl-chat-header-text p {
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0;
}

.cmcl-chat-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sample Questions Sidebar */
.cmcl-sample-questions {
  width: 280px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.cmcl-category {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cmcl-category-header {
  padding: 0.9rem 1.1rem;
  font-family: 'Oswald', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  user-select: none;
}

.cmcl-category-header:hover {
  background: rgba(212, 168, 75, 0.1);
}

.cmcl-category-header.active {
  color: #d4a84b;
  background: rgba(212, 168, 75, 0.08);
}

.cmcl-expand-icon {
  font-size: 1.1rem;
  opacity: 0.6;
}

.cmcl-category-questions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.cmcl-category-questions.expanded {
  max-height: 300px;
}

.cmcl-question-btn {
  width: 100%;
  padding: 0.7rem 1.1rem 0.7rem 1.75rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.45;
}

.cmcl-question-btn:hover {
  background: rgba(212, 168, 75, 0.15);
  color: #d4a84b;
}

/* Messages Area */
.cmcl-messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

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

.cmcl-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 2rem;
  opacity: 0.6;
}

.cmcl-empty-state svg {
  width: 56px;
  height: 56px;
  margin-bottom: 1rem;
  color: #d4a84b;
  opacity: 0.5;
}

.cmcl-empty-state p {
  font-size: 1.05rem;
  margin: 0;
}

.cmcl-empty-state span {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: block;
}

/* Messages */
.cmcl-message {
  max-width: 85%;
  padding: 0.9rem 1.15rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.65;
  word-wrap: break-word;
}

.cmcl-message.cmcl-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #d4a84b 0%, #b8923d 100%);
  color: #0a1628;
  border-bottom-right-radius: 4px;
}

.cmcl-message.cmcl-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
}

/* Message content formatting */
.cmcl-message.cmcl-assistant p {
  margin: 0 0 0.75rem 0;
}

.cmcl-message.cmcl-assistant p:last-child {
  margin-bottom: 0;
}

.cmcl-message.cmcl-assistant strong {
  color: #d4a84b;
  font-weight: 600;
}

.cmcl-bullet {
  color: #d4a84b;
  font-weight: bold;
  margin-right: 0.25rem;
}

.cmcl-number {
  color: #d4a84b;
  font-weight: 600;
  margin-right: 0.25rem;
}

.cmcl-message.cmcl-assistant ul,
.cmcl-message.cmcl-assistant ol {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.cmcl-message.cmcl-assistant li {
  margin-bottom: 0.35rem;
}

/* Disclaimer and Sources Section */
.cmcl-disclaimer-sources {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cmcl-disclaimer {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem;
  background: rgba(212, 168, 75, 0.1);
  border: 1px solid rgba(212, 168, 75, 0.25);
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.cmcl-disclaimer-icon {
  flex-shrink: 0;
  color: #d4a84b;
}

.cmcl-disclaimer-icon svg {
  width: 18px;
  height: 18px;
}

.cmcl-disclaimer-text {
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.8);
}

.cmcl-disclaimer-text strong {
  color: #d4a84b;
}

.cmcl-sources-section {
  margin-top: 0.5rem;
}

.cmcl-sources-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #d4a84b;
  margin-bottom: 0.5rem;
}

/* Legacy toggle styles - kept for backwards compatibility */
.cmcl-sources-toggle {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cmcl-sources-btn {
  background: transparent;
  border: 1px solid rgba(212, 168, 75, 0.4);
  color: #d4a84b;
  padding: 0.45rem 0.9rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cmcl-sources-btn:hover {
  background: rgba(212, 168, 75, 0.15);
  border-color: #d4a84b;
}

.cmcl-sources-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cmcl-source-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.75rem;
}

.cmcl-source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.cmcl-source-file {
  font-size: 0.8rem;
  font-weight: 600;
  color: #d4a84b;
}

.cmcl-source-link {
  text-decoration: none;
  transition: all 0.2s ease;
}

.cmcl-source-link:hover {
  color: #f0c66b;
  text-decoration: underline;
}

.cmcl-source-match {
  font-size: 0.7rem;
  background: rgba(74, 154, 110, 0.25);
  color: #7dd3a0;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
}

.cmcl-source-content {
  font-size: 0.8rem;
  opacity: 0.7;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Loading */
.cmcl-loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.15rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.cmcl-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(212, 168, 75, 0.25);
  border-top-color: #d4a84b;
  border-radius: 50%;
  animation: cmcl-spin 1s linear infinite;
}

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

/* Input Area */
.cmcl-input-area {
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.cmcl-input-row {
  display: flex;
  gap: 0.75rem;
}

.cmcl-input-row textarea {
  flex: 1;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  resize: none;
  min-height: 48px;
  max-height: 100px;
  line-height: 1.4;
}

.cmcl-input-row textarea:focus {
  outline: none;
  border-color: #d4a84b;
  background: rgba(255, 255, 255, 0.08);
}

.cmcl-input-row textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.cmcl-send-btn {
  padding: 0 1.35rem;
  background: linear-gradient(135deg, #d4a84b 0%, #b8923d 100%);
  border: none;
  border-radius: 8px;
  color: #0a1628;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cmcl-send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 168, 75, 0.4);
}

.cmcl-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cmcl-send-btn svg {
  width: 22px;
  height: 22px;
}

/* Mobile Responsive */
@media (max-width: 900px) {
  .cmcl-chat-widget {
    height: 550px;
  }

  .cmcl-sample-questions {
    display: none;
  }
}

@media (max-width: 600px) {
  .cmcl-chat-widget {
    height: 500px;
    border-radius: 8px;
  }

  .cmcl-chat-header {
    padding: 1rem;
  }

  .cmcl-chat-header-icon {
    width: 38px;
    height: 38px;
  }

  .cmcl-chat-header-text h2 {
    font-size: 1rem;
  }

  .cmcl-messages {
    padding: 1rem;
  }

  .cmcl-message {
    max-width: 90%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  .cmcl-input-area {
    padding: 0.75rem 1rem;
  }
}

/* Scrollbar styling */
.cmcl-messages::-webkit-scrollbar,
.cmcl-sample-questions::-webkit-scrollbar {
  width: 6px;
}

.cmcl-messages::-webkit-scrollbar-track,
.cmcl-sample-questions::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.cmcl-messages::-webkit-scrollbar-thumb,
.cmcl-sample-questions::-webkit-scrollbar-thumb {
  background: rgba(212, 168, 75, 0.3);
  border-radius: 3px;
}

.cmcl-messages::-webkit-scrollbar-thumb:hover,
.cmcl-sample-questions::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 168, 75, 0.5);
}
