/* ============================================================
   ANNABELLE TOOLS – Component Styles (v1.0)
   Extends the design system tokens from styles.css.
   All tool landing pages load this alongside styles.css.
   ============================================================ */

/* ── Tool Hero ─────────────────────────────────────────────── */
.tool-hero {
  text-align: center;
  padding: var(--space-lg) 0 var(--space-md);
}
.tool-hero h1 { max-width: 720px; margin: 0 auto var(--space-sm); }
.tool-hero__sub {
  max-width: 600px;
  margin: 0 auto var(--space-md);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── State Machine ─────────────────────────────────────────── */
.tool-states { position: relative; }
.tool-state {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.tool-state--active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ── Form Container ────────────────────────────────────────── */
.tool-form { max-width: 640px; margin: 0 auto; }

/* ── Slider ────────────────────────────────────────────────── */
.tool-slider {
  margin-bottom: var(--space-md);
  padding: var(--space-sm) 0;
}
.tool-slider__label {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}
.tool-slider__value {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 2ch;
  text-align: center;
  margin-bottom: var(--space-xs);
}
.tool-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.tool-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.tool-slider input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.tool-slider input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--white);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: pointer;
}
.tool-slider__anchors {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-family: var(--font-sans);
  line-height: 1.3;
}
.tool-slider__anchors span { max-width: 45%; }
.tool-slider__anchors span:last-child { text-align: right; }

/* ── Text Input / Textarea ─────────────────────────────────── */
.tool-field { margin-bottom: var(--space-sm); }
.tool-field__label {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}
.tool-input,
.tool-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-cards);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s ease;
}
.tool-input:focus,
.tool-textarea:focus { border-color: var(--accent); }
.tool-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

/* ── Dropdown ──────────────────────────────────────────────── */
.tool-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--bg-cards);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235c4d3c' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.tool-select:focus { border-color: var(--accent); }

/* ── Checkbox Group ────────────────────────────────────────── */
.tool-checkbox-group { margin-bottom: var(--space-sm); }
.tool-checkbox-group__label {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}
.tool-checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 1rem;
  cursor: pointer;
}
.tool-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Multiple Choice (Radio) ──────────────────────────────── */
.tool-radio-group { margin-bottom: var(--space-sm); }
.tool-radio-group__label {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}
.tool-radio-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 1rem;
  cursor: pointer;
}
.tool-radio-item input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Split Input (AITA-style) ─────────────────────────────── */
.tool-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
@media (max-width: 600px) {
  .tool-split { grid-template-columns: 1fr; }
}

/* ── Divider ───────────────────────────────────────────────── */
.tool-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: var(--space-sm) 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
}
.tool-divider::before,
.tool-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Vent Box ──────────────────────────────────────────────── */
.tool-vent {
  max-width: 640px;
  margin: 0 auto;
}

/* ── Audio Recorder ────────────────────────────────────────── */
.tool-audio { text-align: center; margin: var(--space-sm) 0; }
.tool-audio__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}
.tool-audio__btn:hover {
  background: var(--accent);
  color: var(--white);
}
.tool-audio__btn--recording {
  color: var(--white);
  background: #c0392b;
  border-color: #c0392b;
  animation: audioPulse 1.5s ease-in-out infinite;
}
.tool-audio__btn--recording:hover {
  background: #a93226;
  border-color: #a93226;
}
@keyframes audioPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
}
.tool-audio__timer {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}
.tool-audio__done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}
.tool-audio__done audio {
  max-width: 100%;
  width: 320px;
  height: 40px;
}
.tool-audio__rerecord {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.tool-audio__error {
  color: #c0392b;
  font-size: 0.9rem;
  margin-top: var(--space-xs);
}
.tool-audio__cap-flash {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  animation: flashIn 0.3s ease;
}
@keyframes flashIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ── Consent Checkbox ──────────────────────────────────────── */
.tool-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: var(--space-md) auto;
  max-width: 640px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.tool-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
.tool-consent a {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Action Buttons ────────────────────────────────────────── */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin-top: var(--space-md);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
.tool-submit {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  padding: 1rem 2rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s ease, transform 0.2s ease, opacity 0.2s ease;
}
.tool-submit:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.tool-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tool-submit--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.tool-submit--ghost:hover:not(:disabled) {
  background: var(--bg-muted);
  transform: translateY(-1px);
  color: var(--text-primary);
}

/* ── Skip Link (inline text CTA, not a button) ────────────── */
.tool-skip-link {
  display: block;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin: 0 auto var(--space-md);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}
.tool-skip-link:hover { color: var(--accent); }

/* ── Processing Animation ──────────────────────────────────── */
.tool-processing {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  padding: var(--space-lg) 0;
}
.tool-processing__line {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  margin-bottom: var(--space-xs);
}
.tool-processing__line--visible {
  opacity: 1;
  transform: translateY(0);
}
.tool-processing__spinner {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
  animation: dotBlink 1s steps(1) infinite;
}
@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* ── Result Section (device-aware) ─────────────────────────── */
.tool-result {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.tool-result h2 {
  font-family: var(--font-serif);
  margin-bottom: var(--space-sm);
}
.tool-result p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}
.tool-result__qr {
  display: flex;
  justify-content: center;
}
.tool-result__qr canvas {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 12px;
  background: var(--white);
}
.tool-result__qr-pair {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin: var(--space-md) auto;
  flex-wrap: wrap;
}
.tool-result__qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}
.tool-result__qr-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.tool-result__qr-label svg { width: 16px; height: 16px; }
.tool-result__caption {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  font-family: var(--font-serif);
  margin-top: var(--space-xs);
}
.tool-result__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.15s ease;
  color: var(--white);
  background: var(--accent);
}
.tool-result__btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--white);
}
.tool-result__btn svg { flex-shrink: 0; }
.tool-result__btns {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.tool-result--mobile .tool-result__btn { min-height: 56px; font-size: 1.15rem; }
.tool-result--desktop .tool-result__btns {
  flex-direction: row;
  justify-content: center;
  margin-top: var(--space-sm);
}
.tool-result--desktop .tool-result__btn {
  width: auto;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.tool-result--desktop .tool-result__btn:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

/* ── Progress Indicator ────────────────────────────────────── */
.tool-progress {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: var(--space-md);
}
.tool-progress__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s ease;
}
.tool-progress__dot--active { background: var(--accent); }

/* ── Language Switcher ─────────────────────────────────────── */
.tool-lang-switcher {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.tool-lang-switcher a {
  display: flex;
  align-items: center;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
}
.tool-lang-switcher a:hover { opacity: 0.8; text-decoration: none; }
.tool-lang-switcher a.active { opacity: 1; color: var(--text-primary); }

/* ── Dark Theme Override (Racing Thoughts / Tool 8) ────────── */
.tool-dark {
  --bg-primary: #1a1a1a;
  --bg-muted: #222;
  --bg-darker: #111;
  --bg-cards: #2a2a2a;
  --text-primary: #e8e0d4;
  --text-secondary: #a89b8c;
  --border: #3a3a3a;
}
.tool-dark body { background-color: var(--bg-primary); color: var(--text-primary); }

/* ── Mobile Compression ───────────────────────────────────── */
@media (max-width: 600px) {
  .tool-hero { padding: 1.25rem 0 0.5rem; }
  .tool-hero h1 { margin-bottom: 0.5rem; }
  .tool-hero__sub { margin-bottom: 0.75rem; font-size: 1.1rem; }
  .tool-state.section { padding-top: 0; padding-bottom: var(--space-md); }
  .tool-textarea { min-height: 100px; }
}
