/* ==========================================================
   Amigo Invisible — estilos
   ========================================================== */
:root {
  --bg: #faf7f2;
  --bg-glow-1: rgba(225, 29, 72, .10);
  --bg-glow-2: rgba(22, 163, 74, .08);
  --surface: #ffffff;
  --surface-2: #f5f1ea;
  --text: #1c1917;
  --muted: #78716c;
  --line: rgba(28, 25, 23, .09);
  --primary: #e11d48;
  --primary-2: #be123c;
  --primary-soft: #ffe4e9;
  --primary-ink: #9f1239;
  --green: #15803d;
  --green-soft: #dcfce7;
  --green-ink: #14532d;
  --gold: #d4a24c;
  --gold-soft: #fdf3dc;
  --gold-ink: #7c5a12;
  --danger: #dc2626;
  --on-primary: #ffffff;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, .05);
  --shadow: 0 1px 2px rgba(28, 25, 23, .04), 0 8px 24px -8px rgba(28, 25, 23, .10);
  --shadow-lg: 0 2px 4px rgba(28, 25, 23, .04), 0 18px 40px -12px rgba(28, 25, 23, .18);
  --radius: 20px;
  --radius-sm: 12px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 16px/1.6 var(--font); color: var(--text); background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 100% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, var(--bg-glow-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-2); text-decoration: none; font-weight: 600; transition: color .15s, background .15s; }
a:hover { color: var(--primary); }
/* Enlaces de texto normales: línea fina solo al pasar el ratón */
a:not([class]):hover {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, var(--primary) 35%, transparent);
}
/* Enlace tipo píldora */
.chip-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-ink); font-size: .8rem; font-weight: 700; line-height: 1.4;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-link:hover { background: color-mix(in srgb, var(--primary) 22%, white); color: var(--primary-ink); }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.02em; font-weight: 700; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
img { max-width: 100%; }
::selection { background: var(--primary-soft); }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
main.wrap { flex: 1; padding-top: 32px; padding-bottom: 48px; }

/* ---------- Cabecera ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 66px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.05rem; text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark {
  position: relative; flex: none;
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 21px;
  background: linear-gradient(135deg, var(--primary), #f97316); box-shadow: 0 6px 16px -6px var(--primary);
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1);
}
.brand-gift { position: absolute; right: -7px; bottom: -6px; font-size: 15px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.brand:hover .brand-mark { transform: rotate(-10deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; }
.brand-by { font-size: .7rem; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }
.topbar nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .topbar .linkish {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .93rem; padding: 8px 12px; border-radius: 999px;
}
.topbar nav a:hover, .topbar .linkish:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar nav a.btn { color: var(--on-primary); margin-left: 4px; }
.topbar nav a.btn:hover { background: var(--primary-2); color: var(--on-primary); }

.lang-switch { display: inline-flex; margin-left: 6px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.topbar nav .lang-switch a { padding: 4px 10px; font-size: .78rem; font-weight: 800; letter-spacing: .04em; }
.topbar nav .lang-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Tarjetas y estructura ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1, .page-head h2 { margin: 0; }
main > p:first-child a, .back { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
main > p:first-child a:hover { color: var(--text); }

.group-card { display: flex; flex-direction: column; gap: 10px; color: inherit; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; position: relative; overflow: hidden; }
.group-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), #f97316, var(--gold)); }
.group-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: inherit; border-color: transparent; }
.group-card h2 { margin: 4px 0 0; font-size: 1.2rem; }
.group-card p { margin: 0; }
.group-card .price-tag { align-self: flex-start; }
.group-card .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }

/* ---------- Portada ---------- */
.hero { text-align: center; padding: 48px 0 24px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow-sm); margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.9rem); max-width: 820px; margin: 0 auto 18px; line-height: 1.05; }
.hero h1 em { font-style: italic; background: linear-gradient(120deg, var(--primary), #f97316 60%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: .06em; }
.lead { font-size: clamp(1.02rem, 2vw, 1.18rem); max-width: 600px; margin: 0 auto 30px; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 56px; }
.steps .card { margin: 0; }
.steps h3 { margin-top: 14px; }
.steps p { margin: 0; color: var(--muted); font-size: .95rem; }
.step-n {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem;
  background: var(--primary-soft); color: var(--primary-ink); font-weight: 800;
}

/* ---------- Grupo ---------- */
.group-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.group-head > div:first-child { flex: 1 1 320px; }
.group-head h1 { margin-bottom: 6px; font-size: clamp(1.3rem, 3vw, 1.75rem); line-height: 1.2; overflow-wrap: anywhere; }
.desc { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 16px; margin: 14px 0 0; }
.price-box {
  position: relative; overflow: hidden; color: #fff; border-radius: 18px; padding: 18px 26px; min-width: 190px; text-align: left;
  background: linear-gradient(135deg, var(--primary-2), var(--primary) 55%, #f97316);
  box-shadow: 0 14px 30px -12px rgba(225, 29, 72, .55);
}
.price-box::after { content: "🎁"; position: absolute; right: -6px; bottom: -14px; font-size: 64px; opacity: .22; transform: rotate(-12deg); }
.price-box span { display: block; font-size: .75rem; font-weight: 700; opacity: .9; text-transform: uppercase; letter-spacing: .1em; }
.price-box strong { display: block; font-family: var(--font-display); font-size: 2.3rem; line-height: 1.1; font-weight: 600; }
.price-tag {
  display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary-ink);
  font-weight: 700; font-size: .9rem; padding: 6px 14px; border-radius: 999px;
}
.target {
  text-align: center; padding: 36px 24px; border: 0; color: var(--text);
  background:
    radial-gradient(400px 200px at 50% 0%, var(--green-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
}
.target h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 5vw, 2.8rem); color: var(--green); margin: 4px 0 18px; }
.notice { display: flex; gap: 10px; align-items: center; background: var(--gold-soft); border-color: transparent; color: var(--gold-ink); font-weight: 600; box-shadow: none; }

.members { list-style: none; padding: 0; margin: 0 0 20px; }
.members li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.members li:last-child { border-bottom: 0; }
.member-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .95rem;
  color: #fff; background: linear-gradient(135deg, hsl(var(--h, 350) 75% 55%), hsl(calc(var(--h, 350) + 35) 80% 58%));
}
.member-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.owner-zone h2 { display: flex; align-items: center; gap: 8px; }
.owner-zone details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.owner-zone summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.owner-zone summary::-webkit-details-marker { display: none; }
.owner-zone summary::before { content: "›"; display: inline-block; transition: transform .2s; font-size: 1.3rem; line-height: 1; color: var(--muted); }
.owner-zone details[open] summary::before { transform: rotate(90deg); }
.owner-zone details .form { margin-top: 16px; }

/* ---------- Lista de deseos ---------- */
/* Cada regalo es una fila compacta: miniatura a la izquierda, datos a la derecha */
.wishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; margin-bottom: 24px; }
.wish {
  padding: 12px; margin: 0; display: flex; gap: 14px; align-items: flex-start;
  box-shadow: var(--shadow-sm); transition: box-shadow .18s ease, border-color .18s ease;
}
.wish:hover { box-shadow: var(--shadow); }
.wish > a, .wish-noimg { flex: none; width: 92px; height: 92px; border-radius: 12px; overflow: hidden; }
.wish > a { display: block; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.wish img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 4px; background: #fff; transition: transform .3s ease; }
.wish > a:hover img { transform: scale(1.06); }
.wish-noimg { display: grid; place-items: center; font-size: 2rem; background: linear-gradient(135deg, var(--primary-soft), var(--gold-soft)); }
.wish-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; min-height: 92px; }
.wish-body h3 { font-size: .98rem; margin: 0; line-height: 1.3; }
.wish-body p { margin: 0; word-break: break-word; font-size: .86rem; }
.wish-note { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wish-price { font-weight: 800; color: var(--primary-ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wish-body .chip-link { font-size: .74rem; padding: 2px 9px; }
.wish-actions { margin-top: auto; padding-top: 6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.wish-actions .btn-small { padding: 4px 11px; font-size: .78rem; box-shadow: inset 0 0 0 1px var(--line); }
.wish-bought { box-shadow: 0 0 0 2px var(--green), var(--shadow); }
.wish-bought img, .wish-bought .wish-noimg { filter: saturate(.6); }

/* Mi lista: formulario lateral (escritorio) o desplegable arriba (móvil) */
.wl-layout { display: grid; gap: 22px; align-items: start; }
.wl-side .card { margin: 0; }
.wl-form summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 1.05rem; user-select: none;
}
.wl-form summary::-webkit-details-marker { display: none; }
.wl-form[open] summary { margin-bottom: 18px; }
.wl-plus {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary); color: var(--on-primary); font-size: 1.05rem; box-shadow: 0 6px 14px -6px var(--primary);
}
.wl-count { margin-left: auto; font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; }
.wl-full { color: var(--muted); }
.amazon-search {
  display: grid; gap: 8px; padding: 12px 14px; margin-bottom: 18px; border-radius: 14px;
  background: var(--gold-soft); box-shadow: inset 0 0 0 1px rgba(212, 162, 76, .25);
}
.amazon-title { font-weight: 800; font-size: .88rem; color: var(--gold-ink); }
.amazon-row { display: flex; gap: 8px; }
.amazon-row input { padding: 9px 12px; font-size: .92rem; }
.amazon-row .btn { flex: none; }
.amazon-search .check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--text); }
.amazon-search small { font-size: .74rem; line-height: 1.35; }
.wl-hint { margin: 12px 4px 0; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.wl-main .wishes { grid-template-columns: 1fr; margin-bottom: 0; }
.wish-editing { box-shadow: 0 0 0 3px var(--primary), var(--shadow-lg); }
@media (min-width: 900px) {
  .wl-layout { grid-template-columns: 340px minmax(0, 1fr); }
  .wl-side { position: sticky; top: 86px; }
}
@media (max-width: 899px) {
  .wl-form:not([open]) { padding: 16px 18px; }
}

/* Miniaturas de mi lista (página del grupo) */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.thumb { display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; min-width: 0; }
.thumb img, .thumb-noimg {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: grid; place-items: center; font-size: 2rem;
  border-radius: 14px; background: linear-gradient(135deg, var(--primary-soft), var(--gold-soft));
  box-shadow: inset 0 0 0 1px var(--line); transition: transform .18s ease, box-shadow .18s ease;
}
.thumb img { object-fit: contain; background: #fff; padding: 4px; }
.thumb:hover img, .thumb:hover .thumb-noimg { transform: translateY(-2px); box-shadow: var(--shadow); }
.thumb-title { font-size: .82rem; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb:hover { color: var(--primary-2); }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 7px; font-weight: 600; font-size: .93rem; }
.form small { font-weight: 500; color: var(--muted); font-size: .82rem; }
.form .lbl { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.form .lbl small { font-size: .76rem; }
.form label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
input, textarea, select {
  font: inherit; font-size: 1rem; width: 100%; padding: 12px 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input:hover, textarea:hover { border-color: color-mix(in srgb, var(--text) 22%, transparent); }
input:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); box-shadow: none; }
input[type=file] { padding: 10px; cursor: pointer; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 700; font-size: .88rem; border: 0; border-radius: 999px; padding: 7px 14px; margin-right: 12px;
  background: var(--primary-soft); color: var(--primary-ink); cursor: pointer;
}
.form-row { grid-template-columns: 1fr 1.4fr auto; align-items: center; }
form.inline { display: inline; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: var(--on-primary); border: 0; border-radius: 999px; padding: 12px 22px;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 18px -8px var(--primary); transition: transform .12s ease, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--primary-2); color: var(--on-primary); transform: translateY(-1px); box-shadow: 0 10px 24px -10px var(--primary); }
.btn:active { transform: translateY(0); }
.btn[disabled] { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed; transform: none; }
.btn-ghost { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn-small { padding: 7px 14px; font-size: .86rem; }
.btn-big { font-size: 1.1rem; padding: 16px 30px; }
.btn-danger { background: var(--danger); box-shadow: none; }
.btn-danger:hover { background: #b91c1c; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--primary-2); cursor: pointer; transition: color .15s; }
.linkish:hover { color: var(--primary); }
.member-actions .linkish { padding: 4px 10px; border-radius: 999px; font-size: .8rem; }
.member-actions .linkish:hover { background: var(--surface-2); }
.danger, .linkish.danger, .btn-ghost.danger { color: var(--danger); }

/* ---------- Avisos y etiquetas ---------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; margin-bottom: 18px;
  font-weight: 500; border: 1px solid transparent;
}
.flash::before { flex: none; font-size: 1.05rem; line-height: 1.5; }
.flash-ok    { background: var(--green-soft); color: var(--green-ink); }
.flash-ok::before { content: "✓"; font-weight: 800; }
.flash-error { background: var(--primary-soft); color: var(--primary-ink); }
.flash-error::before { content: "!"; font-weight: 800; }
.flash-info  { background: var(--gold-soft); color: var(--gold-ink); }
.flash-info::before { content: "ℹ"; }
.flash form.inline { display: inline; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); vertical-align: middle; letter-spacing: .01em;
}
.badge-ok    { background: var(--green-soft); color: var(--green-ink); }
.badge-wait  { background: var(--gold-soft); color: var(--gold-ink); }
.badge-owner { background: var(--primary-soft); color: var(--primary-ink); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

.footer { text-align: center; color: var(--muted); padding: 28px 20px 40px; font-size: .88rem; border-top: 1px solid var(--line); }

/* ---------- Móvil ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 22px; }
  .card { padding: 18px; border-radius: 18px; }
  .card.wish { padding: 10px; border-radius: 16px; }
  .wishes, .wl-main .wishes { grid-template-columns: 1fr; gap: 10px; }
  .wish { gap: 12px; }
  .wish > a, .wish-noimg { width: 76px; height: 76px; }
  .wish-body { min-height: 76px; }
  .wish-body h3 { font-size: .93rem; }
  .form-row { grid-template-columns: 1fr; }
  .price-box { width: 100%; }
  .topbar-inner { min-height: 58px; }
  .topbar nav a, .topbar .linkish { padding: 6px 9px; font-size: .88rem; }
  .brand-text { display: none; }
  .hero { padding-top: 28px; }
  .steps { margin-top: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
