/**
 * temas.css — Catálogo de Temas
 * Usado em: /temas/index.html
 * Depende de: tokens.css, base.css
 */

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text-body);
  overflow-x: hidden;
  min-height: 100svh;
  padding-bottom: 100px;
  display: block;
  align-items: unset;
}

/* Override bg-layer gradient (mais sutil que a linktree) */
.bg-layer {
  background:
    radial-gradient(ellipse 120% 40% at 50% 0%, rgba(236,136,192,0.12) 0%, transparent 55%),
    var(--cream);
}

/* ── Header ── */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(253,248,242,0.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(236,136,192,0.08);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  max-width: 1122px; margin-left: auto; margin-right: auto; left: 0; right: 0;
}
.header-back {
  width: 36px; height: 36px; border-radius: 50%;
  background: white; border: 1px solid rgba(236,136,192,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--rose); text-decoration: none; flex-shrink: 0; transition: background 0.2s;
}
.header-back:hover { background: var(--rose-pale); }
.header-avatar { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--rose); object-fit: cover; object-position: top; }
.header-info { flex: 1; }
.header-title { font-family: var(--font-serif); font-size: 1rem; font-weight: 700; color: var(--warm-dark); }
.header-sub { font-size: 10px; color: var(--text-muted); }

/* ── Page ── */
.page { position: relative; z-index: 1; max-width: 1122px; margin: 0 auto; }

/* ── Hero ── */
.hero { padding: 28px 20px 0; }
.hero-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--rose); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.hero h1 { font-family: var(--font-serif); font-size: clamp(1.7rem, 7vw, 2.4rem); font-weight: 900; line-height: 1.1; color: var(--warm-dark); margin-bottom: 8px; }
.hero h1 em { font-style: italic; color: var(--rose); }
.hero-sub { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── Search ── */
.search-wrap { padding: 20px 20px 0; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: white; border: 1px solid rgba(236,136,192,0.15);
  border-radius: var(--radius-md); padding: 11px 16px;
  box-shadow: var(--shadow-card); transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within { border-color: rgba(236,136,192,0.4); box-shadow: var(--shadow-md); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input { flex: 1; border: none; outline: none; font-family: var(--font-sans); font-size: 14px; color: var(--text-body); background: transparent; }
.search-box input::placeholder { color: var(--text-muted); opacity: 0.6; }
#search-clear { background: none; border: none; cursor: pointer; color: var(--text-muted); display: none; align-items: center; padding: 2px; }
#search-clear.visible { display: flex; }

/* ── Results ── */
.results-bar { padding: 16px 20px 10px; }
.results-label { font-size: 12px; color: var(--text-muted); }
.results-label strong { color: var(--rose); font-weight: 700; }

/* ── Grid ── */
.grid { padding: 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 420px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: white; border-radius: var(--radius-md);
  border: 1px solid rgba(236,136,192,0.08);
  overflow: hidden; cursor: pointer;
  box-shadow: 0 2px 12px rgba(236,136,192,0.05);
  transition: var(--transition); animation: cardIn 0.4s ease both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: rgba(236,136,192,0.22); }
.card:active { transform: scale(0.97); }

.card-img-wrap { width: 100%; aspect-ratio: 1; background: var(--rose-pale); overflow: hidden; position: relative; }
.card-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s; }
.card:hover .card-img { transform: scale(1.06); }
.card-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--rose); opacity: 0.4; gap: 8px; padding: 10px; text-align: center; }
.card-err-name { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-shimmer {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, var(--rose-pale) 25%, rgba(249,238,240,0.5) 50%, var(--rose-pale) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}

.card-body { padding: 11px 12px 13px; }
.card-name { font-weight: 700; font-size: 13px; color: var(--warm-dark); line-height: 1.3; }

/* Botão de copiar no card */
.btn-copy-sm {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(236,136,192,0.1);
  color: var(--rose);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  opacity: 0; /* Começa invisível (desktop) */
}
.card:hover .btn-copy-sm { opacity: 0.6; }
.card:hover .btn-copy-sm:hover { transform: scale(1.1); opacity: 1; border-color: var(--rose); }
.btn-copy-sm.copied { background: var(--rose); color: white; border-color: var(--rose); opacity: 1 !important; }

/* Em dispositivos touch (sem hover), o botão precisa ser visível (60% já é discreto) */
@media (hover: none) {
  .btn-copy-sm { opacity: 0.6; }
}

/* ── Empty state ── */
.empty-state { grid-column: 1 / -1; text-align: center; padding: 48px 0; }
.empty-icon { color: var(--rose); opacity: 0.25; display: flex; justify-content: center; margin-bottom: 12px; }
.empty-title { font-family: var(--font-serif); font-weight: 700; font-size: 1.1rem; color: var(--warm-dark); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── Custom CTA ── */
.custom-cta { margin: 32px 20px 0; background: var(--warm-dark); border-radius: var(--radius-lg); padding: 24px; text-align: center; position: relative; overflow: hidden; }
.custom-cta::before { content: ''; position: absolute; top: -60px; left: -60px; width: 160px; height: 160px; background: radial-gradient(circle, rgba(236,136,192,0.3) 0%, transparent 70%); }
.custom-cta::after { content: ''; position: absolute; bottom: -40px; right: -40px; width: 120px; height: 120px; background: radial-gradient(circle, rgba(212,168,83,0.2) 0%, transparent 70%); }
.custom-cta-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-light); margin-bottom: 6px; position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }
.custom-cta h3 { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 800; color: white; margin-bottom: 8px; position: relative; z-index: 1; }
.custom-cta p { font-size: 13px; color: rgba(255,255,255,0.6); line-height: 1.5; margin-bottom: 20px; position: relative; z-index: 1; }
.btn-cta-dark {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--rose); color: white; padding: 14px 20px;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 14px;
  text-decoration: none; box-shadow: var(--shadow-cta);
  position: relative; z-index: 1; transition: transform 0.2s;
}
.btn-cta-dark:hover { transform: translateY(-1px); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(45,20,53,0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  width: 100%; max-width: 520px; max-height: 92svh;
  background: var(--cream); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.34, 1.1, 0.64, 1);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-handle { width: 36px; height: 4px; background: rgba(236,136,192,0.2); border-radius: 2px; margin: 12px auto 0; flex-shrink: 0; }

/* Gallery */
.modal-gallery { position: relative; flex-shrink: 0; background: var(--rose-pale); max-height: 55vh; }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; max-height: 55vh; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex-shrink: 0; width: 100%; aspect-ratio: 1; scroll-snap-align: start; max-height: 55vh; }
.gallery-slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-slide video { width: 100%; height: 100%; object-fit: contain; display: block; }
.gallery-loading { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; max-height: 55vh; }
.gallery-slide-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--rose); opacity: 0.4; gap: 12px; }
.gallery-slide-placeholder span { font-size: 13px; font-weight: 600; color: var(--warm-dark); background: rgba(255,255,255,0.6); padding: 4px 12px; border-radius: var(--radius-sm); }

.gallery-dots { display: flex; justify-content: center; gap: 5px; padding: 10px 0 4px; flex-wrap: wrap; max-width: 80%; margin: 0 auto; }
.gallery-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(236,136,192,0.2); transition: all 0.2s; cursor: pointer; flex-shrink: 0; }
.gallery-dot.active { background: var(--rose); width: 18px; border-radius: 3px; }

.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(253,248,242,0.9); border: 1px solid rgba(236,136,192,0.15);
  display: flex; align-items: center; justify-content: center;
  color: var(--rose); cursor: pointer; backdrop-filter: blur(4px);
  transition: background 0.2s; z-index: 2;
}
.gallery-nav:hover { background: white; }
.gallery-nav:disabled { opacity: 0.25; pointer-events: none; }
.gallery-nav.prev { left: 10px; }
.gallery-nav.next { right: 10px; }

.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(45,20,53,0.5); color: white;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); transition: background 0.2s;
}
.modal-close:hover { background: rgba(45,20,53,0.75); }

.modal-copy {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75); color: var(--rose);
  border: 1px solid rgba(236,136,192,0.15);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); transition: all 0.2s;
}
.modal-copy:hover { background: white; border-color: var(--rose); transform: scale(1.05); }
.modal-copy.copied { background: var(--rose); color: white; border-color: var(--rose); }

/* Ajuste fino para mobile: sempre visível com fundo mais sólido se necessário */
@media (max-width: 480px) {
  .modal-copy { background: white; opacity: 1; }
}

/* Modal body */
.modal-body { overflow-y: auto; padding: 20px 20px 36px; flex: 1; }
.modal-name { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 900; color: var(--warm-dark); margin-bottom: 4px; line-height: 1.2; }
.modal-collection { font-size: 12px; color: var(--text-muted); font-style: italic; margin-bottom: 20px; }
.modal-img-count { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); background: var(--rose-pale); padding: 4px 10px; border-radius: var(--radius-pill); margin-bottom: 20px; }
.modal-img-count strong { color: var(--rose); }

.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-whatsapp {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--rose); color: white; padding: 16px;
  border-radius: var(--radius-md); font-weight: 700; font-size: 15px;
  text-decoration: none; box-shadow: var(--shadow-cta); transition: transform 0.2s;
}
.btn-whatsapp:hover { transform: translateY(-1px); }

.btn-personalizado {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #4A8FD4 0%, #1E3D6B 100%); color: white;
  border: none; padding: 14px;
  border-radius: var(--radius-md); font-weight: 600; font-size: 14px;
  text-decoration: none; transition: var(--transition);
  box-shadow: 0 4px 16px rgba(30,61,107,0.25);
}
.btn-personalizado:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(30,61,107,0.35); }

.spin { animation: spin 1s linear infinite; }

/* ── WhatsApp FAB ── */
.whatsapp-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: flex; align-items: center; gap: 8px;
  background: var(--gradient-primary); color: white;
  text-decoration: none; padding: 14px 20px;
  border-radius: var(--radius-pill); font-weight: 700; font-size: 14px;
  transition: transform 0.2s;
  animation: fadeUp 0.6s 1s ease both, pulse-glow 2.5s 1.6s ease-in-out infinite;
  opacity: 0;
}
.whatsapp-fab:hover { transform: translateY(-3px); }
