/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
}

/* Container Layout — 60/40 split */
.container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.chat-area {
  flex: 1.5; /* 60% */
  background: white;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e0e0;
  overflow: hidden;
}

.input-sidebar {
  flex: 1; /* 40% */
  background: #fafafa;
  overflow-y: auto;
  padding: 1.5rem;
  border-left: 1px solid #e0e0e0;
}

/* Chat Header */
.chat-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5aa0 100%);
  color: white;
}

.chat-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.chat-header p {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Chat Messages Container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  margin-bottom: 1rem;
  animation: slideIn 0.3s ease-out;
}

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

.message.user-message {
  justify-content: flex-end;
}

.message.bot-message {
  justify-content: flex-start;
}

.message-content {
  max-width: 85%;
  padding: 1rem;
  border-radius: 0.75rem;
  word-wrap: break-word;
  line-height: 1.5;
}

.user-message .message-content {
  background: #2c5aa0;
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.bot-message .message-content {
  background: #e8f4f8;
  color: #333;
  border-bottom-left-radius: 0.25rem;
}

.message-content p {
  margin-bottom: 0.5rem;
}

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

.message-content strong {
  font-weight: 600;
}

/* Treatment Response Block */
.treatment-response {
  background: #f0f9ff;
  border-left: 4px solid #2c5aa0;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

.treatment-response h3 {
  color: #1e3a5f;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.treatment-response .step-badge {
  display: inline-block;
  background: #2c5aa0;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.treatment-section {
  margin-bottom: 1rem;
}

.treatment-section-title {
  font-weight: 600;
  color: #1e3a5f;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.treatment-section-content {
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #555;
}

.warnings {
  background: #fff3cd;
  border-left: 4px solid #ff9800;
  padding: 0.75rem;
  border-radius: 0.25rem;
  margin-top: 0.75rem;
}

.warnings-title {
  font-weight: 600;
  color: #cc7700;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.warnings-content {
  font-size: 0.85rem;
  color: #666;
  white-space: pre-wrap;
}

/* Chat Input Area */
.chat-input-area {
  padding: 1rem;
  border-top: 1px solid #e0e0e0;
  background: white;
}

.clear-btn {
  width: 100%;
  padding: 0.75rem;
  background: #e0e0e0;
  color: #333;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.clear-btn:active {
  background: #d0d0d0;
}

/* Sidebar Form */
.input-sidebar h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: #1e3a5f;
}

.form-group {
  margin-bottom: 1.75rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: #1e3a5f;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.severity-badge {
  display: inline-block;
  background: #e0e7ff;
  color: #2c5aa0;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Slider */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #d0d0d0;
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 0.5rem;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2c5aa0;
  cursor: pointer;
  transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:active {
  background: #1e3a5f;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2c5aa0;
  cursor: pointer;
  border: none;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 0.5rem;
}

.hint {
  font-size: 0.8rem;
  color: #999;
  margin-top: 0.5rem;
}

/* Toggle Group */
.toggle-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.toggle-btn {
  flex: 1;
  padding: 0.75rem;
  background: white;
  border: 2px solid #d0d0d0;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  color: #666;
  transition: all 0.2s;
  min-height: 2.75rem; /* h-11 */
}

.toggle-btn.active {
  background: #2c5aa0;
  color: white;
  border-color: #2c5aa0;
}

.toggle-btn:active {
  opacity: 0.8;
}

/* Number Input */
input[type="number"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #d0d0d0;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
  min-height: 2.75rem; /* h-11 */
}

input[type="number"]:focus {
  outline: none;
  border-color: #2c5aa0;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background 0.2s;
  font-size: 0.9rem;
  min-height: 2.75rem; /* h-11 */
  gap: 0.75rem;
}

.checkbox-label:hover {
  background: #f0f0f0;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-label span {
  flex: 1;
  user-select: none;
}

/* Submit Button */
.submit-btn {
  width: 100%;
  padding: 0.875rem;
  background: #2c5aa0;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
  min-height: 2.75rem; /* h-11 */
}

.submit-btn:active {
  background: #1e3a5f;
}

.submit-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1rem;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #d0d0d0;
  border-top-color: #2c5aa0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-spinner p {
  font-size: 0.85rem;
  color: #999;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar,
.input-sidebar::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.input-sidebar::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.chat-messages::-webkit-scrollbar-thumb,
.input-sidebar::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.input-sidebar::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Responsive — Tablet/Mobile Breakpoint (< 1024px) */
@media (max-width: 1023px) {
  .container {
    flex-direction: column;
  }

  .chat-area {
    flex: 1;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }

  .input-sidebar {
    flex: 0;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid #e0e0e0;
  }

  .message-content {
    max-width: 95%;
  }

  .toggle-btn,
  .submit-btn,
  input[type="number"],
  .checkbox-label {
    min-height: 2.75rem; /* h-11 */
  }
}

/* Mobile Specific (<768px) */
@media (max-width: 767px) {
  .chat-header h1 {
    font-size: 1.25rem;
  }

  .chat-header p {
    font-size: 0.8rem;
  }

  .message-content {
    font-size: 0.9rem;
  }

  .input-sidebar {
    padding: 1rem;
  }

  .input-sidebar h2 {
    font-size: 1.1rem;
  }

  .form-group {
    margin-bottom: 1.25rem;
  }
}
