/* Promptique — shared styles ("Ink & Paper" theme, section 14 of the spec) */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #2d2d2d;
  --accent-hover: #000000;
  --accent-disabled: #9a9a9a;
  --border: #e8e3db;
  --success: #4a7c59;
  --error: #b84a3e;
  --error-bg: #fdf4f2;
  --radius: 8px;
  --gap: 16px;
  --pad: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.app {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--pad);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-feature-settings: "ss01";
}

.icon-btn {
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition:
    color 150ms ease,
    background 150ms ease;
}
.icon-btn:hover {
  color: var(--text);
}
.icon-btn:focus-visible {
  outline: none;
  color: var(--text);
  background: rgba(45, 45, 45, 0.08);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
}

.label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.textarea,
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-family:
    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 150ms ease;
}
.textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
}
.textarea::placeholder,
.input::placeholder {
  color: var(--text-muted);
}

.textarea {
  min-height: 132px;
  max-height: 220px;
}

.btn {
  width: 100%;
  height: 40px;
  flex-shrink: 0;
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease;
}
.btn:hover {
  background: var(--accent-hover);
}
.btn:focus-visible {
  outline: none;
  background: var(--accent-hover);
}
.btn:disabled {
  background: var(--accent-disabled);
  cursor: wait;
}

.btn-row {
  display: flex;
  gap: var(--gap);
}
.btn-row .btn {
  flex: 1 1 0;
  width: auto;
}

.btn.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.btn-secondary:hover {
  background: rgba(45, 45, 45, 0.04);
  border-color: var(--text);
}
.btn.btn-secondary:focus-visible {
  background: rgba(45, 45, 45, 0.04);
  border-color: var(--text);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(250, 247, 242, 0.3);
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: promptique-spin 0.8s linear infinite;
}
@keyframes promptique-spin {
  to {
    transform: rotate(360deg);
  }
}

.result {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 92px;
  max-height: 200px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
}
.result-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  font-family:
    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.result:not(.is-empty) .result-scroll {
  padding-right: 40px;
}
.result.is-empty .result-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}

.copied-flash {
  position: absolute;
  top: 10px;
  right: 34px;
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}
.copied-flash.show {
  opacity: 1;
}

.error-banner {
  background: var(--error-bg);
  color: var(--error);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  display: none;
}
.error-banner.show {
  display: block;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
}
.hint a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
