/* AI Image Generator — a form: the provider card (with the CORS notice under
   it), the prompt card with Generate, and the gallery card; the secondary
   settings live in the Options sheet (layout from
   styles/components/form.css). The main prompt is
   styles/components/editor.css; only the provider tiles, the negative prompt,
   the loading line and the gallery grid are the page's own. */

/* Provider tiles — tappable cards, four across when they fit, two below. */
.aig-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-2);
}
.aig-provider-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--row-pad-y) var(--space-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all var(--duration-snap) var(--ease-standard);
}
.aig-provider-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.aig-provider-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.aig-provider-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
/* The CORS / key-storage notice under the provider card: icon + prose. */
.aig-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.aig-notice svg { flex-shrink: 0; margin-top: 2px; }
.aig-notice strong { font-weight: 600; color: var(--text-dim); }

/* The negative prompt is a bordered field in a stacked row (the main prompt
   is a styles/components/editor.css pane). */
textarea.aig-prompt--negative {
  display: block;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}
.aig-prompt--negative { opacity: 0.92; }
.aig-optional {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: -0.005em;
}

/* ── Options sheet ─────────────────────────────────────────────────────── */
.aig-provider-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.aig-key-section { --gap: var(--space-2); }
input.aig-key-input { font-size: 13px; }
.aig-key-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0;
}
.aig-seed-row { --gap: var(--space-1); }
input.aig-seed-input { width: 140px; min-width: 0; }

/* ── Gallery ───────────────────────────────────────────────────────────── */
.aig-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: 14px;
  color: var(--text-muted);
}
.aig-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}
.aig-gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-recessed);
  aspect-ratio: 1;
  cursor: pointer;
}
.aig-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-default) var(--ease-out);
}
.aig-gallery-item:hover img { transform: scale(1.03); }
.aig-gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-3);
  opacity: 0;
  transition: opacity var(--duration-snap) var(--ease-standard);
}
.aig-gallery-item:hover .aig-gallery-overlay { opacity: 1; }
.aig-gallery-prompt {
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  margin: 0 0 var(--row-gap);
  line-height: 1.4;
}
.aig-gallery-actions {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}
