* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

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

.subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 1.1rem;
  line-height: 1.5;
}

form {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.dropzone {
  border: 3px dashed #ddd;
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
  position: relative;
  min-height: 200px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: #667eea;
  background: #f8f9ff;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.image-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.image-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
  color: #666;
}

.remove-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.3s ease;
}

.remove-btn:hover {
  background: #dc2626;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.dropzone p {
  color: #666;
  font-size: 1.1rem;
}

button {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.result {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.result h2 {
  color: #333;
  margin-bottom: 20px;
  text-align: center;
  font-size: 2rem;
}

.analysis-section {
  margin-bottom: 30px;
  padding: 20px;
  border-radius: 15px;
  border: 1px solid #e5e7eb;
}

.roboflow-section {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-color: #0ea5e9;
}

.gpt-section {
  background: linear-gradient(135deg, #fdf4ff, #f3e8ff);
  border-color: #a855f7;
}

.analysis-section h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.analysis-section h4 {
  color: #555;
  margin: 15px 0 10px 0;
  font-size: 1.1rem;
}

.summary {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: 500;
}

.summary.healthy {
  background: #d1fae5;
  color: #065f46;
}

.summary.monitor {
  background: #fef3c7;
  color: #92400e;
}

.summary.needs_attention {
  background: #fed7d7;
  color: #c53030;
}

.summary.urgent {
  background: #fed7d7;
  color: #c53030;
  font-weight: 600;
}

.scorebar { 
  width: 100%; 
  height: 16px; 
  background: #1f2937; 
  border-radius: 999px; 
  overflow: hidden; 
  position: relative;
  margin: 20px 0;
}

.scorebar > div { 
  height: 100%; 
  background: linear-gradient(90deg, #ef4444, #f59e0b, #22c55e);
  transition: width 0.8s ease;
}

.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.labels-section {
  margin-top: 20px;
}

.labels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.7);
  border-radius: 8px;
  font-size: 0.9rem;
}

.pill {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.pill.healthy {
  background: #d1fae5;
  color: #065f46;
}

.pill.monitor {
  background: #fef3c7;
  color: #92400e;
}

.pill.needs_attention {
  background: #fed7d7;
  color: #c53030;
}

.pill.urgent {
  background: #fed7d7;
  color: #c53030;
}

.name {
  font-weight: 500;
  flex: 1;
}

.confidence {
  color: #666;
  font-size: 0.8rem;
}

.score {
  color: #333;
  font-weight: 600;
}

/* GPT Analysis Styles */
.gpt-score {
  margin: 15px 0;
}

.gpt-score-bar {
  width: 100%;
  height: 12px;
  background: #1f2937;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.gpt-score-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.8s ease;
}

.gpt-summary, .gpt-detail {
  margin: 15px 0;
  padding: 12px;
  background: rgba(255,255,255,0.5);
  border-radius: 8px;
  line-height: 1.5;
}

.gpt-recommendations, .gpt-warnings {
  margin: 15px 0;
  padding: 12px;
  border-radius: 8px;
}

.gpt-recommendations {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.gpt-warnings {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.gpt-recommendations ul, .gpt-warnings ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.gpt-recommendations li, .gpt-warnings li {
  margin: 4px 0;
  line-height: 1.4;
}

.methods-info {
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  color: #666;
  font-size: 0.9rem;
}

/* Chat Interface Styles */
.chat-section {
  background: white;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  margin-top: 30px;
}

.chat-section h3 {
  color: #333;
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 400px;
  border: 2px solid #e5e7eb;
  border-radius: 15px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 15px;
  word-wrap: break-word;
}

.user-message {
  align-self: flex-end;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  margin-left: auto;
}

.assistant-message {
  align-self: flex-start;
  background: white;
  color: #333;
  border: 1px solid #e5e7eb;
  margin-right: auto;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

.message-icon {
  font-size: 1.1rem;
}

.message-name {
  opacity: 0.9;
}

.message-content {
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-input-container {
  display: flex;
  gap: 10px;
  padding: 15px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.chat-input-container input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 25px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.chat-input-container input:focus {
  border-color: #667eea;
}

.chat-input-container button {
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.chat-input-container button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.chat-input-container button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.clear-btn {
  background: #ef4444 !important;
}

.clear-btn:hover:not(:disabled) {
  background: #dc2626 !important;
}

.chat-message.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.chat-message.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* Scrollbar styling for chat */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.error {
  color: #dc2626;
  text-align: center;
  padding: 20px;
  background: #fef2f2;
  border-radius: 10px;
  border: 1px solid #fecaca;
}
