:root {
  color-scheme: light;
  font-family: Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f4f6;
  color: #1f2937;
}

.container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 16px;
}

.header h1 {
  margin: 0 0 8px;
}

.subtitle {
  margin: 0 0 24px;
  color: #4b5563;
  line-height: 1.5;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.split-screen {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.panel h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.preview-frame {
  min-height: 300px;
  border: 2px dashed #c7d2fe;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.preview-frame img {
  max-width: 100%;
  max-height: 480px;
  border-radius: 8px;
  display: none;
}

.preview-frame.has-image img {
  display: block;
}

.preview-frame p {
  margin: 0;
  color: #6b7280;
}

.preview-frame.has-image p {
  display: none;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.panel-actions input[type="file"] {
  display: none;
}

.file-button,
.panel-actions button {
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.file-button:hover,
.panel-actions button:hover {
  background: #1d4ed8;
}

.panel-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.camera-feed {
  width: 100%;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  display: none;
  background: #111827;
}

.camera-feed.active {
  display: block;
}

.vinted-picker {
  margin-top: 16px;
  border-top: 1px solid #e5e7eb;
  padding-top: 14px;
}

.vinted-picker h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.vinted-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.vinted-controls label {
  grid-column: 1 / -1;
  font-size: 13px;
  color: #374151;
}

#vinted-status {
  margin: 10px 0;
  color: #4b5563;
  font-size: 13px;
}

.vinted-gallery {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.vinted-empty {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.vinted-item {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 8px;
  background: #f8fbff;
}

.vinted-item img {
  width: 100%;
  border-radius: 8px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}

.vinted-item-title {
  margin: 8px 0 4px;
  font-size: 13px;
  color: #111827;
  line-height: 1.35;
}

.vinted-item-meta {
  margin: 0 0 8px;
  font-size: 12px;
  color: #4b5563;
}

.vinted-item button {
  width: 100%;
  padding: 8px;
  font-size: 12px;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.controls label {
  font-size: 14px;
  color: #374151;
}

#garment-type,
#output-aspect-ratio,
#background-preservation,
#style-prompt,
#vinted-category {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

#change-strength {
  width: 100%;
}

#change-strength-value {
  color: #4b5563;
}

button {
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

button.active {
  background: #1e40af;
}

#generation-status {
  margin: 0;
  color: #4b5563;
}

.result button {
  margin-top: 12px;
}

.history h2 {
  margin-top: 0;
  margin-bottom: 10px;
}

#history-placeholder {
  margin: 0 0 12px;
  color: #6b7280;
}

.history-gallery {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.history-item {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  padding: 10px;
  background: #f8fbff;
}

.history-item img {
  width: 100%;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

.history-item p {
  margin: 8px 0;
  font-size: 13px;
  color: #374151;
}

.history-item button {
  width: 100%;
}

.status h2 {
  margin-top: 0;
  margin-bottom: 6px;
}

.status p {
  margin: 0;
}

.generation-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-in-out;
  z-index: 1000;
}

.generation-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.generation-loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
}

.generation-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: generation-spin 0.8s linear infinite;
}

.generation-loader-text {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

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

@media (max-width: 900px) {
  .split-screen {
    grid-template-columns: 1fr;
  }

  .vinted-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}
