/* Lista desideri: pubblica, prenotazioni, regali ricevuti, filtri e gestione lista. Caricato dopo style.css. */

/* ---------- lista desideri ---------- */
.page-head { margin: 8px 0 20px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: .9rem; cursor: pointer;
}
.chip:hover { border-color: var(--gold); }
.chip.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 700; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
}
select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.note { background: rgba(214, 173, 82, .1); border: 1px solid rgba(214, 173, 82, .3); border-radius: 12px; padding: 10px 14px; margin: 8px 0; font-size: .92rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; } }
.grid.strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid.strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card[hidden] { display: none; }
.card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow); }
.card-link { position: absolute; inset: 0; z-index: 2; }
.thumb {
  position: relative; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #fbf6ea, #e9e1cd);
}
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: contain; padding: 14px; }
.thumb-fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 3rem; color: var(--gold);
  background: radial-gradient(circle at 50% 40%, var(--surface-2), var(--surface));
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 {
  font-family: var(--font-body); font-size: .95rem; font-weight: 700; margin: 0; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tag { align-self: flex-start; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--emerald); }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.price { font-weight: 800; color: var(--gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.price.muted { color: var(--muted); font-weight: 600; font-size: .85rem; }
.go { font-size: .85rem; color: var(--muted); }
.card:hover .go { color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- pagina gestione lista ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel .form { margin: 0; }
.form.add { grid-template-columns: 1fr; }
@media (min-width: 760px) { .form.add { grid-template-columns: minmax(0, 1fr) 220px auto; align-items: end; } }
.prod-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.prod-item[open] { border-color: var(--gold); }
.prod-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; cursor: pointer; list-style: none;
}
.prod-row::-webkit-details-marker { display: none; }
.prod-thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #fff; display: grid; place-items: center; }
.prod-thumb img { width: 100%; height: 100%; object-fit: contain; }
.prod-main { display: grid; gap: 3px; min-width: 0; }
.prod-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.prod-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.prod-meta .warn { font-size: .78rem; font-weight: 700; }
.prod-item .form.compact { padding: 4px 12px 14px; border-top: 1px solid var(--line); }

/* ---------- istruzioni iPhone ---------- */
.copy-box { display: grid; gap: 12px; margin-bottom: 18px; }
.copy-row { display: grid; gap: 6px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 760px) { .copy-row { grid-template-columns: 170px minmax(0, 1fr) auto; } }
.copy-row code, .steps code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.steps code { padding: 1px 6px; }
.steps { display: grid; gap: 10px; padding-left: 22px; margin: 0; max-width: 70ch; }
.steps li::marker { color: var(--gold); font-weight: 800; }

/* ---------- regali già ricevuti ---------- */
.card.received .thumb img, .card.received .thumb-fallback { filter: grayscale(.6) brightness(.8); }
.card.received h3 { color: var(--muted); }
.received-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.received-x {
  position: absolute; z-index: 2; left: 0; right: 0; top: 0; aspect-ratio: 1; pointer-events: none;
  display: grid; place-items: center;
}
.received-x::before, .received-x::after {
  content: ""; position: absolute; width: 78%; height: 9%; border-radius: 999px;
  background: var(--red); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); opacity: .92;
}
.received-x::before { transform: rotate(45deg); }
.received-x::after { transform: rotate(-45deg); }
.received-note {
  position: absolute; z-index: 3; inset: 0; display: grid; align-content: center; justify-items: center; gap: 6px;
  padding: 16px; text-align: center; pointer-events: none;
  background: rgba(11, 22, 18, .93); border-radius: inherit;
  opacity: 0; transform: scale(.97); transition: opacity .2s ease, transform .2s ease;
}
.card.show-giver .received-note { opacity: 1; transform: none; }
.received-who { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.25; color: var(--ink); }
.received-thanks { color: var(--gold); font-weight: 700; }
.go.got { color: var(--red); font-weight: 700; }
.card.received:hover { border-color: var(--red); }
.got-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.received-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 4px; margin: 0; display: grid; gap: 10px; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 700; }
.check input { width: auto; accent-color: var(--red); transform: scale(1.2); }
@media (prefers-reduced-motion: reduce) { .received-note { transition: none; } }
.prod-item[hidden] { display: none; }

/* ---------- X dei ricevuti: regalo da qualcuno = DORATA, autoregalo = ROSSA ---------- */
.received-x::before, .received-x::after {
  background: var(--gold); box-shadow: 0 0 0 2px rgba(0, 0, 0, .85), 0 3px 12px rgba(0, 0, 0, .45); opacity: 1;
}
.card.received:not(.self-gift):hover { border-color: var(--gold); }
.got-badge:not(.self) { background: var(--gold); color: var(--gold-ink); }
.card.self-gift .received-x::before, .card.self-gift .received-x::after {
  background: var(--red); box-shadow: 0 0 0 3px #000, 0 3px 12px rgba(0, 0, 0, .4);
}
.card.self-gift .go.got { color: var(--red); }
.card.received:not(.self-gift) .go.got { color: var(--gold); }
.got-badge.self { background: #000; color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.mode-choice { display: flex; gap: 8px 18px; flex-wrap: wrap; }
.mode-choice label { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.mode-choice input { width: auto; accent-color: var(--gold); }
.received-detail { display: grid; gap: 10px; }
.received-detail[hidden], .giver-field[hidden] { display: none; }
.legend { color: var(--muted); display: flex; align-items: center; gap: 6px; margin: 0; }
.mini-x { position: relative; display: inline-block; width: 14px; height: 14px; margin-left: 8px; }
.mini-x::before, .mini-x::after {
  content: ""; position: absolute; left: -1px; right: -1px; top: 5px; height: 4px; border-radius: 4px;
  background: var(--gold); box-shadow: 0 0 0 1.5px var(--red);
}
.mini-x::before { transform: rotate(45deg); } .mini-x::after { transform: rotate(-45deg); }
.mini-x.self::before, .mini-x.self::after { background: var(--red); box-shadow: 0 0 0 1.5px #000; }
.card-foot { flex-wrap: wrap; row-gap: 2px; }
.go.got { white-space: nowrap; }

/* ---------- barra del prezzo ---------- */

/* ---------- prenotazioni (solo utenti registrati, mai l'amministratore) ---------- */
.pren-form { position: relative; z-index: 3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.pren-btn {
  font: inherit; font-size: .82rem; font-weight: 800; cursor: pointer; border-radius: 999px; padding: 5px 12px;
  border: 1px solid var(--gold); background: var(--gold); color: var(--gold-ink);
}
.pren-btn.annulla { background: transparent; color: #ff6b57; border: 2px solid #ff6b57; }
.pren-btn.annulla:hover, .pren-btn.annulla:focus-visible { background: #e0533f; color: #fff; border-color: #e0533f; }
.pren-btn:hover { filter: brightness(1.08); }
.pren-tag { font-size: .82rem; font-weight: 800; line-height: 1.3; border-radius: 10px; padding: 4px 10px; }
.pren-tag.me { color: #5ee6a0; background: rgba(47, 163, 111, .16); }
.pren-tag.other { color: #ff8a7a; background: rgba(224, 83, 63, .12); }

/* nastro sulla foto: verde brillante se ci pensi tu, rosso spento se ci ha già pensato un altro */
.pren-ribbon {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; pointer-events: none;
  padding: 9px 10px; text-align: center; font-weight: 800; font-size: .86rem; letter-spacing: .01em;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.pren-ribbon.me {
  background: linear-gradient(90deg, #1f9d5f, #34c47c, #1f9d5f); color: #fff;
  box-shadow: 0 -6px 18px rgba(52, 196, 124, .45); text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.pren-ribbon.other { background: rgba(92, 22, 22, .92); color: #ffb3a8; }
.pren-ribbon { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) { .pren-ribbon { font-size: .78rem; padding: 8px 6px; } }
.card.reserved-me { border-color: #34c47c; box-shadow: 0 0 0 2px #34c47c, 0 10px 30px -10px rgba(52, 196, 124, .55); }
.card.reserved { border-color: rgba(224, 83, 63, .45); }
.card.reserved .thumb img { filter: grayscale(.85) brightness(.75); }
.card.reserved h3 { opacity: .6; }

/* ---------- barra filtri (lista pubblica e gestione): una colonna di etichette, righe allineate ---------- */
.filterbar {
  --fb-label: 112px;
  display: grid; gap: 10px; margin-bottom: 18px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.filterbar-sticky {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 58px); z-index: 5;
  background: var(--bg); box-shadow: 0 8px 18px -12px rgba(0, 0, 0, .7);
  max-height: calc(100vh - 80px); overflow-y: auto;
}
.fb-top { display: flex; gap: 8px; }
.fb-top input { flex: 1; min-width: 0; font-size: 1rem; }
.fb-top select { flex: none; max-width: 46%; }

.fb-head {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 2px; border-top: 1px solid var(--line); padding-top: 12px;
}
.fb-head::-webkit-details-marker { display: none; }
.fb-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: .95rem; }
.fb-toggle svg { width: 18px; height: 18px; stroke: var(--gold); stroke-width: 2.2; fill: none; stroke-linecap: round; }
.fb-toggle::after { content: "▾"; color: var(--muted); font-size: .8rem; transition: transform .15s; }
.fb-panel[open] .fb-toggle::after { transform: rotate(180deg); }
.fb-active {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--gold); color: var(--gold-ink); font-size: .75rem; font-weight: 800;
}
.fb-active[hidden] { display: none; }
.fb-count { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }

.fb-body { display: grid; margin-top: 6px; }
.fb-group {
  display: grid; gap: 8px; padding: 12px 2px; border-top: 1px solid rgba(255, 255, 255, .06);
}
.fb-group:first-child { border-top: 0; }
.fb-label { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.fb-group .chips { flex-wrap: wrap; overflow: visible; gap: 8px; }
.filterbar .chip { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; line-height: 1; }
.filterbar .chip .mini-x { margin: 0; width: 12px; height: 12px; }
.filterbar .chip .mini-x::before, .filterbar .chip .mini-x::after { top: 4px; height: 3px; }

.fb-price { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fb-price input[type=range] {
  flex: 1 1 160px; min-width: 0; padding: 0; border: 0; background: transparent; accent-color: var(--gold); height: 36px;
}
.fb-price-out {
  min-width: 64px; text-align: center; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 999px; height: 36px; display: inline-grid; place-items: center; padding: 0 10px;
}

.fb-foot { display: flex; justify-content: flex-end; padding: 10px 2px 2px; border-top: 1px solid rgba(255, 255, 255, .06); }
.fb-reset {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; padding: 4px 2px;
}
.filterbar:not(.has-active) .fb-reset { opacity: .45; pointer-events: none; text-decoration: none; }
.filterbar.has-active .fb-reset { color: var(--gold); }

@media (min-width: 760px) {
  .filterbar { padding: 14px 16px; }
  .fb-group { grid-template-columns: var(--fb-label) 1fr; align-items: center; gap: 16px; }
  .fb-foot { padding-left: calc(var(--fb-label) + 18px); justify-content: flex-start; }
  .fb-price { max-width: 620px; }
}

/* lista desideri: come funziona la prenotazione */
.pren-info { background: var(--surface); border: 1px solid rgba(214, 173, 82, .35); border-radius: var(--radius);
  padding: 16px 18px; margin: 0 0 18px; display: grid; gap: 10px; }
.pren-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; line-height: 1.5; }
.pren-note { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; color: var(--muted); }
.pren-cta { white-space: nowrap; }

.filterbar-sticky { position: static; max-height: none; overflow: visible; box-shadow: none; }

/* riquadro della lista desideri ben visibile: bordo dorato, sfondo caldo, punti grandi */
.pren-info { border: 2px solid var(--gold); background: linear-gradient(180deg, rgba(214, 173, 82, .14), var(--surface) 70%);
  box-shadow: 0 10px 30px -18px rgba(214, 173, 82, .6); }
.pren-points { display: grid; gap: 10px; }
@media (min-width: 760px) { .pren-points { grid-template-columns: 1fr 1fr; } }
.pren-point { margin: 0; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: rgba(11, 22, 18, .55); border: 1px solid rgba(214, 173, 82, .35); line-height: 1.5; }
.pren-ico { font-size: 1.4rem; line-height: 1.2; }
.pren-point strong { color: var(--gold); }

/* riquadro apribile: si vede il titolo e un invito chiaro a toccarlo */
details.pren-info { padding: 0; gap: 0; }
.pren-info-head { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 10px 14px; padding: 16px 18px; }
.pren-info-head::-webkit-details-marker { display: none; }
.pren-apri { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--gold); color: var(--gold-ink); font-weight: 800; font-size: .9rem; white-space: nowrap;
  animation: pren-invito 2.4s ease-in-out infinite; }
.pren-freccia { transition: transform .2s; }
details.pren-info[open] .pren-apri { animation: none; background: transparent; color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
details.pren-info[open] .pren-freccia { transform: rotate(180deg); }
.pren-info-head:hover .pren-apri { filter: brightness(1.08); }
.pren-body { display: grid; gap: 10px; padding: 0 18px 16px; }
@keyframes pren-invito { 0%, 100% { box-shadow: 0 0 0 0 rgba(214, 173, 82, .55); } 50% { box-shadow: 0 0 0 7px rgba(214, 173, 82, 0); } }
@media (prefers-reduced-motion: reduce) { .pren-apri { animation: none; } }

/* solo il pulsante dorato da chiuso; il riquadro compare sotto quando si apre */
details.pren-info { border: 0; background: none; box-shadow: none; }
details.pren-info .pren-info-head { padding: 0; justify-content: flex-start; }
details.pren-info .pren-apri { font-size: 1rem; padding: 10px 18px; }
details.pren-info[open] .pren-apri { animation: none; background: var(--gold); color: var(--gold-ink); box-shadow: none; }
details.pren-info .pren-body { margin-top: 12px; padding: 16px 18px; border: 2px solid var(--gold); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(214, 173, 82, .14), var(--surface) 70%); box-shadow: 0 10px 30px -18px rgba(214, 173, 82, .6); }

/* pulsante «Clicca prima di procedere» a tutta larghezza: si adatta da solo a computer e telefono */
details.pren-info .pren-info-head { display: block; }
details.pren-info .pren-apri { display: flex; width: 100%; box-sizing: border-box; justify-content: center;
  padding: 14px 18px; font-size: 1.05rem; white-space: normal; text-align: center; border-radius: 14px; }
@media (min-width: 760px) { details.pren-info .pren-apri { font-size: 1.15rem; padding: 16px 24px; } }

.prezzi-agg { margin: -8px 0 14px; text-align: right; }

/* le mie prenotazioni: regali da fare e trofei (regali consegnati, bordo dorato) */
.mp-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.mp-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.mp-foto { position: relative; aspect-ratio: 4 / 3; background: #fff; display: grid; place-items: center; }
.mp-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10px; z-index: 1; }
.mp-iniziale { font-family: var(--font-display); font-size: 2.6rem; color: #c9b98f; }
.mp-corpo { padding: 12px 14px 14px; display: grid; gap: 6px; }
.mp-corpo h3 { margin: 0; font-size: 1rem; line-height: 1.3; }
.mp-piede { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mp-vedi { font-weight: 700; text-decoration: none; }
.mp-card.trofeo { border: 2px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box,
              linear-gradient(140deg, #fff1bf, var(--gold) 35%, #8a6416 60%, #f3dc9b 85%, var(--gold)) border-box;
  box-shadow: 0 0 0 1px rgba(214, 173, 82, .25), 0 14px 40px -12px rgba(214, 173, 82, .55); }
.mp-card.trofeo h3 { color: var(--gold); }
.mp-coppa { position: absolute; z-index: 2; top: 10px; right: 10px; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: linear-gradient(140deg, #f3dc9b, var(--gold) 55%, #9c7425); font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.mp-ricevuto { color: var(--gold); font-weight: 700; font-size: .88rem; }
