/* ═══════════════════════════════════════════════════════════
   WordPlay — Design System
   Aesthetic: Playful editorial — bold geometric + warm tones
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── Variables ───────────────────────────────────────────── */
:root {
  --ink:       #0f0e0c;
  --paper:     #faf8f3;
  --cream:     #f0ece0;
  --accent:    #e8500a;
  --accent2:   #2c6e49;
  --accent3:   #4a2fcf;
  --gold:      #f5b800;
  --muted:     #8a8578;
  --border:    #d4cfc2;

  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  32px;

  --shadow-sm: 2px 3px 0 var(--ink);
  --shadow-md: 4px 5px 0 var(--ink);
  --shadow-lg: 6px 7px 0 var(--ink);

  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --transition: 0.15s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  background: var(--ink);
  color: var(--paper);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--accent);
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.navbar-logo span { color: var(--accent); }
.navbar-nav {
  display: flex;
  gap: 8px;
  list-style: none;
}
.navbar-nav a {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}
.navbar-nav a:hover, .navbar-nav a.active {
  background: var(--accent);
  color: #fff;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: 2.5px solid var(--ink);
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-md);
}
.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 2px 0 var(--ink);
}
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--paper); color: var(--ink); }
.btn-success   { background: var(--accent2); color: #fff; }
.btn-ghost     { background: transparent; color: var(--ink); box-shadow: none; border-color: var(--border); }
.btn-ghost:hover { background: var(--cream); box-shadow: none; transform: none; }
.btn-sm        { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg        { padding: 14px 32px; font-size: 1.05rem; }
.btn-icon      { padding: 8px; border-radius: var(--r-sm); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-lg);
}
.card-body   { padding: 24px; }
.card-header { padding: 20px 24px; border-bottom: 2px solid var(--border); }
.card-footer { padding: 16px 24px; border-top: 2px solid var(--border); background: var(--cream); }

/* ── Template Badge ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-display);
  border: 2px solid var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-quiz       { background: #fef3c7; color: #92400e; }
.badge-matchup    { background: #d1fae5; color: #065f46; }
.badge-wordsearch { background: #ede9fe; color: #4c1d95; }
.badge-flashcards { background: #fce7f3; color: #9d174d; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-family: var(--font-display);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2.5px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--ink);
  box-shadow: var(--shadow-sm);
}
select.form-control { cursor: pointer; }

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--r-sm);
  border: 2.5px solid var(--ink);
  box-shadow: var(--shadow-md);
  font-weight: 600;
  font-size: 0.9rem;
  animation: toastIn .2s ease forwards;
  max-width: 320px;
}
.toast-success { background: var(--accent2); color: #fff; }
.toast-error   { background: var(--accent);  color: #fff; }
.toast-info    { background: var(--ink);     color: var(--paper); }
@keyframes toastIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,14,12,.55);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--r-xl);
  box-shadow: 8px 9px 0 var(--ink);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 2px solid var(--border);
}
.modal-body   { padding: 24px 28px; }
.modal-footer { padding: 20px 28px; border-top: 2px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  padding: 72px 0 56px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 24px,
    rgba(0,0,0,.03) 24px,
    rgba(0,0,0,.03) 25px
  );
  pointer-events: none;
}
.hero-title {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.0;
  margin-bottom: 16px;
}
.hero-title em {
  font-style: normal;
  color: var(--accent);
  position: relative;
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 480px;
  margin-bottom: 32px;
}

/* ── Grid ────────────────────────────────────────────────── */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* ── Template Picker ─────────────────────────────────────── */
.template-picker { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.template-card {
  border: 3px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: #fff;
}
.template-card:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); }
.template-card.selected { border-color: var(--accent); background: #fff5f0; box-shadow: var(--shadow-sm); }
.template-card .t-icon { font-size: 2.4rem; margin-bottom: 8px; }
.template-card .t-name { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.template-card .t-desc { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

/* ── Content editor rows ─────────────────────────────────── */
.content-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.content-row  { display: flex; gap: 8px; align-items: center; }
.content-row .form-control { flex: 1; }
.remove-row   { flex-shrink: 0; }

/* ── Activity List Card ──────────────────────────────────── */
.activity-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.activity-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.activity-meta  { font-size: 0.8rem; color: var(--muted); }
.activity-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Stats bar ───────────────────────────────────────────── */
.stat-bar {
  display: flex;
  gap: 24px;
  padding: 16px 0;
  border-top: 2px solid var(--border);
  border-bottom: 2px solid var(--border);
  margin: 24px 0;
}
.stat-item .stat-num { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; }
.stat-item .stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; margin-bottom: 20px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 720px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .template-picker { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 32px; }
  .modal { border-radius: var(--r-lg); }
}
