/* ============================================
   Database Normalisation — shared styles
   Designed to be big, friendly and colourful
   ============================================ */

:root {
  --purple: #6c5ce7;
  --purple-dark: #4834d4;
  --gold: #fdcb6e;
  --gold-dark: #e17055;
  --blue: #74b9ff;
  --blue-dark: #0984e3;
  --green: #55efc4;
  --green-dark: #00b894;
  --red: #ff7675;
  --red-dark: #d63031;
  --ink: #2d3436;
  --paper: #f7f6fb;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Comic Sans MS", Verdana, Arial, sans-serif;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

/* ---------- Header & navigation ---------- */

header {
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: white;
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  margin: 0 0 0.3rem;
  font-size: 2.2rem;
}

header p {
  margin: 0 0 1rem;
  opacity: 0.9;
}

nav {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-bottom: 1.2rem;
}

nav a {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  text-decoration: none;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  font-weight: bold;
  border: 2px solid transparent;
  transition: background 0.2s;
}

nav a:hover { background: rgba(255, 255, 255, 0.3); }

nav a.active {
  background: white;
  color: var(--purple-dark);
}

/* ---------- Layout ---------- */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

section.card {
  background: var(--card);
  border-radius: 16px;
  padding: 1.5rem 1.8rem;
  margin: 1.5rem 0;
  box-shadow: 0 4px 14px rgba(45, 52, 54, 0.08);
}

h2 {
  color: var(--purple-dark);
  font-size: 1.7rem;
  margin-top: 0;
}

h3 {
  color: var(--ink);
  font-size: 1.3rem;
}

/* ---------- Callout boxes ---------- */

.big-idea {
  background: #efeaff;
  border-left: 8px solid var(--purple);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  font-size: 1.2rem;
}

.remember {
  background: #fff6e0;
  border-left: 8px solid var(--gold);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}

.good-box, .bad-box {
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}

.good-box {
  background: #e6fff5;
  border: 3px solid var(--green-dark);
}

.bad-box {
  background: #ffecec;
  border: 3px solid var(--red-dark);
}

.good-box h3, .good-box h4 { color: var(--green-dark); margin-top: 0; }
.bad-box h3, .bad-box h4 { color: var(--red-dark); margin-top: 0; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; margin: 1rem 0; }

table.data {
  border-collapse: collapse;
  width: 100%;
  background: white;
  font-size: 1.05rem;
}

table.data caption {
  caption-side: top;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 0.4rem;
  color: var(--purple-dark);
}

table.data th, table.data td {
  border: 2px solid #b2bec3;
  padding: 0.5rem 0.8rem;
  text-align: left;
}

table.data th {
  background: #dfe6e9;
}

/* primary key column */
table.data th.pk, table.data td.pk {
  background: #ffeaa7;
  border-color: var(--gold-dark);
}
table.data th.pk { background: var(--gold); }

/* foreign key column */
table.data th.fk, table.data td.fk {
  background: #d6eaff;
  border-color: var(--blue-dark);
}
table.data th.fk { background: var(--blue); }

/* problem cells */
table.data td.problem {
  background: #ffd3d3;
  border-color: var(--red-dark);
  font-weight: bold;
}

/* repeated (redundant) cells */
table.data td.repeat {
  background: #ffe0f0;
}

.key-legend {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  font-size: 1rem;
  margin: 0.6rem 0 1rem;
}

.key-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid #636e72;
}

.swatch.pk { background: var(--gold); border-color: var(--gold-dark); }
.swatch.fk { background: var(--blue); border-color: var(--blue-dark); }
.swatch.problem { background: #ffd3d3; border-color: var(--red-dark); }
.swatch.repeat { background: #ffe0f0; border-color: #e84393; }

/* ---------- Two tables side by side with arrow ---------- */

.table-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.table-link .table-wrap { flex: 1 1 300px; }

.link-arrow {
  font-size: 2.4rem;
  color: var(--blue-dark);
  text-align: center;
  flex: 0 0 auto;
}

/* ---------- Step badges (walkthrough) ---------- */

.step {
  display: inline-block;
  background: var(--purple);
  color: white;
  border-radius: 999px;
  padding: 0.25rem 1rem;
  font-weight: bold;
  margin-right: 0.5rem;
}

.arrow-down {
  text-align: center;
  font-size: 2.5rem;
  color: var(--purple);
  margin: 0.2rem 0;
}

/* ---------- Emoji bullets ---------- */

ul.emoji-list { list-style: none; padding-left: 0.3rem; }
ul.emoji-list li { margin: 0.5rem 0; }

/* ---------- Activity styles ---------- */

.quiz-q {
  background: var(--card);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  margin: 1.2rem 0;
  box-shadow: 0 3px 10px rgba(45, 52, 54, 0.07);
}

.quiz-q p.question { font-weight: bold; font-size: 1.15rem; }

.options { display: flex; flex-direction: column; gap: 0.6rem; }

.options button, .click-col, button.check-btn, button.reveal-btn {
  font-family: inherit;
  font-size: 1.05rem;
  cursor: pointer;
}

.options button {
  text-align: left;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 3px solid #b2bec3;
  background: white;
  transition: transform 0.1s;
}

.options button:hover:not(:disabled) {
  border-color: var(--purple);
  transform: translateX(4px);
}

.options button.correct {
  background: #d7ffef;
  border-color: var(--green-dark);
}

.options button.wrong {
  background: #ffe0e0;
  border-color: var(--red-dark);
}

.options button:disabled { cursor: default; }

.feedback {
  margin-top: 0.8rem;
  font-weight: bold;
  min-height: 1.4rem;
}

.feedback.ok { color: var(--green-dark); }
.feedback.no { color: var(--red-dark); }

/* clickable table headers (spot-the-key game) */

table.clickable th.choice {
  cursor: pointer;
  transition: background 0.15s;
}

table.clickable th.choice:hover { background: #c7ecee; }
table.clickable th.choice.correct { background: var(--gold); }
table.clickable th.choice.wrong { background: var(--red); color: white; }

/* clickable cells (fix-the-cell game) */

table.clickable td.cell-choice { cursor: pointer; }
table.clickable td.cell-choice:hover { background: #c7ecee; }
table.clickable td.cell-choice.correct { background: #d7ffef; border-color: var(--green-dark); }
table.clickable td.cell-choice.wrong { background: #ffe0e0; border-color: var(--red-dark); }

/* sort-into-buckets game */

.sort-item {
  display: inline-block;
  background: white;
  border: 3px solid var(--purple);
  border-radius: 10px;
  padding: 0.5rem 0.9rem;
  margin: 0.3rem;
  cursor: pointer;
  font-size: 1rem;
}

.sort-item.selected {
  background: var(--purple);
  color: white;
}

.sort-item.placed { opacity: 0.45; cursor: default; }

.buckets {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.bucket {
  flex: 1 1 180px;
  min-height: 130px;
  border: 3px dashed #b2bec3;
  border-radius: 12px;
  padding: 0.6rem;
  background: #fafafa;
}

.bucket h4 { margin: 0 0 0.5rem; text-align: center; }

.bucket.hot { border-color: var(--purple); background: #f3f0ff; }

.bucket .dropped {
  display: block;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  margin: 0.3rem 0;
  font-size: 0.95rem;
}

.bucket .dropped.right { background: #d7ffef; border: 2px solid var(--green-dark); }
.bucket .dropped.oops { background: #ffe0e0; border: 2px solid var(--red-dark); }

/* score bar */

#score-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--purple-dark);
  color: white;
  text-align: center;
  padding: 0.5rem;
  font-weight: bold;
  font-size: 1.1rem;
}

button.check-btn, button.reveal-btn {
  background: var(--purple);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.4rem;
  font-weight: bold;
  margin-top: 0.8rem;
}

button.check-btn:hover, button.reveal-btn:hover { background: var(--purple-dark); }

/* reveal / hint boxes (walkthrough) */

details {
  background: #f3f0ff;
  border: 2px solid var(--purple);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin: 0.8rem 0;
}

details summary {
  cursor: pointer;
  font-weight: bold;
  color: var(--purple-dark);
}

/* footer nav buttons */

.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-nav a {
  background: var(--purple);
  color: white;
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border-radius: 12px;
  font-weight: bold;
}

.page-nav a:hover { background: var(--purple-dark); }

footer {
  text-align: center;
  padding: 1.5rem;
  color: #636e72;
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  body { font-size: 1.05rem; }
  header h1 { font-size: 1.6rem; }
  section.card { padding: 1rem 1.1rem; }
}
