/* ────────────────────────────────────────────
   RESET & BASE
──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f0f2f5;
  --surface:     #ffffff;
  --border:      #e2e6ea;
  --primary:     #6c63ff;
  --primary-dk:  #5a52e0;
  --success:     #27ae60;
  --danger:      #e74c3c;
  --text:        #1a1a2e;
  --muted:       #6b7280;
  --radius:      14px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.07);
  --shadow-md:   0 6px 24px rgba(0,0,0,.10);
}

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

/* ────────────────────────────────────────────
   HEADER
──────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, #6c63ff 0%, #a855f7 100%);
  color: white;
  padding: 36px 24px 32px;
  text-align: center;
}
.header-inner { max-width: 960px; margin: 0 auto; }
.logo-icon { font-size: 2rem; display: block; margin-bottom: 6px; opacity: .85; }
.header h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.5px; }
.subtitle  { margin-top: 6px; opacity: .82; font-size: .95rem; }

/* ────────────────────────────────────────────
   MAIN LAYOUT
──────────────────────────────────────────── */
.main {
  max-width: 1060px;
  margin: 32px auto 60px;
  padding: 0 18px;
}

#genForm {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}

@media (max-width: 780px) {
  #genForm { grid-template-columns: 1fr; }
}

.right-col { display: flex; flex-direction: column; gap: 18px; }

/* ────────────────────────────────────────────
   CARDS
──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow-sm);
}
.card--design { background: #fafafa; }

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.badge {
  font-size: .7rem;
  font-weight: 600;
  background: #f1f0ff;
  color: var(--primary);
  border-radius: 20px;
  padding: 2px 8px;
  margin-left: 4px;
}

/* ────────────────────────────────────────────
   DROP ZONES
──────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #fafbff;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
  padding: 28px 18px;
  position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #f1f0ff;
}
.drop-zone--sm { padding: 16px 18px; margin-top: 14px; }

.drop-content svg {
  width: 38px; height: 38px;
  color: var(--primary);
  margin-bottom: 8px;
}
.drop-zone--sm .drop-content svg { width: 26px; height: 26px; }

.drop-content p { color: var(--muted); font-size: .9rem; }
.drop-content .hint { font-size: .78rem; margin-top: 3px; color: #9ca3af; }

/* ────────────────────────────────────────────
   PREVIEW GRID
──────────────────────────────────────────── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.preview-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  box-shadow: var(--shadow-sm);
}
.preview-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.preview-thumb .remove-btn {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  color: white;
  border: none;
  font-size: .7rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.preview-single img {
  margin-top: 10px;
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border);
}

/* ────────────────────────────────────────────
   FIELDS
──────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.field label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.field input[type="text"],
.field input[type="number"] {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 9px 13px;
  font-size: .95rem;
  color: var(--text);
  background: white;
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
  outline: none;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,.15);
}

.field-row {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}

/* Color pickers */
.field--color { flex: unset; min-width: 0; }
.field--color label { font-size: .72rem; text-align: center; }
.field--color input[type="color"] {
  width: 52px; height: 42px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  padding: 3px;
  cursor: pointer;
  background: white;
}

/* ────────────────────────────────────────────
   COLOR BUILDER
──────────────────────────────────────────── */
.color-builder { display: flex; flex-direction: column; gap: 12px; }

.color-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f5;
  border-radius: 30px;
  padding: 5px 10px 5px 6px;
}
.color-item .swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}
.color-item input[type="color"] {
  width: 26px; height: 26px;
  border: none; padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
}
.color-item .color-label {
  font-size: .82rem;
  color: var(--muted);
  min-width: 64px;
}
.color-item .remove-color {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  font-size: .85rem;
  padding: 0 2px;
  line-height: 1;
}
.color-item .remove-color:hover { color: var(--danger); }

.btn-add-color {
  align-self: flex-start;
  background: #f1f0ff;
  color: var(--primary);
  border: 1.5px solid #d6d3ff;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-add-color:hover { background: #e8e6ff; }

/* ────────────────────────────────────────────
   BOTÓN GENERAR
──────────────────────────────────────────── */
.btn-generate {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #a855f7 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(108,99,255,.35);
}
.btn-generate:hover  { opacity: .92; transform: translateY(-1px); }
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ────────────────────────────────────────────
   SPINNER
──────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ────────────────────────────────────────────
   RESULTADO
──────────────────────────────────────────── */
.result {
  margin-top: 36px;
  text-align: center;
}
.result-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 20px;
}
.result-img-wrap {
  display: inline-block;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  max-width: 680px;
  width: 100%;
}
.result-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
}
.result-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
}
.btn-download {
  background: var(--success);
  color: white;
  text-decoration: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-weight: 700;
  font-size: .97rem;
  transition: opacity .2s;
}
.btn-download:hover { opacity: .88; }
.btn-new {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 12px 28px;
  font-weight: 700;
  font-size: .97rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-new:hover { background: #f1f0ff; }

/* ────────────────────────────────────────────
   ERROR BOX
──────────────────────────────────────────── */
.error-box {
  margin-top: 20px;
  background: #fff5f5;
  border: 1.5px solid #fecdd3;
  border-radius: 10px;
  padding: 14px 18px;
  color: var(--danger);
  font-weight: 600;
  text-align: center;
}
