/* RateMySpanish — minimalist styling. One accent color, system fonts,
   generous whitespace, bordered cards echoing the original terminal UI. */

:root {
  --bg: #faf9f7;
  --fg: #1c1b1a;
  --muted: #6b6661;
  --line: #e0ddd8;
  --card: #ffffff;
  --accent: #b5462f;       /* warm terracotta */
  --accent-soft: #f4e3de;
  --good: #2f7d4f;
  --bad: #b5462f;
  --max: 760px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / nav */
.site-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.site-header .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
}
.site-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-header nav a { color: var(--muted); font-size: 0.92rem; }
.site-header nav a:hover { color: var(--fg); text-decoration: none; }

.container {
  max-width: var(--max);
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* Flash */
.flash {
  max-width: var(--max);
  margin: 1rem auto 0;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
}
.flash-notice { background: var(--accent-soft); color: var(--accent); }
.flash-alert { background: #fdecec; color: #a3271f; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-top: 0; }

/* The English prompt the student must translate */
.prompt {
  font-size: 1.35rem;
  line-height: 1.4;
  font-weight: 600;
}

/* Buttons */
button, .btn, input[type="submit"] {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}
button:hover, .btn:hover, input[type="submit"]:hover { filter: brightness(0.95); text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--accent);
}
.link-button {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0;
  font-size: 0.92rem;
}
.link-button:hover { color: var(--fg); }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; align-items: center; }

/* Forms */
form .field { margin-bottom: 1rem; }
label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.3rem; }
input[type="text"], input[type="email"], input[type="password"],
select, textarea {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--fg);
}
textarea { min-height: 7rem; resize: vertical; }

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Rating stars */
.rating { font-size: 1.1rem; letter-spacing: 1px; }
.rating .on { color: var(--accent); }
.rating .off { color: var(--line); }

/* Markdown feedback */
.feedback h1, .feedback h2, .feedback h3 { font-size: 1rem; margin: 0.8rem 0 0.3rem; }
.feedback ul { margin: 0.3rem 0 0.8rem; padding-left: 1.2rem; }
.feedback code { background: var(--accent-soft); padding: 0.1rem 0.3rem; border-radius: 4px; }

/* Lists */
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.term { font-weight: 600; }

/* Spinner placeholder */
.thinking { color: var(--muted); font-style: italic; }

/* Animated spinner: a small rotating ring in the accent color. */
.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-style: italic;
}
.spinner {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Respect users who prefer reduced motion: show a soft pulse instead. */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: pulse 1.2s ease-in-out infinite; }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
}

/* Disabled submit buttons (Turbo sets this while a form is submitting). */
button[disabled], input[type="submit"][disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* Auth pages */
.auth { max-width: 380px; margin: 3rem auto; }

/* Focus tree */
.focus-category { margin-bottom: 1.4rem; }
.focus-category h3 { font-size: 0.95rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 0.3rem; }
.focus-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; }
.focus-item .badge { margin-left: auto; font-size: 0.8rem; color: var(--muted); }
.focus-children { margin-left: 1.4rem; }
.disabled-focus { opacity: 0.5; }

/* Q&A thread */
.qa { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.qa .q { font-weight: 600; }
.qa .a { margin: 0.3rem 0 1rem; }

/* Comments (instructor) */
.comment { background: var(--accent-soft); border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 0.6rem; }
.comment .who { font-size: 0.8rem; color: var(--muted); }
