/* ============================================================
   Wedding Website — Elegant Minimal Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Jost:wght@300;400;500&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* iOS: prevent font scaling and tap flash */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --ivory:      #faf8f4;
  --cream:      #f5f0e8;
  --gold:       #c9a96e;
  --gold-light: #e8d5b0;
  --gold-dark:  #a07840;
  --rose:       #c8998a;
  --rose-light: #f0e0da;
  --sage:       #8a9e8a;
  --charcoal:   #3a3530;
  --muted:      #8a8178;
  --white:      #ffffff;
  --shadow:     0 4px 24px rgba(58, 53, 48, .08);
  --shadow-lg:  0 8px 40px rgba(58, 53, 48, .12);
  --radius:     8px;
  --radius-lg:  16px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  background: var(--ivory);
  color: var(--charcoal);
  line-height: 1.7;
  min-height: 100vh;
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  letter-spacing: .02em;
}

/* ── Flash Messages ───────────────────────────────────────── */
.flash-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 360px;
  margin-left: auto;
}

.flash {
  padding: .85rem 1.25rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 400;
  box-shadow: var(--shadow-lg);
  animation: slideIn .3s ease;
}

.flash.success { background: #e8f5e9; color: #2e7d32; border-left: 3px solid #4caf50; }
.flash.error   { background: #fce4ec; color: #b71c1c; border-left: 3px solid #ef5350; }
.flash.info    { background: #e3f2fd; color: #0d47a1; border-left: 3px solid #42a5f5; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.4rem;
  min-height: 44px; /* touch target */
  border: none;
  border-radius: var(--radius);
  font-family: 'Jost', sans-serif;
  font-size: .9rem;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s ease;
  letter-spacing: .04em;
  text-transform: uppercase;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--white);
}
.btn-primary:hover { background: var(--gold-dark); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-outline {
  background: transparent;
  color: var(--gold-dark);
  border: 1.5px solid var(--gold);
}
.btn-outline:hover { background: var(--gold); color: var(--white); }

.btn-danger {
  background: transparent;
  color: #b71c1c;
  border: 1.5px solid #ef9a9a;
}
.btn-danger:hover { background: #fce4ec; }

.btn-sm { padding: .4rem 1rem; font-size: .8rem; min-height: 38px; }

.btn-pix {
  background: #32BCAD;
  color: #fff;
}
.btn-pix:hover { background: #28a99b; transform: translateY(-1px); box-shadow: var(--shadow); }

/* ============================================================
   PUBLIC PAGE — index.html
   ============================================================ */

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  overflow: hidden;
  background: linear-gradient(135deg, #fdf9f3 0%, #f5ede2 50%, #ede2d4 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(201,169,110,.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(200,153,138,.1) 0%, transparent 60%);
  pointer-events: none;
}

.hero-ornament {
  font-size: 1.8rem;
  color: var(--gold);
  letter-spacing: .3em;
  margin-bottom: 1.5rem;
  opacity: .7;
}

.hero-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--muted);
  letter-spacing: .1em;
  margin-bottom: .5rem;
}

.hero-names {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 300;
  color: var(--charcoal);
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.hero-names .ampersand {
  color: var(--gold);
  font-style: italic;
}

.hero-date {
  font-size: 1rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.hero-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(320px, 80%);
  margin: 0 auto 2.5rem;
}

.hero-divider::before,
.hero-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-light);
}

.hero-divider-icon { color: var(--gold); font-size: 1.2rem; }

.hero-message {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 480px;
  line-height: 1.8;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold);
  font-size: .8rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(-6px); }
}

/* ── Gallery ──────────────────────────────────────────────── */
.section {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-label {
  text-align: center;
  font-size: .75rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .75rem;
}

.section-title {
  text-align: center;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--charcoal);
  margin-bottom: .5rem;
}

.section-subtitle {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  aspect-ratio: 3/4;
  box-shadow: var(--shadow);
}

.gallery-item:nth-child(3n+2) { aspect-ratio: 4/5; }
.gallery-item:nth-child(3n)   { aspect-ratio: 1; }

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}

.gallery-item:hover img { transform: scale(1.04); }

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-style: italic;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
}

/* ── Gift List ────────────────────────────────────────────── */
.gifts-section {
  background: var(--cream);
  padding: 5rem 2rem;
}

.gifts-inner {
  max-width: 900px;
  margin: 0 auto;
}

.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.gift-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
}

.gift-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.gift-card.claimed {
  opacity: .7;
}

.gift-card.claimed::after {
  content: 'Reservado';
  position: absolute;
  top: 1rem;
  right: -2rem;
  background: var(--sage);
  color: var(--white);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .3rem 2.5rem;
  transform: rotate(45deg);
  transform-origin: center;
  right: -1.5rem;
  top: 1.2rem;
}

.gift-card-icon {
  font-size: 2rem;
  color: var(--gold-light);
}

.gift-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--charcoal);
  line-height: 1.2;
}

.gift-description {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.gift-cost {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--gold-dark);
  letter-spacing: .02em;
}

.gift-actions { margin-top: .5rem; }

.gift-claim-btn {
  width: 100%;
  justify-content: center;
  padding: .7rem;
}

.gift-claimed-label {
  text-align: center;
  font-size: .85rem;
  color: var(--sage);
  letter-spacing: .05em;
  padding: .5rem;
}

.gifts-empty {
  text-align: center;
  grid-column: 1 / -1;
  padding: 3rem;
  color: var(--muted);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.2rem;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background: var(--charcoal);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 2.5rem 2rem;
  font-size: .85rem;
}

footer .footer-names {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--gold-light);
  margin-bottom: .5rem;
}

.admin-link {
  display: inline-block;
  margin-top: 1rem;
  color: rgba(255,255,255,.25);
  text-decoration: none;
  font-size: .75rem;
  letter-spacing: .1em;
  transition: color .2s;
}

.admin-link:hover { color: var(--gold-light); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #fdf9f3 0%, #f0e6d8 100%);
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  width: min(420px, 100%);
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo-ornament {
  font-size: 2rem;
  color: var(--gold);
  display: block;
  margin-bottom: .5rem;
}

.auth-title {
  font-size: 2rem;
  color: var(--charcoal);
  text-align: center;
  margin-bottom: .25rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 2rem;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}

.form-control {
  width: 100%;
  padding: .75rem 1rem;
  min-height: 44px; /* touch target */
  border: 1.5px solid #e8e2d8;
  border-radius: var(--radius);
  font-family: 'Jost', sans-serif;
  font-size: 1rem; /* ≥16px prevents iOS auto-zoom */
  color: var(--charcoal);
  background: var(--ivory);
  transition: border-color .2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus { border-color: var(--gold); background: var(--white); }

textarea.form-control { resize: vertical; min-height: 80px; }

.auth-footer-link {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .9rem;
  color: var(--muted);
}

.auth-footer-link a { color: var(--gold-dark); text-decoration: none; }
.auth-footer-link a:hover { text-decoration: underline; }

/* ============================================================
   ADMIN PAGE
   ============================================================ */
.admin-layout {
  min-height: 100vh;
  background: var(--ivory);
}

.admin-header {
  background: var(--charcoal);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.admin-header-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  color: var(--gold-light);
}

.admin-header-nav { display: flex; gap: 1rem; align-items: center; }

.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .admin-main { grid-template-columns: 1fr; }
}

.admin-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.admin-card-title {
  font-size: 1.4rem;
  color: var(--charcoal);
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--cream);
}

/* ── Gift Table ───────────────────────────────────────────── */
.gift-table {
  width: 100%;
  border-collapse: collapse;
}

.gift-table th {
  text-align: left;
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--cream);
}

.gift-table td {
  padding: .9rem .75rem;
  border-bottom: 1px solid var(--cream);
  vertical-align: middle;
  font-size: .9rem;
}

.gift-table tr:last-child td { border-bottom: none; }

.gift-table tr:hover td { background: var(--ivory); }

.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .7rem;
  letter-spacing: .05em;
  font-weight: 500;
}

.badge-claimed    { background: #e8f5e9; color: #2e7d32; }
.badge-available  { background: var(--rose-light); color: var(--rose); }

.table-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: flex-end; /* sheet from bottom on mobile */
  justify-content: center;
  padding: 0;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}

@media (min-width: 600px) {
  .modal-backdrop { align-items: center; padding: 1rem; }
  .modal {
    border-radius: var(--radius-lg);
    width: min(640px, 100%);
    max-height: 90vh;
    padding: 2rem 2.5rem;
  }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  color: var(--charcoal);
}

.modal-footer {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ── Stats ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  color: var(--gold-dark);
  line-height: 1;
  margin-bottom: .25rem;
}

.stat-label {
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Password section ─────────────────────────────────────── */
.admin-section-spacer { margin-top: 1.5rem; }

details summary {
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
  letter-spacing: .05em;
  user-select: none;
  padding: .5rem 0;
}

details summary:hover { color: var(--gold-dark); }

details[open] summary { color: var(--gold-dark); }

.details-body { padding-top: 1rem; }

/* ── Pix Modal ────────────────────────────────────────────── */
.pix-modal-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}

.pix-modal-header .modal-title { margin-bottom: 0; }

.pix-gift-info {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  color: var(--charcoal);
  margin-bottom: 1.25rem;
}

.pix-qr-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.pix-qr-wrapper img {
  border-radius: var(--radius);
  border: 1px solid var(--cream);
  padding: .5rem;
}

.pix-copy-section {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .5rem;
}

.pix-copy-label {
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.pix-payload {
  display: block;
  font-family: monospace;
  font-size: .78rem;
  color: var(--charcoal);
  word-break: break-all;
  line-height: 1.6;
  background: var(--ivory);
  border: 1.5px solid #e8e2d8;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  max-height: 90px;
  overflow-y: auto;
}

.pix-copy-btn { width: 100%; }

.gift-pix-btn { width: 100%; margin-top: .5rem; }

/* ============================================================
   RESPONSIVE — Mobile-first breakpoints
   ============================================================ */

/* ── All mobile (≤480px) ─────────────────────────────────── */
@media (max-width: 480px) {
  /* Hero */
  .hero { padding: 3rem 1.25rem 5rem; min-height: 100dvh; }
  .hero-ornament { font-size: 1.3rem; margin-bottom: 1rem; }
  .hero-names { font-size: 2.6rem; margin-bottom: 1rem; }
  .hero-date { font-size: .85rem; letter-spacing: .15em; margin-bottom: 1.75rem; }
  .hero-message { font-size: 1rem; }
  .hero-scroll-hint { font-size: .7rem; }

  /* Gallery */
  .section { padding: 3rem 1.25rem; }
  .gallery { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .gallery-item,
  .gallery-item:nth-child(3n+2),
  .gallery-item:nth-child(3n) { aspect-ratio: 1; }

  /* Gifts */
  .gifts-section { padding: 3rem 1.25rem; }
  .gifts-grid { grid-template-columns: 1fr; gap: 1rem; }
  .gift-card { padding: 1.25rem; }
  .gift-claim-btn { min-height: 52px; font-size: 1rem; }

  /* Flash */
  .flash-container { top: .75rem; right: .75rem; left: .75rem; max-width: none; margin-left: 0; }

  /* Admin header */
  .admin-header { flex-direction: column; gap: .6rem; text-align: center; padding: .85rem 1.25rem; }
  .admin-header-nav { justify-content: center; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
  .stat-card { padding: .9rem .5rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: .65rem; }

  /* Admin main */
  .admin-main { padding: 1rem; gap: 1rem; }
  .admin-card { padding: 1.25rem; }

  /* Table → card layout on mobile */
  .gift-table thead { display: none; }
  .gift-table tr {
    display: block;
    background: var(--white);
    border: 1px solid var(--cream);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: 1rem;
  }
  .gift-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: .4rem 0;
    border-bottom: 1px solid var(--cream);
    font-size: .9rem;
    gap: .5rem;
  }
  .gift-table td:last-child { border-bottom: none; }
  .gift-table td::before {
    content: attr(data-label);
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    flex-shrink: 0;
    padding-top: .1rem;
    min-width: 70px;
  }
  .table-actions { justify-content: flex-end; flex-wrap: wrap; }

  /* Modal */
  .modal-title { font-size: 1.2rem; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }

  /* Auth */
  .auth-card { padding: 2rem 1.25rem; }
}

/* ── Tablet / iPad portrait (481px – 768px) ──────────────── */
@media (min-width: 481px) and (max-width: 768px) {
  .hero { padding: 3.5rem 2rem 5rem; }
  .section { padding: 3.5rem 2rem; }
  .gifts-section { padding: 3.5rem 2rem; }
  .gifts-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .admin-main { padding: 1.25rem; grid-template-columns: 1fr; }
  .flash-container { max-width: none; margin-left: 0; }

  /* Table → card on tablet portrait */
  .gift-table thead { display: none; }
  .gift-table tr {
    display: block;
    border: 1px solid var(--cream);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: 1rem;
  }
  .gift-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: .4rem 0;
    border-bottom: 1px solid var(--cream);
    gap: .5rem;
  }
  .gift-table td:last-child { border-bottom: none; }
  .gift-table td::before {
    content: attr(data-label);
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    flex-shrink: 0;
    padding-top: .1rem;
    min-width: 70px;
  }
}

/* ── iPad landscape / small desktop (769px – 1024px) ─────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .admin-main { grid-template-columns: 300px 1fr; padding: 1.5rem; }
  .gifts-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
}

/* ── Safe area insets (iPhone notch / home bar) ───────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .hero { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  footer { padding-bottom: calc(2.5rem + env(safe-area-inset-bottom)); }
  .admin-header { padding-top: calc(1rem + env(safe-area-inset-top)); }
}