:root {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-light: #334155;
  --color-primary: #3b82f6;
  --color-primary-light: #60a5fa;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-border: #475569;
  
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.tagline {
  color: var(--color-text-muted);
  font-size: 1.1rem;
}

/* Privacy Banner */
.privacy-banner {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
  border: 1px solid var(--color-success);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.privacy-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.privacy-content h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--color-success);
}

.privacy-content ul {
  list-style: none;
  font-size: 0.95rem;
}

.privacy-content li {
  margin-bottom: 6px;
  padding-left: 20px;
  position: relative;
}

.privacy-content li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--color-success);
}

/* Loading */
.loading-section {
  text-align: center;
  padding: 48px 24px;
  background: var(--color-surface);
  border-radius: var(--radius);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--color-surface-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-detail {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* Input Section */
.input-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.input-section h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
}

.upload-area {
  position: relative;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 20px;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.05);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

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

.upload-placeholder p {
  color: var(--color-text);
  font-weight: 500;
}

.upload-hint {
  color: var(--color-text-muted) !important;
  font-size: 0.85rem;
  font-weight: 400 !important;
  margin-top: 8px;
}

.upload-preview {
  position: relative;
  display: inline-block;
}

.upload-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: var(--radius-sm);
  display: block;
}

.clear-btn {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 28px;
  height: 28px;
  background: var(--color-danger);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.height-input {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.height-input label {
  font-weight: 500;
}

.height-input input {
  background: var(--color-surface-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--color-text);
  font-size: 1rem;
  width: 120px;
}

.height-input input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.unit {
  color: var(--color-text-muted);
}

.analyze-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.analyze-btn:hover:not(:disabled) {
  background: var(--color-primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.analyze-btn:disabled {
  background: var(--color-surface-light);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Error Section */
.error-section {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.error-section h3 {
  color: var(--color-danger);
  margin-bottom: 8px;
}

.error-section p {
  color: var(--color-text-muted);
}

/* Results Section */
.results-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
}

.results-section h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
}

/* Confidence Banner */
.confidence-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--color-surface-light);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.confidence-meter {
  flex: 1;
  height: 8px;
  background: var(--color-bg);
  border-radius: 4px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background 0.3s;
}

.confidence-fill.high { background: var(--color-success); }
.confidence-fill.medium { background: var(--color-warning); }
.confidence-fill.low { background: var(--color-danger); }

.confidence-label {
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Measurements Grid */
.measurements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.measurement-card {
  background: var(--color-surface-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
}

.measurement-label {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.measurement-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text);
}

.measurement-range {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Size Recommendation */
.size-recommendation {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.size-recommendation h3 {
  font-size: 0.9rem;
  color: var(--color-primary-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.size-display {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.size-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-primary-light);
}

.size-confidence {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.size-explanation {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Learned Notice */
.learned-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-sm);
}

.learned-icon {
  font-size: 1.5rem;
}

.learned-notice p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.backend-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
}

.backend-info span {
  color: var(--color-primary-light);
  font-weight: 500;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 16px;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .measurements-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .size-value {
    font-size: 2rem;
  }
  
  .privacy-banner {
    flex-direction: column;
    text-align: center;
  }
}
