/*
 * Application styles. With Propshaft, `stylesheet_link_tag :app` bundles every
 * file in app/assets/stylesheets, so app-wide styles can live here directly.
 */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-alt: #f9fafb;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --border: #e5e7eb;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2027;
    --surface-alt: #24272f;
    --text: #e6e8ec;
    --muted: #9aa0aa;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: #262a3d;
    --border: #333844;
    --success: #34d399;
    --success-soft: #16281f;
    --danger: #f87171;
    --danger-soft: #2a1a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-header a {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--primary);
}

/* ---------- Buttons & action links ---------- */

.btn,
button,
input[type="submit"] {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--muted);
}

.btn-danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border);
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.actions--end {
  justify-content: flex-end;
}

/* ---------- Cards & lists ---------- */

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

a.card:hover {
  border-color: var(--primary);
}

.card-title {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty {
  color: var(--muted);
  font-style: italic;
  margin: 1rem 0;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}

.tag-correct {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.tag-incorrect {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

/* ---------- Forms ---------- */

form .field {
  margin-bottom: 1rem;
}

form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

form .field--checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

form .field--checkbox label {
  margin-bottom: 0;
}

form .field--checkbox input {
  width: 1.1rem;
  height: 1.1rem;
}

/* ---------- Quiz attempt: choice selection ---------- */

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.quiz-prompt {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

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

.choice input[type="radio"] {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.choice-text {
  font-weight: 500;
}

.choice:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Quiz review (completion) ---------- */

.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.review-question {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.review-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  color: var(--muted);
}

.review-choice--chosen {
  color: var(--text);
  font-weight: 600;
}

.review-choice--correct {
  color: var(--success);
  font-weight: 600;
}

.review-choice--chosen-wrong {
  color: var(--danger);
  font-weight: 600;
}

.review-mark {
  width: 1.25rem;
  text-align: center;
}

/* ---------- Summary ---------- */

#quiz-summary,
.copy-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  resize: vertical;
}
