/* -- Reset & base ---------------------------------------------------------- */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1a1a1a;
  background: #f5f5f0;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* -- Header ---------------------------------------------------------------- */

header {
  padding: 1rem 2rem;
  border-bottom: 1px solid #e0ddd8;
  background: #fff;
}

.logo {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* -- Main ------------------------------------------------------------------ */

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* -- Upload page ----------------------------------------------------------- */

.upload-page {
  max-width: 540px;
  margin: 4rem auto;
  text-align: center;
}

.upload-page h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.subtitle {
  color: #666;
  margin: 0.5rem 0 2rem;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* -- Drop zone ------------------------------------------------------------- */

.drop-zone {
  position: relative;
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 3rem 2rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fff;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #888;
  background: #fafaf6;
}

.drop-zone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #888;
}

.drop-zone input[type="file"] {
  display: none;
}

.drop-zone-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.drop-zone-preview img {
  max-height: 200px;
  max-width: 100%;
  border-radius: 8px;
  object-fit: contain;
}

.drop-zone-preview span {
  font-size: 0.875rem;
  color: #666;
}

/* -- Product selector ------------------------------------------------------ */

.product-selector {
  border: none;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.product-selector legend {
  width: 100%;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  margin-bottom: 0.5rem;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fff;
  font-weight: 500;
}

.radio-card:has(input:checked) {
  border-color: #1a1a1a;
  background: #1a1a1a;
  color: #fff;
}

.radio-card input { display: none; }

/* -- Button ---------------------------------------------------------------- */

.btn-primary {
  padding: 0.75rem 2rem;
  border: none;
  border-radius: 8px;
  background: #1a1a1a;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.85;
}

/* -- Mockups page: toolbar ------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e0ddd8;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-back {
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  padding: 0.375rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: background 0.15s;
}

.btn-back:hover { background: #eee; }

.product-toggle {
  display: flex;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.toggle-btn {
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}

.toggle-btn.active {
  background: #1a1a1a;
  color: #fff;
}

.toggle-btn:not(.active):hover {
  background: #f0f0ec;
}

.mockup-count {
  font-size: 0.8125rem;
  color: #999;
}

/* -- Control group (frame / ppt) ------------------------------------------ */

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #666;
  white-space: nowrap;
}

.control-group select {
  padding: 0.375rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.8125rem;
  background: #fff;
}

/* -- Frame swatches -------------------------------------------------------- */

.frame-swatches {
  display: flex;
  gap: 4px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s;
}

.swatch.active {
  border-color: #1a1a1a;
}

.swatch-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}

.dot-black      { background: #222; }
.dot-blue       { background: #2d5a8e; }
.dot-darkoak    { background: #5c3a1e; }
.dot-green      { background: #2e5f3f; }
.dot-grey       { background: #888; }
.dot-lilac      { background: #bdb4db; }
.dot-mint       { background: #7ec8a4; }
.dot-oak        { background: #c49a5c; }
.dot-orange     { background: #e07020; }
.dot-petroleum  { background: #2a5a5e; }
.dot-pink       { background: #d4a0a0; }
.dot-red        { background: #951c1c; }
.dot-white      { background: #f5f5f5; }
.dot-yellow     { background: #f0d040; }

/* -- Filters --------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.filter-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pill {
  padding: 0.25rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 100px;
  font-size: 0.8125rem;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.pill:hover {
  background: #f0f0ec;
}

.pill.active {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* -- Grid ------------------------------------------------------------------ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e8e5e0;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.card[hidden] { display: none; }

.card-img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #eee;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.card-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.6);
}

.card-spinner::after {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid #ddd;
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.card-spinner[hidden] { display: none; }

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

.card-meta {
  padding: 0.625rem 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: #888;
}

.meta-room {
  font-weight: 600;
  color: #444;
  text-transform: capitalize;
}

.meta-style {
  text-transform: capitalize;
}

/* -- Empty state ----------------------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #888;
}

/* -- Responsive ------------------------------------------------------------ */

@media (max-width: 640px) {
  main { padding: 1rem; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .upload-page { margin: 2rem auto; }
}
