/* ════════════════════════════════════════════════════════════
   SCRIPT WRITER — Page Layout (Phase B Stubs)
   Token-konform: surface-*, border-*, text-*, fs-*, --space-*.
   Outer-Spacing kommt aus .app-main padding; .sw-page nutzt nur
   inner-padding.
   ════════════════════════════════════════════════════════════ */

.sw-page {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5) 20px;
  margin-top: var(--space-4);
}

.sw-page-header {
  margin-bottom: var(--space-4);
}

.sw-page-title {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  margin: 0 0 8px 0;
  line-height: 1.25;
}

.sw-page-sub {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
  margin: 0;
}

.sw-page-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Phase-B-Platzhalter-Notice */
.sw-stub-notice {
  background: var(--surface-strong);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-4) 18px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-relaxed);
}

/* ════════════════════════════════════════════════════════════
   SCRIPT WRITER FOUNDATION — P03-Handout Review-UI (A.7b/c)
   Token-konform: surface-soft, border-subtle, text-primary,
   radius-md, --space-*. Keine hartcodierten Hex-Codes.
   ════════════════════════════════════════════════════════════ */

.sw-review-container {
  margin-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sw-review-section {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.sw-review-section-header {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Mechanismus-Sektion (read-only) ──────────────────────── */
.sw-review-mechanism .sw-review-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sw-review-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-3);
  align-items: baseline;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}

.sw-review-row-label {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}

.sw-review-row-value {
  color: var(--text-primary);
  word-wrap: break-word;
  hyphens: auto;
}

.sw-review-row-value--empty {
  color: var(--text-faint);
  font-style: italic;
}

/* ── Voice-Sektion (Tag-Editor) ───────────────────────────── */
.sw-voice-block {
  margin-bottom: var(--space-4);
}
.sw-voice-block:last-child { margin-bottom: 0; }

.sw-voice-block-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sw-voice-block-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  line-height: var(--lh-relaxed);
}

.sw-voice-status {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}
.sw-voice-status--loading {
  background: var(--surface-soft);
  border: 1px solid var(--border-accent);
  color: var(--text-accent);
}
.sw-voice-status--ready {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  color: var(--state-success, var(--text-primary));
}
.sw-voice-status--failed,
.sw-voice-status--skipped {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* ── Tag-Chips ────────────────────────────────────────────── */
.sw-tag-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sw-tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
}

.sw-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  background: var(--surface-strong);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  max-width: 100%;
}

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

.sw-tag-chip-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 50%;
  transition: background 0.1s, color 0.1s;
}
.sw-tag-chip-x:hover {
  background: var(--surface-strong);
  color: var(--text-primary);
}

.sw-tag-input-row {
  display: flex;
  gap: var(--space-2);
}

.sw-tag-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-family: inherit;
}
.sw-tag-input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.sw-tag-add-btn {
  width: 32px;
  height: 32px;
  background: var(--surface-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--fs-lg);
  line-height: 1;
  cursor: pointer;
  transition: background 0.1s;
}
.sw-tag-add-btn:hover {
  background: var(--surface-accent);
  border-color: var(--border-default);
}

/* ── External-Anchor-Sektion ──────────────────────────────── */
.sw-review-anchor-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
  line-height: var(--lh-relaxed);
}

.sw-review-anchor-form {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-3);
  align-items: center;
}

.sw-review-anchor-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sw-review-anchor-label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sw-review-anchor-type,
.sw-review-anchor-ref {
  padding: 8px 12px;
  background: var(--surface-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-family: inherit;
}
.sw-review-anchor-type:focus,
.sw-review-anchor-ref:focus {
  outline: none;
  border-color: var(--border-accent);
}

/* ── Speichern-Button ─────────────────────────────────────── */
.sw-review-save-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.sw-review-save-btn {
  padding: 0 var(--btn-primary-padding-x);
  height: var(--btn-primary-height);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border: none;
  border-radius: var(--btn-primary-radius);
  font-size: var(--btn-primary-font-size);
  font-weight: var(--btn-primary-font-weight);
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
}
.sw-review-save-btn:hover:not(:disabled) {
  background: var(--btn-primary-hover-bg);
}
.sw-review-save-btn:active:not(:disabled) {
  background: var(--btn-primary-pressed-bg);
}
.sw-review-save-btn:disabled {
  background: var(--btn-disabled-bg);
  color: var(--btn-disabled-text);
  cursor: not-allowed;
}

.sw-review-save-btn--loading {
  cursor: wait;
  opacity: 0.7;
}

.sw-review-save-btn--saved {
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: default;
}
.sw-review-save-btn--saved:hover {
  background: var(--surface-soft);
}

.sw-review-save-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

/* ── Mobile-Anpassungen ───────────────────────────────────── */
@media (max-width: 640px) {
  .sw-review-row,
  .sw-review-anchor-form {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .sw-review-row-label {
    font-size: var(--fs-2xs);
  }
}
