@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Baloo+2:wght@600;700&display=swap');

:root {
  --purple-50: #faf5ff;
  --purple-100: #f3e8ff;
  --purple-200: #e9d5ff;
  --purple-300: #d8b4fe;
  --purple-400: #c084fc;
  --purple-500: #a855f7;
  --purple-600: #9333ea;
  --purple-700: #7e22ce;
  --purple-ink: #4a2565;
  --pink-accent: #f0abfc;
  --white: #ffffff;
  --status-taken: #ffe0b2;
  --status-bought: #fff59d;
  --status-inhand: #c8e6c9;
  --status-given: #d1c4e9;
  --shadow: 0 10px 30px rgba(147, 51, 234, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Quicksand', sans-serif;
  color: var(--purple-ink);
  background: linear-gradient(160deg, var(--purple-50) 0%, var(--purple-100) 45%, var(--purple-200) 100%);
  min-height: 100vh;
}

h1, h2, h3, .brand {
  font-family: 'Baloo 2', cursive;
}

a { color: var(--purple-600); }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.page.wide {
  max-width: 1100px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--purple-700);
  text-decoration: none;
  margin-bottom: 24px;
}

.brand .sparkle { font-size: 1.6rem; }

.card {
  background: var(--white);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--purple-200);
}

.card + .card { margin-top: 20px; }

h1.title {
  font-size: 1.9rem;
  color: var(--purple-700);
  margin: 0 0 8px;
}

.subtitle {
  color: #8a6aa8;
  margin: 0 0 24px;
  line-height: 1.5;
}

label {
  display: block;
  font-weight: 600;
  color: var(--purple-700);
  margin-bottom: 6px;
  margin-top: 18px;
}

label .tl {
  display: block;
  font-weight: 400;
  font-style: italic;
  color: #a488c0;
  font-size: 0.85rem;
  margin-top: 2px;
}

select, input[type="text"], input[type="url"], input[type="number"], textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid var(--purple-200);
  font-family: inherit;
  font-size: 1rem;
  background: var(--purple-50);
  color: var(--purple-ink);
  transition: border-color 0.15s ease;
}

select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--purple-400);
  background: var(--white);
}

textarea { resize: vertical; min-height: 90px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  background: linear-gradient(135deg, var(--purple-500), var(--pink-accent));
  color: white;
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(168, 85, 247, 0.45); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn.secondary {
  background: var(--white);
  color: var(--purple-600);
  border: 2px solid var(--purple-300);
  box-shadow: none;
}

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.hint {
  background: var(--purple-50);
  border: 1px dashed var(--purple-300);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: #7a5a99;
  margin-bottom: 18px;
}

.hidden { display: none !important; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 20px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(0,0,0,0.06);
}

.legend-chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
}

.gift-table-wrap {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--purple-200);
}

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

table.gift-table th {
  background: var(--purple-600);
  color: white;
  padding: 8px 8px;
  text-align: left;
  position: sticky;
  top: 0;
  font-weight: 600;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  border-radius: 999px;
  box-shadow: none;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.locked-badge {
  font-size: 0.78rem;
  color: #8a6aa8;
  white-space: nowrap;
}

table.gift-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--purple-100);
  vertical-align: middle;
}

table.gift-table tr:last-child td { border-bottom: none; }

table.gift-table input, table.gift-table select {
  padding: 5px 7px;
  border-radius: 8px;
  font-size: 0.8rem;
  border: 1px solid var(--purple-200);
  width: 100%;
  background: transparent;
}

table.gift-table input:disabled, table.gift-table select:disabled {
  border-color: transparent;
  color: var(--purple-ink);
  background: transparent;
}

.gift-table td.link a { font-size: 0.78rem; }
.gift-table td.no { text-align: center; color: #a488c0; font-weight: 600; width: 34px; }

tr[data-status="Taken"] { background: var(--status-taken); }
tr[data-status="Bought/Ordered"] { background: var(--status-bought); }
tr[data-status="Gift is on my hand now"] { background: var(--status-inhand); }
tr[data-status="Gave it to Mommy"] { background: var(--status-given); }

.add-gift-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  margin-top: 10px;
}

.add-gift-form label { margin-top: 0; font-size: 0.85rem; }

.people-grid {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.people-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.footer-note {
  text-align: center;
  color: #a488c0;
  font-size: 0.85rem;
  margin-top: 28px;
}

.role-answers {
  border-top: 2px dashed var(--purple-200);
  margin-top: 24px;
  padding-top: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple-700);
  color: white;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 600;
  z-index: 50;
}

.count-pill {
  display: inline-block;
  background: var(--purple-100);
  color: var(--purple-700);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}

.admin-group {
  margin-top: 10px;
}

.admin-group h3 {
  color: var(--purple-700);
  border-bottom: 2px solid var(--purple-200);
  padding-bottom: 6px;
}

.response-card {
  border: 1px solid var(--purple-200);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
  background: var(--purple-50);
}

.response-card .who {
  font-weight: 700;
  color: var(--purple-700);
  margin-bottom: 6px;
}

.response-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
}

.response-card dt { font-weight: 600; color: #8a6aa8; font-size: 0.82rem; }
.response-card dd { margin: 0; font-size: 0.9rem; }

/* Below this width, the gift table becomes a stack of cards instead of a
   horizontally-scrolling table, so every gift is readable without sliding.
   Placed last in the file so it wins over the earlier same-specificity
   table.gift-table td/input/select rules at this breakpoint. */
@media (max-width: 700px) {
  .gift-table-wrap { overflow-x: visible; border: none; }

  table.gift-table, table.gift-table thead, table.gift-table tbody,
  table.gift-table th, table.gift-table td, table.gift-table tr {
    display: block;
  }

  table.gift-table thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
  }

  table.gift-table tr {
    border: 1px solid var(--purple-200);
    border-radius: 16px;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: white;
  }

  table.gift-table td {
    border: none;
    padding: 6px 0 6px 46%;
    position: relative;
    min-height: 28px;
  }

  table.gift-table td.no {
    text-align: left;
    width: auto;
    font-size: 0.95rem;
  }

  table.gift-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 42%;
    font-weight: 700;
    color: var(--purple-700);
    white-space: nowrap;
  }

  table.gift-table input, table.gift-table select {
    width: 100%;
  }
}
