/* styles.css — tông PASTEL sang trọng, tinh tế. Tiếng Việt. */

:root {
  /* Bảng màu pastel */
  --cream: #faf5ef;
  --cream-2: #f7ede2;
  --blush: #f3dfd7;
  --rose: #e7bcb1;
  --rose-deep: #cf9c8f;
  --sage: #cdd7c6;
  --sage-deep: #9db08f;
  --gold: #c9a86a;
  --ink: #4a3f39;
  --ink-soft: #7c6f66;
  --white: #fffdfb;
  --line: #ece0d5;
  --shadow: 0 10px 30px rgba(120, 92, 78, 0.12);
  --shadow-sm: 0 4px 14px rgba(120, 92, 78, 0.10);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

.app { min-height: 100vh; min-height: 100dvh; }
.view { min-height: 100vh; min-height: 100dvh; }

/* ---------- Nút ---------- */
.btn {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-deep) 100%);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: var(--shadow); }
.btn-ghost {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-lg { font-size: 17px; padding: 15px 34px; }
.btn-sm { font-size: 14px; padding: 9px 16px; }
.btn-block { width: 100%; }

/* ---------- MÀN 1: LANDING ---------- */
.view-landing { display: flex; }
.cover {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--blush) 0%, var(--cream-2) 45%, var(--sage) 130%);
  background-size: cover;
  background-position: center;
}
.cover.has-image .cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(74,63,57,0.15) 0%, rgba(74,63,57,0.55) 100%);
}
.cover.has-image .couple,
.cover.has-image .date,
.cover.has-image .welcome,
.cover.has-image .eyebrow,
.cover.has-image .sub-note { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.35); }
.cover-inner {
  position: relative;
  text-align: center;
  max-width: 460px;
  animation: fadeUp 0.7s ease both;
}
.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.couple {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(38px, 11vw, 64px);
  line-height: 1.05;
  margin: 0 0 6px;
  color: var(--ink);
}
.couple .amp { color: var(--gold); font-style: italic; font-weight: 500; }
.date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--rose-deep);
  margin: 4px 0 22px;
}
.welcome {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0 auto 30px;
  max-width: 380px;
}
.sub-note { font-size: 13px; color: var(--ink-soft); margin-top: 16px; }

/* ---------- MÀN 2: CỔNG NHẬP ---------- */
.view-gate {
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 0%, var(--cream-2) 0%, var(--blush) 140%);
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px;
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.5s ease both;
}
.gate-title { font-family: var(--serif); font-size: 30px; margin: 0 0 8px; font-weight: 600; }
.gate-desc { color: var(--ink-soft); font-size: 15px; margin: 0 0 22px; }
.gate-desc strong { color: var(--rose-deep); }
.form { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: 0.01em; }
.field input {
  font-family: var(--sans);
  font-size: 16px; /* >=16px để iOS không tự zoom */
  padding: 13px 15px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--rose);
  background: var(--white);
}
.form-error { color: #b45c4b; font-size: 14px; margin: 2px 0 0; font-weight: 600; }
.privacy-note { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 6px 0 0; }

/* ---------- MÀN 3: GALLERY ---------- */
.view-gallery { padding: 0 0 40px; background: var(--cream); }
.gallery-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px calc(14px + env(safe-area-inset-top, 0));
  padding-top: max(16px, env(safe-area-inset-top));
  background: rgba(250, 245, 239, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.gallery-head-text h2 { font-family: var(--serif); font-size: 24px; margin: 0; font-weight: 600; }
.gallery-sub { font-size: 13px; color: var(--ink-soft); margin: 2px 0 0; }
.upload-bar { padding: 16px 18px 6px; }
.upload-label { cursor: pointer; }
.upload-progress { margin-top: 12px; }
.bar { height: 8px; background: var(--blush); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--rose), var(--rose-deep)); transition: width 0.25s ease; }
.progress-label { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 6px; text-align: center; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 10px 4px;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(6, 1fr); } }
.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--blush);
  cursor: pointer;
  animation: fadeIn 0.4s ease both;
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .badge {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  display: flex; align-items: center; gap: 3px;
}
.tile .who {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 14px 8px 6px; font-size: 11px; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.5));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty-grid { text-align: center; color: var(--ink-soft); padding: 50px 30px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 24, 20, 0.94);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox-content { max-width: 96vw; max-height: 86vh; }
.lightbox-content img, .lightbox-content video { max-width: 96vw; max-height: 86vh; border-radius: 10px; }
.lightbox-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top, 0)); right: 16px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.15); color: #fff; border: none;
  font-size: 20px; cursor: pointer;
}

/* ---------- Loading / Fatal ---------- */
.loading, .fatal {
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--cream); color: var(--ink-soft);
}
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid var(--blush); border-top-color: var(--rose-deep);
  animation: spin 0.8s linear infinite;
}
.fatal { padding: 30px; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Trang HOST ---------- */
.host-wrap { max-width: 1100px; margin: 0 auto; padding: 24px 18px 60px; }
.host-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.host-head h1 { font-family: var(--serif); font-size: 30px; margin: 0; font-weight: 600; }
.host-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 24px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 20px; box-shadow: var(--shadow-sm); min-width: 120px;
}
.stat .num { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--rose-deep); }
.stat .lbl { font-size: 13px; color: var(--ink-soft); }
.host-section-title { font-family: var(--serif); font-size: 22px; margin: 28px 0 12px; }
.guest-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.guest-table th, .guest-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.guest-table th { background: var(--cream-2); font-weight: 600; }
.guest-table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }
.host-gate { max-width: 380px; margin: 80px auto; }
