/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

header h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 300;
}

/* Input section */
.input-section {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  margin-bottom: 30px;
}

textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s ease;
  margin-bottom: 20px;
}

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

textarea::placeholder {
  color: #999;
  line-height: 1.5;
}

/* Buttons */
.primary-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Conversation thread */
.conversation-thread {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  margin-bottom: 30px;
  max-height: 500px;
  overflow-y: auto;
  min-height: 200px;
}

.message {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 8px;
  line-height: 1.5;
}

.message.user {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
}

.message.system {
  background: #f3e5f5;
  border-left: 4px solid #9c27b0;
}

.message.final {
  background: #e8f5e8;
  border-left: 4px solid #4caf50;
  font-size: 16px;
}

.message.error {
  background: #ffebee;
  border-left: 4px solid #f44336;
  color: #c62828;
}

/* Question section */
.question-section {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  margin-bottom: 30px;
  border: 2px solid #ff9800;
}

.question-header {
  margin-bottom: 25px;
}

.question-header h3 {
  color: #ff9800;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.question-header p {
  color: #666;
  font-size: 14px;
}

.current-question {
  margin-bottom: 20px;
}

.question-number {
  font-size: 14px;
  color: #ff9800;
  font-weight: 600;
  margin-bottom: 8px;
}

.question-text {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  background: #fff3e0;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #ff9800;
  line-height: 1.6;
}

.question-text strong {
  color: #ff9800;
  font-weight: 600;
  margin-right: 8px;
}

.question-text em {
  color: #666;
  font-style: italic;
  font-size: 14px;
}

.question-text br + strong {
  display: inline-block;
  margin-top: 8px;
  margin-bottom: 4px;
}

/* Better spacing for list items in questions */
.question-text br {
  line-height: 2;
}

.answer-section textarea {
  margin-bottom: 15px;
}

/* Loading indicator */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  margin-bottom: 30px;
  gap: 15px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading span {
  color: #666;
  font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  header h1 {
    font-size: 2.5rem;
  }
  
  header p {
    font-size: 1rem;
  }
  
  .input-section,
  .conversation-thread,
  .question-section {
    padding: 20px;
  }
  
  textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Scrollbar styling */
.conversation-thread::-webkit-scrollbar {
  width: 6px;
}

.conversation-thread::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.conversation-thread::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.conversation-thread::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animation for messages */
.message {
  animation: slideIn 0.3s ease-out;
}

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

/* Focus states for accessibility */
button:focus,
textarea:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  body {
    background: white;
  }
  
  .container {
    max-width: none;
    margin: 0;
    padding: 20px;
  }
  
  .input-section,
  .question-section,
  .loading {
    display: none;
  }
  
  .conversation-thread {
    box-shadow: none;
    border: 1px solid #ddd;
    max-height: none;
  }
}