@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=Work+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #FAF6F1;
  --card: #FFFFFF;
  --text: #2B2420;
  --muted: #94897C;
  --rose: #B97C8C;
  --rose-dark: #9C5F6E;
  --sage: #7C8C6B;
  --gold: #B9974A;
  --divider: #E9E1D6;
  --error: #B4433A;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Work Sans', sans-serif;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- Landing ---------- */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  position: relative;
  overflow: hidden;
}
.petal {
  position: absolute;
  border-radius: 50%;
  opacity: 0.4;
  animation: floatPetal 10s ease-in-out infinite;
}
@keyframes floatPetal {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-18px) translateX(8px); }
}
.landing-box { width: 100%; max-width: 380px; position: relative; z-index: 1; }
.landing-header { display: flex; flex-direction: column; align-items: center; margin-bottom: 28px; }
.seal {
  width: 76px; height: 76px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--rose), var(--rose-dark));
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(156,95,110,0.35);
  color: #fff; font-family: 'Cormorant Garamond', serif; font-size: 26px;
  flex-shrink: 0;
}
.seal.small { width: 34px; height: 34px; font-size: 13px; border-width: 1.5px; }
.couple-name { font-family: 'Cormorant Garamond', serif; font-size: 2.1rem; margin: 14px 0 2px; text-align: center; }
.wedding-date { font-size: 0.8rem; letter-spacing: 2px; color: var(--muted); }
.landing-sub { text-align: center; font-size: 0.9rem; color: var(--muted); margin-top: 14px; }
.card { background: var(--card); border-radius: 18px; padding: 24px; box-shadow: 0 10px 30px rgba(43,36,32,0.08); }
.field-row { display: flex; gap: 12px; }
.field { flex: 1; margin-bottom: 12px; }
.field label { font-size: 0.72rem; color: var(--muted); }
.field-input { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 9px 12px; border: 1px solid var(--divider); border-radius: 12px; }
.field-input input { border: none; outline: none; background: transparent; width: 100%; font-size: 0.9rem; color: var(--text); }
.btn { border: none; border-radius: 12px; padding: 11px; font-size: 0.9rem; font-weight: 500; color: #fff; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-rose { background: var(--rose); }
.btn-gold { background: var(--gold); }
.btn-link { background: none; color: var(--muted); text-decoration: underline; font-size: 0.75rem; padding: 6px 0; }
.error-text { color: var(--error); font-size: 0.75rem; margin: -4px 0 4px; }

/* ---------- App shell ---------- */
.app-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--divider);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-couple { font-size: 0.85rem; font-weight: 500; }
.header-greeting { font-size: 0.72rem; color: var(--muted); }
.logout-btn { display: flex; align-items: center; gap: 5px; font-size: 0.72rem; color: var(--muted); background: none; border: 1px solid var(--divider); border-radius: 999px; padding: 6px 12px; }

.admin-nav { display: flex; gap: 8px; padding: 12px 16px; max-width: 760px; margin: 0 auto; flex-wrap: wrap; }
.nav-btn { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 500; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--divider); background: var(--card); color: var(--text); }
.nav-btn.active { background: var(--rose); color: #fff; border-color: var(--rose); }

/* ---------- Feed ---------- */
.feed-wrap { padding: 8px 12px 40px; }
.feed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 640px; margin: 0 auto; }
.photo-card { background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: 0 4px 14px rgba(43,36,32,0.08); }
.photo-card .thumb-wrap { width: 100%; aspect-ratio: 1 / 1; background: var(--divider); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
.photo-date { font-size: 0.68rem; color: var(--muted); }
.dl-btn { background: var(--bg); border: none; border-radius: 999px; padding: 6px; display: flex; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 80px 24px; color: var(--muted); }
.sentinel { display: flex; justify-content: center; padding: 30px; }

/* ---------- Lightbox ---------- */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(20,16,14,0.94); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-content { display: flex; flex-direction: column; align-items: center; max-width: 92vw; max-height: 90vh; }
.lightbox-content img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.lightbox-footer { display: flex; align-items: center; gap: 16px; margin-top: 14px; color: #f2ece4; font-size: 0.8rem; }
.lightbox-dl { display: flex; align-items: center; gap: 6px; background: var(--rose); color: #fff; border: none; border-radius: 999px; padding: 8px 16px; font-size: 0.8rem; font-weight: 500; }
.lightbox-close { position: absolute; top: 18px; right: 20px; background: none; border: none; color: #fff; font-size: 1.6rem; line-height: 1; padding: 6px 10px; }
.lightbox-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.12); border: none; color: #fff; font-size: 2rem; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; line-height: 1; }
.lightbox-arrow-left { left: 16px; }
.lightbox-arrow-right { right: 16px; }
.lightbox-arrow:disabled { opacity: 0.25; }
@media (max-width: 640px) {
  .lightbox-arrow { width: 40px; height: 40px; font-size: 1.6rem; }
}

/* ---------- Admin: upload ---------- */
.upload-wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--rose); border-radius: 18px; padding: 44px 20px; background: var(--card); text-align: center; }
.dropzone input { display: none; }
.thumb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.thumb-cell { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1/1; background: var(--divider); }
.thumb-cell img { width: 100%; height: 100%; object-fit: cover; }
.thumb-delete { position: absolute; top: 4px; right: 4px; background: rgba(43,36,32,0.6); border: none; border-radius: 999px; padding: 4px; }

/* ---------- Admin: stats ---------- */
.stats-wrap { max-width: 820px; margin: 0 auto; padding: 20px 16px; display: flex; flex-direction: column; gap: 30px; }
.stats-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats-cards { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--card); border-radius: 14px; padding: 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 14px rgba(43,36,32,0.06); }
.stat-icon { background: var(--bg); border-radius: 999px; padding: 8px; display: flex; }
.stat-value { font-size: 1.15rem; font-weight: 600; }
.stat-label { font-size: 0.68rem; color: var(--muted); }
.table-wrap { border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: 0 4px 14px rgba(43,36,32,0.06); }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead tr { background: var(--bg); color: var(--muted); }
th, td { padding: 8px 12px; text-align: left; }
th.num, td.num { text-align: right; }
tbody tr { border-top: 1px solid var(--divider); }
.section-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 10px; }
.pw-form { display: flex; flex-direction: column; gap: 10px; max-width: 320px; background: var(--card); border-radius: 14px; padding: 16px; box-shadow: 0 4px 14px rgba(43,36,32,0.06); }
.pw-form input { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--divider); outline: none; font-size: 0.85rem; }
.pw-msg-ok { color: var(--sage); font-size: 0.75rem; }
.pw-msg-err { color: var(--error); font-size: 0.75rem; }

/* ---------- Loader ---------- */
.loader-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rings { animation: spinRings 1.3s linear infinite; }
@keyframes spinRings { to { transform: rotate(360deg); } }
.loader-label { font-size: 0.72rem; color: var(--muted); }
.full-loader { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
