:root {
  --bg: #f7f5f1;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #7a7a7a;
  --primary: #b85c5c;
  --primary-dark: #9a4747;
  --border: #e4e0d8;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  --reserved: #cfd8cf;
  --danger: #b23b3b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
}

.wrap {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
}
.site-header nav a, .site-header nav .link-btn {
  margin-left: 12px;
  font-size: 0.95rem;
  color: var(--primary-dark);
  text-decoration: none;
}

/* Flash */
.flash {
  background: #fff7e6;
  border: 1px solid #f0d8a8;
  color: #8a5b00;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin: 16px 0;
}
.flash p { margin: 0; }

/* Hero */
.hero { padding: 24px 0 8px; text-align: center; }
.hero h1 { margin: 0 0 6px; font-size: 1.8rem; }
.lede { color: var(--muted); max-width: 560px; margin: 0 auto; }

/* Wishlist toolbar & reserved warning */
.wishlist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 16px 0 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.wt-info { color: var(--muted); font-size: 0.9rem; }
.reserved-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin: 16px 0 0;
  background: #fff4e6;
  border: 1px solid #f0c987;
  border-radius: var(--radius);
  color: #8a5b00;
}
.reserved-warning .rw-text { font-size: 0.92rem; }

/* Landing */
.landing { padding: 36px 0; text-align: center; }
.landing h1 { font-size: 2rem; margin-bottom: 8px; }
.landing .small { display: block; margin-top: 18px; }
.choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 640px;
  margin: 24px auto 8px;
}
.choice-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 18px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, border-color 0.15s ease;
}
.choice-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.choice-emoji { font-size: 2rem; }
.choice-title { font-weight: 700; font-size: 1.05rem; }
.choice-sub { color: var(--muted); font-size: 0.88rem; }
@media (max-width: 540px) {
  .choice { grid-template-columns: 1fr; }
}

/* Grid of gift cards */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  padding: 20px 0 40px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card.reserved { opacity: 0.85; }
.card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #eee;
}
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card-top h3 { margin: 0; font-size: 1.05rem; }
.price { color: var(--primary); font-weight: 600; white-space: nowrap; }
.desc { color: #555; font-size: 0.92rem; margin: 0; }

/* Description: clamp to N lines with a "ver más" toggle (added via JS) */
.desc.clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.desc.clamp.expanded {
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
  display: block;
}
.desc-toggle {
  background: none; border: none; padding: 2px 0 0;
  color: var(--primary-dark); cursor: pointer;
  font-size: 0.85rem; font-weight: 600;
}

/* Status & reserve */
.status { margin: 4px 0 0; font-weight: 600; }
.available-badge {
  color: #2f6a3a;
  background: #eaf6ec;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.88rem;
}
.multi-links { margin: 0; }
.multi-links-title { margin: 0 0 4px; font-size: 0.85rem; color: var(--text); }
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.link-list li a { font-size: 0.9rem; }

.reserved-badge { color: #4a6a4a; }

/* Exploration indicator (public): subtle left-border tag, distinct from status badge */
.exploration {
  margin: 2px 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  padding: 6px 10px 6px 12px;
  border-radius: 6px;
  border-left: 4px solid transparent;
  background: #f4f1fa;
  color: #4a4458;
}
.exploration.yes { border-left-color: #6b5bb5; background: #f4f1fa; color: #4a3f7a; }
.exploration.no { border-left-color: #d98324; background: #fdf3ea; color: #8a4f12; }

/* Admin exploration badge */
.badge.expl-yes { background: #eaf6ec; color: #2f6a3a; }
.badge.expl-no { background: #fdf0e6; color: #9a5223; }
.note {
  margin: 4px 0 0;
  padding: 8px 10px;
  background: #f1f5f1;
  border-left: 3px solid #9bbd9b;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #3d4d3d;
}
.reserve summary.btn { list-style: none; cursor: pointer; }
.reserve[open] summary.btn { display: none; }
.reserve-form { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

/* Forms */
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  color: #444;
}
input[type="text"], input[type="url"], input[type="password"],
input[type="number"], input[type="file"], textarea, select, input.copy-url {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--text);
  width: 100%;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7a7a' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
textarea { min-height: 60px; resize: vertical; }
input.copy-url { font-family: monospace; font-size: 0.85rem; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Buttons */
.btn, .link-btn {  display: inline-block;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: #fff;
  color: var(--primary-dark);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.inline { display: inline; }
.link-btn { background: none; border: none; color: var(--primary-dark); padding: 0; }

/* Confirmation / login / admin sections */
.confirm, .login, .admin-top, .admin-list { padding: 24px 0; }
.confirm { text-align: center; }
.confirm .gift-name { font-size: 1.25rem; font-weight: 700; }
.notice {
  background: #eef6ff;
  border: 1px solid #cfe3ff;
  padding: 14px;
  border-radius: var(--radius);
  margin: 18px auto;
  max-width: 520px;
  text-align: left;
}
.muted { color: var(--muted); }
.empty { padding: 30px 0; text-align: center; color: var(--muted); }

.form-card { padding: 18px; margin: 16px 0; }
.form-card h2 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Admin list */
.gift-card { padding: 0; overflow: hidden; }
.gift-card summary { cursor: pointer; }
.gift-head {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.gift-head::-webkit-details-marker { display: none; }
.gift-thumb {
  width: 52px; height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #eee;
}
.gift-thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.gift-head-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gift-head-info .g-title { font-weight: 600; }
.gift-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.edit-toggle {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
  background: #fff;
}
.gift-card[open] .edit-toggle { background: var(--primary); color: #fff; }
.gift-card[open] .edit-toggle::after { content: "▴"; margin-left: 4px; }
.gift-edit {
  padding: 4px 14px 14px;
  border-top: 1px dashed var(--border);
  margin-top: 0;
}
.gift-card.archived { opacity: 0.65; }
.badge, .muted-badge {
  font-size: 0.72rem; padding: 2px 7px; border-radius: 999px;
  background: #eee; color: #555;
}
.row-actions { display: flex; gap: 10px; align-items: center; }
.delete-form { margin-top: 10px; }

footer.site-footer { margin-top: 40px; padding: 18px 0; color: var(--muted); text-align: center; }

/* Admin image manager */
.img-manager {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.img-manager-head { font-weight: 600; margin-bottom: 8px; }
.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del {
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.thumb-del:hover { background: var(--danger); }
.img-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Image modal / lightbox */
.modal { position: fixed; inset: 0; z-index: 1000; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
}
.modal-box {
  position: relative;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
}
.modal-box-center { max-width: 520px; }
.confirm-card {
  position: relative;
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.confirm-card h2 { margin: 0 0 10px; font-size: 1.15rem; }
.confirm-card p { margin: 0 0 12px; font-size: 0.94rem; color: #444; }
.confirm-check { margin: 4px 0 14px; font-size: 0.92rem; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.btn.primary.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}
.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.modal-close:hover { background: rgba(255,255,255,0.3); }
.modal-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.modal-stage img {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 8px;
}
.modal-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 4px 4px;
  overflow-x: auto;
  max-width: 100%;
}
.modal-thumbs img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.6;
  border: 2px solid transparent;
}
.modal-thumbs img.active { opacity: 1; border-color: var(--primary); }

@media (max-width: 540px) {
  .row2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.5rem; }
  .io-grid { grid-template-columns: 1fr; }
}

/* Export / Import section */
.io-section h2 { margin-top: 0; }
.io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}
.io-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.io-import { background: #fff; }
.io-emoji { font-size: 1.5rem; line-height: 1; }
.io-block .muted.small { margin: 0; font-size: 0.85rem; }
.io-block .btn { margin-top: 2px; }

/* Custom file input that matches the rest of the form */
.io-file { position: relative; width: 100%; }
.io-file input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  padding: 0;
  border: none;
}
.io-file > span {
  display: block;
  padding: 9px 10px;
  border: 1px dashed var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary-dark);
  font-size: 0.88rem;
  text-align: center;
}
.io-file input[type="file"]:focus + span {
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(184, 92, 92, 0.15);
}
