/* Gift finder. Builds on the tokens and base styles in /styles.css. */
.app { padding-block: 32px 56px; display: grid; gap: 24px; max-width: 880px; }
.muted { color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.panel h2 { display: flex; align-items: center; gap: 12px; font-size: 1.5rem; margin-bottom: 18px; }
.panel .step-num { margin: 0; flex: 0 0 auto; width: 34px; height: 34px; font-size: 1rem; }

label { display: block; font-weight: 500; font-size: 0.95rem; margin-bottom: 16px; }
label > input, label > select, label > textarea { display: block; margin-top: 6px; }
input, select, textarea {
  width: 100%; min-width: 0;
  padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  font: inherit; font-weight: 400;
}
textarea { resize: vertical; }
select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.budget { border: 0; padding: 0; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.budget legend { font-weight: 500; font-size: 0.95rem; padding: 0; margin-bottom: 6px; width: 100%; }
.budget label { margin: 0; flex: 1 1 0; }
.money { position: relative; display: block; }
.money > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 26px; }

.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--soft); }
.btn-ghost.danger { color: var(--accent); margin-left: auto; }
.btn-wide { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Saved people */
.people { display: flex; flex-wrap: wrap; gap: 10px; }
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  font: inherit; cursor: pointer;
}
.person[aria-checked="true"] { border-color: var(--brand); background: var(--soft); }
.person .avatar { width: 32px; height: 32px; font-size: 0.95rem; }
.person-edit { font-size: 0.85rem; color: var(--brand); text-decoration: underline; background: none; border: 0; cursor: pointer; padding: 4px; }
.person-add { padding: 8px 16px; border-style: dashed; color: var(--brand); font-weight: 600; }
.person-summary { flex-basis: 100%; margin: 4px 0 0; font-size: 0.9rem; color: var(--muted); }
.person-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Saved ideas */
.heart { flex: 0 0 auto; width: 36px; height: 36px; margin: -6px -8px 0 0; border: 0; border-radius: 50%; background: transparent; color: var(--accent); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.heart:hover { background: var(--soft); }
.heart[aria-pressed="true"] { animation: pop 0.25s ease-out; }
@keyframes pop { 50% { transform: scale(1.25); } }
.saved { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.saved summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.saved-list { list-style: none; margin: 8px 0 0; padding: 0; }
.saved-item { padding: 12px 0; }
.saved-item + .saved-item { border-top: 1px solid var(--line); }
.saved-top { display: flex; align-items: baseline; gap: 12px; }
.saved-name { font-weight: 600; flex: 1; }
.saved-meta { font-size: 0.85rem; color: var(--muted); margin: 2px 0 8px; }
.store.store-product { background: var(--brand); color: #fff; }

/* Dates to remember */
.dates { border: 0; padding: 0; margin: 0 0 16px; }
.dates legend { font-weight: 500; font-size: 0.95rem; padding: 0; }
.dates .fine { margin: 4px 0 10px; }
.date-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.date-rows:empty { display: none; }
.date-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.date-row:has(input[name="date-label"]:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
.date-remove { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: transparent; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.date-remove:hover { color: var(--accent); border-color: var(--accent); }

/* Coming up */
.upcoming h2 { font-size: 1.3rem; margin-bottom: 8px; }
.upcoming-list { list-style: none; margin: 0; padding: 0; }
.upcoming-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; }
.upcoming-item + .upcoming-item { border-top: 1px solid var(--line); }
.upcoming-info { display: grid; gap: 2px; }
.upcoming-title { font-weight: 600; }
.upcoming-when { font-size: 0.9rem; color: var(--muted); }
.upcoming-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.error { color: var(--accent); font-weight: 500; }
.note { background: var(--soft); color: var(--ink); padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; }

/* Results */
.results h2 { font-size: 1.6rem; }
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); padding: 20px 0; }

/* Boonie, the mascot: says hi when no one is saved, and thinks while ideas load. */
.boonie { display: block; height: auto; flex: 0 0 auto; }
.boonie-empty { display: flex; align-items: center; gap: 16px; }
.boonie-empty .boonie { width: 84px; }
.boonie-empty p { margin: 0; }
.boonie-empty strong { color: var(--ink); }
.boonie-loading { width: 76px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ideas { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.idea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column;
}
.idea-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.idea h3 { font-size: 1.1rem; margin: 0 0 8px; }
.idea .price { white-space: nowrap; }
.idea p { color: var(--muted); font-size: 0.95rem; flex: 1; }
.stores { display: flex; flex-wrap: wrap; gap: 8px; }
.store {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--soft); color: var(--brand);
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
}
.store:hover { background: var(--brand); color: #fff; }
.store.late { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.store .ship-flag { font-weight: 500; font-size: 0.75rem; }
.timing { font-size: 0.8rem; color: var(--muted); margin: 10px 0 0; }
.disclosure { margin-top: 8px; }

/* Exact products ("Find it") */
.find { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.find-btn { width: 100%; }
.find-note { font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }
.find-note.error { color: var(--accent); }
.products { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.product { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto 1fr; column-gap: 14px; row-gap: 8px; padding: 12px 0; }
.product + .product { border-top: 1px solid var(--line); }
.product-photo { grid-row: 1 / 3; width: 96px; height: 96px; padding: 4px; border-radius: 12px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
button.product-photo { cursor: zoom-in; }
button.product-photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.product-photo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.product-photo-blank { display: grid; place-items: center; text-align: center; font-size: 0.75rem; font-weight: 600; color: var(--muted); background: transparent; border-style: dashed; }
.product-info { display: grid; align-content: start; gap: 2px; min-width: 0; }
.product-title { font-size: 0.9rem; font-weight: 500; }
.product-price { font-size: 0.8rem; color: var(--muted); }
.product-actions { align-self: end; display: flex; align-items: center; gap: 6px 14px; flex-wrap: wrap; }
.product-page-link { font-size: 0.8rem; color: var(--muted); }

/* Bigger product photo */
.photo-view { border: 0; border-radius: 16px; padding: 16px; max-width: min(560px, calc(100vw - 32px)); background: #fff; color: #1d1a2b; text-align: center; }
.photo-view::backdrop { background: rgb(10 8 20 / 0.7); }
.photo-view img { display: block; width: 100%; max-height: 70vh; object-fit: contain; }
.photo-view-title { font-size: 0.9rem; margin: 10px 0; }

@media (max-width: 700px) {
  .grid-2, .ideas { grid-template-columns: 1fr; }
  .date-row, .date-row:has(input[name="date-label"]:not([hidden])) { grid-template-columns: minmax(0, 1fr) auto; }
  .date-row select, .date-row input { grid-column: 1; }
  .date-remove { grid-column: 2; grid-row: 1; }
  .panel { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .boonie-loading { animation: none; }
  .heart[aria-pressed="true"] { animation: none; }
}
