/* ENGYNE KEYWORD STUDIO
   Form controls and wizard UI. shared.css has no input styling — it was built for
   marketing pages, and dashboard.css (which does) is not loaded on public pages.
   Everything here uses the shared.css design tokens. */

/* ---------- Layout ---------- */

.studio {
  max-width: 900px;
  margin: 0 auto;
}

.studio-step {
  display: none;
}

.studio-step.active {
  display: block;
  animation: studioFadeIn 0.28s ease both;
}

@keyframes studioFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .studio-step.active { animation: none; }
}

/* ---------- Progress rail ---------- */

.studio-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.studio-progress-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-light);
}

.studio-progress-item::after {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--border-2);
}

.studio-progress-item:last-child::after { display: none; }

.studio-progress-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-muted);
  border: 1px solid var(--border-2);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.studio-progress-item.done .studio-progress-dot {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success-text);
}

.studio-progress-item.current .studio-progress-dot {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-text);
}

.studio-progress-item.current { color: var(--text-main); }

/* ---------- Cards ---------- */

.studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
}

.studio-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.studio-card .studio-sub {
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
  margin: 0 0 22px;
}

/* ---------- Form controls ---------- */

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-main);
}

.field .hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 6px;
  line-height: 1.5;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder,
.textarea::placeholder { color: var(--text-light); }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.6;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}

.input-row .input { flex: 1 1 260px; }

/* ---------- Segmented choice ---------- */

.choice-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.choice {
  flex: 1 1 150px;
  position: relative;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: block;
  padding: 13px 16px;
  text-align: center;
  background: var(--bg-muted);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s;
}

.choice input:checked + span {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-text);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.choice span:hover { border-color: var(--border-focus); }

/* ---------- Chips ---------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px 7px 13px;
  background: var(--bg-muted);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-size: 0.85rem;
  max-width: 100%;
}

.chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.chip-remove {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chip-remove:hover { color: var(--danger-text); }

.chip.approved {
  background: var(--success-soft);
  border-color: var(--success-line);
}

.chip.restricted {
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.28);
}

.chip.warned { border-style: dashed; }

.chip-flag {
  font-size: 0.7rem;
  color: var(--warning);
  cursor: help;
  flex-shrink: 0;
}

/* Location toggles double as filter chips. */
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  background: var(--bg-muted);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-size: 0.84rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.toggle-chip input { accent-color: var(--primary); cursor: pointer; }

.toggle-chip:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-text);
}

/* ---------- Result summary ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.summary-item {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.summary-item .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: 5px;
}

.summary-item .value {
  font-size: 1.05rem;
  font-weight: 600;
  word-break: break-word;
}

/* ---------- Notices ---------- */

.notice {
  padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.notice.error {
  background: rgba(251, 113, 133, 0.1);
  border-color: rgba(251, 113, 133, 0.28);
  color: var(--danger-text);
}

.notice.warn {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.28);
  color: var(--warning);
}

.notice.info {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary-text);
}

.notice.success {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success-text);
}

.notice[hidden] { display: none; }

/* ---------- Loading ---------- */

.studio-loading {
  text-align: center;
  padding: 48px 20px;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 20px;
  border: 3px solid var(--border-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.5s; }
}

/* ---------- Actions ---------- */

.studio-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.studio-actions.no-rule {
  border-top: none;
  padding-top: 0;
}

.link-button {
  background: none;
  border: none;
  color: var(--primary-text);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0;
}

.link-button:hover { color: var(--primary-hover); }

.group-heading {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin: 20px 0 10px;
  font-weight: 700;
}

.group-heading:first-child { margin-top: 0; }
