/* Generate page — page-specific styles. Tokens, base form controls, button
   variants, and the .rb-topnav primitive come from /shared/brand.css. */

html, body { min-height: 100%; }
body { background: var(--rb-black-05); }

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

#page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 12px 0;
}
#page-head h1 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.page-sub {
  margin: 0;
  color: var(--fg-muted);
  font-size: 14px;
}

.group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.group h3 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}
.group label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}
.hint {
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 400;
}
.hint code {
  font-family: var(--font-mono);
  background: var(--surface-alt);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

textarea {
  resize: vertical;
  min-height: 140px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.copy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) {
  .copy-grid { grid-template-columns: 1fr; }
}

#image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
#image-list:empty { display: none; }

.thumb {
  position: relative;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.thumb img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}
.thumb figcaption {
  font-size: 11px;
  color: var(--fg-muted);
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--border);
}
.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--rb-black);
  color: var(--rb-white);
  border: none;
}
.thumb-remove:hover {
  background: var(--accent);
  color: var(--rb-white);
}

#dimensions-controls {
  display: flex;
  gap: 8px;
}
#dimensions-controls button {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

#dimensions-custom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: var(--surface-alt);
}
#dimensions-custom .dim-custom-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}
#dimensions-custom input[type="number"] {
  width: 90px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
}
#dimensions-custom #custom-add {
  padding: 6px 12px;
  font-size: 12px;
}
#dimensions-custom .hint { margin-left: auto; }

#dimensions {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.dim-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dim-item:hover {
  border-color: var(--fg);
}
.dim-item:has(input:checked) {
  border-color: var(--accent);
  background: rgba(232, 117, 17, 0.04);
}
.dim-item input {
  margin: 0;
  padding: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent);
}
.dim-label {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.dim-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--fg-muted);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface-alt);
  white-space: nowrap;
}

#generate {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#status {
  min-height: 1.2em;
  color: var(--fg-muted);
  font-size: 13px;
}
#status.warn { color: var(--state-warning); }
#status.error { color: var(--state-error); }

.progress {
  width: 100%;
  height: 8px;
  background: var(--rb-black-10);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.15s ease;
}
.progress-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#results:empty { display: none; }

.results-path {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-alt);
}
.results-path code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.results-path .copy-path {
  padding: 6px 12px;
  font-size: 12px;
}
.results-path .review-run {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-white);
  text-decoration: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.results-path .review-run:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.recent-runs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recent-runs li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-alt);
}
.recent-runs .recent-meta {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-runs .review-run {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rb-white);
  text-decoration: none;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.recent-runs .review-run:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

#results details {
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}
#results details > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  user-select: none;
}
#results details > summary::-webkit-details-marker { display: none; }
#results details > summary::before {
  content: '▸';
  display: inline-block;
  width: 14px;
  color: var(--fg-muted);
  transition: transform 0.1s ease;
}
#results details[open] > summary::before { transform: rotate(90deg); }

.results-list {
  margin: 0;
  padding: 4px 12px 12px 36px;
  list-style: disc;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
}
.results-list li { word-break: break-all; }

.results-error-header {
  margin: 8px 0 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--state-error);
}
.results-errors { color: var(--state-error); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
}
.modal-card {
  max-width: 460px;
  width: 100%;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-card h3 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}
.modal-summary {
  margin: 0;
  font-size: 15px;
  color: var(--fg);
  line-height: 1.5;
}
.modal-summary strong {
  color: var(--accent);
  font-weight: 700;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-confirm {
  background: var(--accent);
  color: var(--rb-white);
  border-color: var(--accent);
}
.modal-confirm:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--rb-white);
}
