/* Generate del espacio SFW (#page-sfw-generate, lo pinta sfw-generate.js). Prefijo `.sg-`.
   Solo tokens del studio: el tema mono del espacio SFW los retinta solo. */

/* Casi todo aquí trae su propio `display`, que pisa el `[hidden]` del navegador. */
#page-sfw-generate [hidden] { display: none !important; }

#page-sfw-generate { min-width: 0; }
.sg-page {
  flex: 1; min-height: 0; min-width: 0; width: 100%;
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px;
}
.sg-eyebrow {
  display: block; font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 6px;
}
.sg-title {
  font-family: var(--font-serif); font-size: clamp(28px, 3vw, 36px); font-weight: 400;
  line-height: 1.05; color: var(--text-primary); margin: 0;
}
.sg-title em { color: var(--accent); font-style: italic; }
.sg-sub { margin: 8px 0 0; color: var(--text-dim); font-size: 14px; }

.sg-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
@media (min-width: 1100px) {
  .sg-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
}
.sg-form, .sg-results { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.sg-card {
  display: flex; flex-direction: column; gap: 10px; padding: 16px 18px;
  border: 1px solid var(--border-soft); border-radius: 16px; background: rgba(255, 255, 255, .02);
  min-width: 0;
}
.sg-row { flex-direction: row; flex-wrap: wrap; gap: 14px; }
.sg-field { display: flex; flex-direction: column; gap: 6px; min-width: 120px; flex: 1; }
.sg-label {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint);
  font-weight: 600;
}
.sg-note { margin: 0; font-size: 13px; color: var(--text-dim); }
.sg-msg {
  margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  border: 1px solid rgba(232, 90, 90, .35); background: rgba(232, 90, 90, .08); color: var(--text-primary);
}

.sg-select, .sg-textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--text-primary);
  background: rgba(255, 255, 255, .03); border: 1px solid var(--border-medium); border-radius: 10px;
  padding: 9px 11px; color-scheme: dark;
}
.sg-select option { color: #111; background: #fff; }
.sg-textarea { resize: vertical; line-height: 1.45; }
.sg-textarea--sm { font-size: 13px; }
.sg-select:focus, .sg-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.sg-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sg-tab {
  font: inherit; font-size: 13px; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-medium); background: transparent; color: var(--text-dim);
  transition: all .15s var(--ease);
}
.sg-tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.sg-drop {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 170px; border: 1px dashed var(--border-medium); border-radius: 14px;
  cursor: pointer; overflow: hidden; background: rgba(255, 255, 255, .015);
  transition: border-color .15s var(--ease);
}
.sg-drop.is-over, .sg-drop:hover { border-color: var(--accent); }
.sg-drop img { display: block; max-width: 100%; max-height: 320px; object-fit: contain; }
.sg-drop__hint { color: var(--text-dim); font-size: 14px; padding: 20px; text-align: center; }
.sg-bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; height: 4px; border-radius: 4px;
  background: rgba(255, 255, 255, .12); overflow: hidden;
}
.sg-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }

.sg-variants { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 700px) { .sg-variants { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sg-variant {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--border-soft); border-radius: 12px; min-width: 0;
}
.sg-variant.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sg-variant__head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-primary); }
.sg-variant__head input { accent-color: var(--accent); }
.sg-redo { align-self: flex-start; }

.sg-go { align-self: flex-start; min-width: 180px; }
.sg-go:disabled { opacity: .55; cursor: not-allowed; }

.sg-results__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sg-tile {
  position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border-soft); background: rgba(255, 255, 255, .03);
  display: flex; align-items: center; justify-content: center;
}
.sg-tile img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.sg-tile__state { font-size: 12px; color: var(--text-dim); padding: 8px; text-align: center; }
.sg-tile--queued .sg-tile__state, .sg-tile--running .sg-tile__state { animation: sg-pulse 1.4s ease-in-out infinite; }
.sg-tile--failed .sg-tile__state { color: #e85a5a; }
.sg-tile__btn { position: absolute; left: 8px; bottom: 8px; font-size: 12px; padding: 4px 10px; }
@keyframes sg-pulse { 50% { opacity: .45; } }

/* Tarjeta del motor de fotos (Prepare). Colores de la píldora como el chip de Generate. */
.sg-engine__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sg-engine__btns { margin-left: auto; display: flex; gap: 6px; }
.sg-pill {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border-medium); color: var(--text-dim);
}
.sg-pill[data-state="warming"] { border-color: rgba(232, 168, 56, .5); color: #e8a838; }
.sg-pill[data-state="ready"] { border-color: rgba(94, 200, 130, .5); color: #5ec882; }
.sg-pill[data-state="expired"] { border-color: rgba(232, 90, 90, .5); color: #e85a5a; }
.sg-full { flex-basis: 100%; }
