/**
 * Conversational Intelligence UI Styles
 * Professional chat interface matching JORO design system
 */

.ci-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.ci-header {
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ci-header h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.ci-header p {
  margin: 0;
  font-size: 14px;
  color: #ffffff;
  opacity: 1;
}

.ci-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  overflow-x: auto;
}

.ci-prompt-btn {
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ci-prompt-btn:hover {
  background: #667eea;
  color: #ffffff;
  border-color: #667eea;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.ci-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #ffffff;
}

.ci-welcome-message {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.ci-welcome-message p {
  margin: 8px 0;
  font-size: 14px;
  line-height: 1.6;
}

.ci-message {
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease-in;
}

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

.ci-message-content {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.ci-message-user .ci-message-content {
  margin-left: auto;
  background: #667eea;
  color: #ffffff;
}

.ci-message-assistant .ci-message-content {
  background: #f3f4f6;
  color: #1f2937;
}

.ci-message-error .ci-message-content {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.ci-message-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  opacity: 0.8;
}

.ci-message-text {
  word-wrap: break-word;
}

.ci-message-text p {
  margin: 0 0 12px 0;
}

.ci-message-text p:last-child {
  margin-bottom: 0;
}

.ci-message-text ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ci-message-text li {
  margin: 4px 0;
}

.ci-message-text strong {
  font-weight: 600;
}

.ci-sources {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
  color: #6b7280;
}

.ci-sources strong {
  display: block;
  margin-bottom: 6px;
  color: #374151;
}

.ci-sources ul {
  margin: 0;
  padding-left: 20px;
}

.ci-sources li {
  margin: 4px 0;
}

.ci-followups {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.ci-followups strong {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: #374151;
}

.ci-followup-btn {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.ci-followup-btn:hover {
  background: #f9fafb;
  border-color: #667eea;
  color: #667eea;
}

.ci-input-container {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.ci-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  transition: border-color 0.2s;
}

.ci-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ci-send-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: #667eea;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.ci-send-btn:hover:not(:disabled) {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.ci-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ci-send-icon {
  font-size: 18px;
  font-weight: bold;
}

.ci-loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

@media (max-width: 768px) {
  .ci-prompts {
    padding: 12px;
  }

  .ci-prompt-btn {
    font-size: 12px;
    padding: 6px 12px;
  }

  .ci-message-content {
    max-width: 90%;
  }

  .ci-input-container {
    flex-direction: column;
    gap: 8px;
  }

  .ci-send-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .ci-header {
    padding: 16px;
  }

  .ci-header h3 {
    font-size: 16px;
  }

  .ci-header p {
    font-size: 13px;
  }

  .ci-messages {
    padding: 16px;
  }

  .ci-message-content {
    max-width: 95%;
    font-size: 13px;
  }
}
