/* Diseña con IA: foto del cliente + material LUSSO → imagen generada (disena.php) */
/* Página con scroll normal del documento: style.css bloquea el scroll (overflow
   hidden y overscroll-behavior none en html y body) para las escenas 3D. Si body
   tuviera scroll propio, la rueda no llegaría a la página. */
html:has(.disena-page) { height: auto; overflow-y: auto; overscroll-behavior: auto; }
.disena-page { height: auto; min-height: 100%; overflow: visible; overscroll-behavior: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Barra superior igual a la de los renders 360° (css/kitchen.css), sobre la
   de css/style.css que usa el resto de esta página */
.disena-page .topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: #1b1b1b;
  color: #fff;
  pointer-events: auto;
}
.disena-page .logo { height: 26px; width: auto; padding: 0; background: none; border: 0; border-radius: 0; backdrop-filter: none; }
.disena-page .topbar-title {
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.disena-page .top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-link {
  padding: 8px 12px;
  border: 0;
  background: none;
  color: #e9e9e6;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
}
.top-link:hover { background: rgba(255, 255, 255, 0.08); }
.top-link svg { display: block; width: 18px; height: 18px; }
.top-link .only-mobile { display: none; }
.top-cta {
  margin-left: 6px;
  padding: 10px 18px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  border-radius: 3px;
}
.top-cta:hover { background: #5f9520; }

.studio {
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 76px 16px 24px;
  min-height: 100vh;
}

/* ---------- Formulario ---------- */
.studio-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.studio-intro h1 { margin: 0 0 6px; font-size: 22px; font-weight: 600; line-height: 1.25; }
.studio-intro p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.step {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.step h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; }
.step h2 small { font-weight: 400; font-size: 12px; }
.step h2 span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 12px;
  color: #0d0d0d;
  background: var(--brand);
  border-radius: 50%;
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 170px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); }
.dropzone img { width: 100%; max-height: 260px; object-fit: contain; display: block; }
.dropzone-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; text-align: center; font-size: 13px; }
.dropzone-empty svg { width: 34px; height: 34px; color: var(--brand); }
.dropzone-empty small { color: var(--muted); }

.studio-swatches { max-height: 290px; grid-template-columns: repeat(4, 1fr); }
.studio-swatches .swatch span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-btn { align-self: flex-start; padding: 0; font-size: 12px; color: var(--brand); background: none; border: 0; cursor: pointer; }

.step textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  resize: vertical;
}
.step textarea:focus { border-color: var(--brand); }
.ideas button { text-align: left; }

.form-error { margin: 0; padding: 10px 12px; font-size: 13px; color: #f3c2a8; background: rgba(233, 120, 80, 0.14); border-radius: 10px; }
.fine { margin: 0; font-size: 11.5px; line-height: 1.45; }

/* ---------- Resultado ---------- */
.studio-result {
  position: sticky;
  top: 76px;
  display: grid;
  place-items: center;
  min-height: 420px;
  max-height: calc(100vh - 100px);
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.result-empty, .result-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); text-align: center; }
.result-empty svg { width: 46px; height: 46px; color: var(--brand); opacity: 0.8; }
.result-empty p, .result-loading p { margin: 0; }
.result-loading p { color: var(--text); }
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--brand);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.result { display: flex; flex-direction: column; gap: 12px; width: 100%; height: 100%; min-height: 0; }
.result { justify-content: center; }
/* El recuadro toma la proporción de la imagen generada (--ar, desde disena.js)
   para que la línea quede sobre la imagen y no sobre franjas vacías */
.compare {
  position: relative;
  flex: none;
  align-self: center;
  width: min(100%, calc((100vh - 230px) * var(--ar, 1.333)));
  aspect-ratio: var(--ar, 4 / 3);
  overflow: hidden;
  border-radius: 12px;
  background: #111;
  touch-action: pan-y;
  user-select: none;
  cursor: ew-resize;
  --pos: 50%;
}
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.compare-handle {
  position: absolute;
  top: 50%;
  left: var(--pos);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  color: #0d0d0d;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.compare-handle svg { width: 20px; height: 20px; }
.before-wrap { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.before-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  background: var(--brand);
}
/* Sólo para teclado y lectores de pantalla; con el dedo o el ratón se arrastra el recuadro */
.compare-range {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.compare:has(.compare-range:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.compare .tag {
  position: absolute;
  top: 10px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 999px;
  pointer-events: none;
}
.tag-before { left: 10px; }
.tag-after { right: 10px; color: #0d0d0d; background: var(--brand) !important; }
.result-text { margin: 0; font-size: 12.5px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.result-actions .chip { text-decoration: none; }
.result-actions .btn-primary.small { width: auto; }
.chip-brand { color: var(--brand); border-color: var(--brand); }

/* ---------- Formulario «Cotizar con LUSSO» ---------- */
.quote {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  color: var(--text);
  background: #151515;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: auto;
}
.top-account { font: inherit; background: none; border: 0; cursor: pointer; }
.login-hint { margin: -4px 0 0; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: rgba(255, 255, 255, 0.05); border-radius: 10px; }
.auth-tabs button { padding: 8px; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; border-radius: 7px; cursor: pointer; }
.auth-tabs button.active { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.quote::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(3px); }
.quote-form, .quote-done { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.quote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quote-head h2, .quote-done h2 { margin: 0; font-size: 19px; font-weight: 600; }
.quote-x { display: grid; place-items: center; width: 34px; height: 34px; flex: none; color: var(--text); background: rgba(255, 255, 255, 0.08); border: 0; border-radius: 50%; cursor: pointer; }
.quote-x svg { width: 18px; height: 18px; }
.quote-note { margin: 0; font-size: 12.5px; line-height: 1.45; }
.quote-attachments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quote-attachments figure { margin: 0; min-width: 0; }
.quote-attachments img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: #222; }
.quote-attachments figcaption { margin-top: 4px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-prompt { grid-column: 1 / -1; margin: 0; padding: 8px 10px; font-size: 12px; line-height: 1.4; color: #d6d4cf; background: rgba(255, 255, 255, 0.05); border-radius: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.field input, .field textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field input.invalid { border-color: #e9a07a; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quote-done { align-items: center; text-align: center; padding: 28px 18px; }
.quote-done svg { width: 52px; height: 52px; padding: 10px; color: #0d0d0d; background: var(--brand); border-radius: 50%; }
.quote-done p { margin: 0; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; padding-top: 68px; }
  .studio-result { position: static; max-height: none; min-height: 320px; padding: 10px; }
  .compare { width: 100%; }
}
@media (max-width: 680px) {
  .studio { padding: 64px 12px 20px; }
  .studio-swatches { grid-template-columns: repeat(3, 1fr); }
  .result-actions > * { flex: 1 1 auto; text-align: center; }
  .field-row { grid-template-columns: 1fr; }
  .disena-page .topbar { height: 52px; gap: 10px; padding: 0 12px; }
  .disena-page .logo { height: 22px; }
  .disena-page .topbar-title, .only-desktop { display: none; }
  .disena-page .top-actions { gap: 2px; }
  .top-link .only-mobile { display: block; }
  .top-link { padding: 8px; font-size: 12px; letter-spacing: 0; }
  .top-cta { padding: 8px 12px; font-size: 13px; margin-left: 4px; }
}
