/* ============================================================
   Liste de cadeaux — direction éditoriale / papeterie
   Papier crème · serif Fraunces · accents terracotta & sauge
   ============================================================ */

:root {
  --paper:    #f4ede0;   /* fond papier chaud */
  --paper-2:  #efe6d6;   /* fond alterné */
  --surface:  #fffdf8;   /* cartes */
  --ink:      #2c2722;   /* texte principal */
  --ink-soft: #6f655a;   /* texte secondaire */
  --line:     #e0d4bf;   /* filets */
  --line-ink: #d6c8af;
  --clay:     #b14a32;   /* accent principal (terracotta) */
  --clay-dk:  #963c27;
  --sage:     #5c7359;   /* réservé / secondaire */
  --sage-dk:  #44563f;
  --ochre:    #9a7320;   /* prix */
  --gold:     #c79a3e;
  --radius:   4px;
  --radius-lg: 8px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(120,100,70,.05) 1px, transparent 0);
  background-size: 22px 22px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

.wrap { max-width: 1040px; margin: 0 auto; padding: 40px 22px 100px; }

/* ---------- En-tête ---------- */
header.page { text-align: center; margin: 18px auto 44px; max-width: 680px; }
.overline {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--clay);
  font-weight: 600;
  margin-bottom: 16px;
  position: relative;
}
.overline::before, .overline::after {
  content: ""; position: absolute; top: 50%; width: 34px; height: 1px;
  background: var(--line-ink);
}
.overline::before { right: calc(100% + 14px); }
.overline::after  { left: calc(100% + 14px); }

header.page h1 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.015em;
}
header.page p {
  color: var(--ink-soft);
  margin-top: 14px;
  font-size: 1.05rem;
}

/* ---------- Barre d'outils (admin) ---------- */
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.toolbar .left { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Grille ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 26px;
}

/* ---------- Carte cadeau ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-ink);
  box-shadow: 0 14px 30px -18px rgba(70,50,30,.5);
}
.card.reserved { background: var(--paper-2); }
.card.reserved .thumb,
.card.reserved h3,
.card.reserved .desc,
.card.reserved .price { opacity: .55; filter: saturate(.7); }

.card .thumb {
  aspect-ratio: 4 / 3;
  background: #efe7d6 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--line);
}
.card .thumb .ph { font-size: 2.8rem; opacity: .35; }

/* Étiquettes coin */
.badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--sage); color: #f6f2e8;
  font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.badge.prio {
  background: transparent; color: var(--clay);
  left: auto; right: 12px; box-shadow: none;
  border: 1px solid var(--clay); padding: 4px 10px;
}

/* Tampon "Réservé" sur les cartes prises */
.card.reserved::after {
  content: "Réservé";
  position: absolute; top: 30%; left: 50%;
  transform: translate(-50%,-50%) rotate(-11deg);
  font-family: var(--serif); font-style: italic; font-weight: 600;
  font-size: 1.5rem; letter-spacing: .04em;
  color: var(--clay);
  border: 2.5px solid var(--clay);
  border-radius: 6px; padding: 4px 18px;
  opacity: .85; pointer-events: none;
  box-shadow: 0 1px 0 rgba(177,74,50,.2);
}

.card .body { padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card h3 {
  font-family: var(--serif); font-weight: 500;
  font-size: 1.3rem; line-height: 1.2; letter-spacing: -.01em;
}
.card .desc { color: var(--ink-soft); font-size: .92rem; flex: 1; }
.card .price {
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem;
  color: var(--ochre);
}
.card .row { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; align-items: center; }

/* ---------- Boutons & liens ---------- */
a.link, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: var(--sans); font-size: .92rem; font-weight: 600;
  padding: 11px 18px; border-radius: var(--radius);
  border: 1px solid var(--line-ink); background: transparent; color: var(--ink);
  text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .05s;
}
.btn:hover, a.link:hover { background: #efe7d6; }
.btn:active { transform: translateY(1px); }

.btn.primary { background: var(--clay); border-color: var(--clay); color: #fdf6ee; }
.btn.primary:hover { background: var(--clay-dk); border-color: var(--clay-dk); }
.btn.accent2 { background: var(--sage); border-color: var(--sage); color: #f6f2e8; }
.btn.accent2:hover { background: var(--sage-dk); border-color: var(--sage-dk); }
.btn.ghost { border-color: var(--line); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger { border-color: #d8b3a8; color: var(--clay-dk); background: transparent; }
.btn.danger:hover { background: #f3e2db; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.sm { padding: 7px 13px; font-size: .84rem; }

a.link.sm {
  border: none; padding: 0; color: var(--clay); background: none;
  font-weight: 600; text-underline-offset: 3px;
}
a.link.sm:hover { background: none; text-decoration: underline; }

/* États réservé */
.tag-reserved {
  color: var(--sage-dk); font-weight: 600; font-size: .92rem;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--serif); font-style: italic;
}
.tag-mine {
  color: var(--clay-dk); font-weight: 700; font-size: .85rem;
  display: inline-flex; align-items: center; gap: 6px;
}

.empty {
  text-align: center; color: var(--ink-soft);
  padding: 70px 20px; font-family: var(--serif); font-style: italic; font-size: 1.15rem;
}

/* ---------- Modales ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(44,39,34,.45);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-bg.show { display: flex; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--line-ink);
  border-radius: var(--radius-lg);
  padding: 30px 30px 28px; max-width: 460px; width: 100%;
  box-shadow: 0 30px 60px -25px rgba(50,35,20,.5);
}
.modal h2 {
  font-family: var(--serif); font-weight: 500; font-size: 1.6rem;
  letter-spacing: -.01em; margin-bottom: 4px;
}
.modal p.sub {
  color: var(--clay); font-family: var(--serif); font-style: italic;
  font-size: 1.05rem; margin-bottom: 18px;
}

label {
  display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin: 16px 0 6px;
}
input[type=text], input[type=password], input[type=url], textarea {
  width: 100%; background: #fffefb; border: 1px solid var(--line-ink); color: var(--ink);
  border-radius: var(--radius); padding: 12px 14px; font-size: .98rem; font-family: var(--sans);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #b3a896; }
input:focus, textarea:focus {
  outline: none; border-color: var(--clay);
  box-shadow: 0 0 0 3px rgba(177,74,50,.12);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }

.check {
  display: flex; align-items: center; gap: 9px; margin-top: 18px;
  color: var(--ink); font-size: .92rem; text-transform: none; letter-spacing: 0; font-weight: 500;
}
.check input { width: auto; accent-color: var(--clay); transform: scale(1.15); }

.modal-actions { display: flex; gap: 12px; margin-top: 26px; }
.modal-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: #f6f1e7;
  padding: 13px 22px; border-radius: var(--radius); font-size: .92rem; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--clay-dk); }

/* ---------- Divers ---------- */
.muted-link {
  color: var(--ink-soft); font-size: .82rem; text-decoration: none;
  letter-spacing: .04em; border-bottom: 1px solid transparent; padding-bottom: 1px;
}
.muted-link:hover { color: var(--clay); border-bottom-color: var(--clay); }

#revealHint {
  font-family: var(--sans); font-style: normal;
  background: #f6ecd9; border: 1px solid var(--gold); border-radius: var(--radius);
  padding: 12px 16px !important; margin-bottom: 24px; color: var(--ochre); font-size: .9rem;
}

/* ---------- Barre filtres / tri (public) ---------- */
.filterbar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  flex-wrap: wrap; margin-bottom: 24px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--sans); font-size: .86rem; font-weight: 600;
  padding: 7px 14px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--line-ink); background: transparent; color: var(--ink-soft);
  transition: all .15s;
}
.chip:hover { background: var(--paper-2); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.sortwrap { display: flex; align-items: center; gap: 14px; }
.count { color: var(--ink-soft); font-size: .85rem; font-family: var(--serif); font-style: italic; }
.sortsel {
  font-family: var(--sans); font-size: .86rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-ink); border-radius: var(--radius);
  padding: 8px 12px; cursor: pointer;
}
.sortsel:focus { outline: none; border-color: var(--clay); }

/* Sélecteur d'affichage (segmenté) */
.viewswitch {
  display: inline-flex; border: 1px solid var(--line-ink);
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.vbtn {
  font-family: var(--sans); font-size: 1rem; line-height: 1;
  padding: 8px 11px; cursor: pointer; border: none; background: transparent;
  color: var(--ink-soft); border-left: 1px solid var(--line-ink);
  transition: background .15s, color .15s;
}
.vbtn:first-child { border-left: none; }
.vbtn:hover { background: var(--paper-2); }
.vbtn.active { background: var(--ink); color: var(--paper); }

/* ===== Vue LISTE : image à gauche, contenu à droite, pleine largeur ===== */
.grid.view-list { grid-template-columns: 1fr; gap: 14px; }
.grid.view-list .card { flex-direction: row; align-items: stretch; }
.grid.view-list .thumb {
  width: 160px; min-width: 160px; aspect-ratio: auto; height: auto;
  border-bottom: none; border-right: 1px solid var(--line);
}
.grid.view-list .body { padding: 18px 22px; }
.grid.view-list .badge { top: 12px; left: 12px; }
.grid.view-list .badge.prio { left: auto; right: auto; }
.grid.view-list .card.reserved::after { top: 50%; left: 80px; }

/* ===== Vue COMPACT : tableau dense, sans image ===== */
.grid.view-compact {
  grid-template-columns: 1fr; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
}
.grid.view-compact .card {
  flex-direction: row; align-items: center;
  border: none; border-bottom: 1px solid var(--line); border-radius: 0;
  box-shadow: none; transform: none !important; background: transparent;
}
.grid.view-compact .card:hover { background: var(--paper-2); }
.grid.view-compact .card:last-child { border-bottom: none; }
.grid.view-compact .thumb,
.grid.view-compact .badge,
.grid.view-compact .desc,
.grid.view-compact .card.reserved::after { display: none; }
.grid.view-compact .body {
  flex-direction: row; align-items: center; gap: 16px;
  padding: 12px 18px; width: 100%; flex-wrap: wrap;
}
.grid.view-compact h3 { font-size: 1.05rem; flex: 1 1 200px; }
.grid.view-compact .price { margin-left: auto; white-space: nowrap; }
.grid.view-compact .row { margin-top: 0; }
.grid.view-compact .btn.full { width: auto; }
.grid.view-compact .card.reserved { opacity: 1; }
.grid.view-compact .card.reserved h3 { opacity: .55; }

/* ---------- Glisser-déposer (admin) ---------- */
.draghint {
  color: var(--ink-soft); font-size: .85rem; margin-bottom: 18px;
  font-style: italic; font-family: var(--serif);
}
.draghint span { font-style: normal; color: var(--clay); }
.drag-handle {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,253,248,.9); border: 1px solid var(--line);
  color: var(--ink-soft); cursor: grab; font-size: 1rem; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.card:hover .drag-handle { opacity: 1; }
.card.dragging { opacity: .45; transform: scale(.98); }
.card[draggable=true] { cursor: default; }

/* ---------- Partage ---------- */
.share-url { display: flex; gap: 8px; margin: 10px 0 18px; }
.share-url input { text-align: center; }
.qr-box {
  display: flex; justify-content: center;
  padding: 14px; background: #fffdf8; border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.qr-box img { display: block; }

/* ---------- Confetti ---------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti-layer i {
  position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 2px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0%   { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(108vh) rotate(540deg); opacity: .9; }
}

@media (max-width: 540px) {
  .grid { grid-template-columns: 1fr; }
  .wrap { padding: 28px 16px 80px; }
  .drag-handle { opacity: 1; }
}
