/* ═══════════════════════════════════════════════════════════
   NFC Guestbook – main.css
   Mobile-first, custom design system
═══════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --bg:         #faf8f5;
  --surface:    #ffffff;
  --border:     #e8e4df;
  --text:       #1a1a1a;
  --text-muted: #6b6660;
  --primary:    #3d405b;
  --primary-h:  #2d2f43;
  --accent:     #e07a5f;
  --accent-h:   #c9664a;
  --success:    #2d6a4f;
  --danger:     #c62828;
  --warning:    #e6a817;
  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow:     0 4px 16px rgba(0,0,0,.1);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.14);
  --font:       'Inter', system-ui, sans-serif;
  --font-hand:  'Caveat', cursive;
  --transition: .2s ease;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a  { color: var(--primary); }
code { font-family: monospace; font-size: .85em; background: var(--border); padding: 2px 6px; border-radius: 4px; }

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 600; line-height: 1.2; }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ── Utilities ──────────────────────────────────────────── */
.mt-3  { margin-top: .75rem; }
.mt-4  { margin-top: 1rem; }
.mb-3  { margin-bottom: .75rem; }
.mb-4  { margin-bottom: 1rem; }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.link { color: var(--accent); text-decoration: underline; }

/* ── Container ──────────────────────────────────────────── */
.container         { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.container--narrow { max-width: 640px;  margin: 0 auto; padding: 0 1.25rem; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; padding: .6rem 1.25rem;
  font-size: .9375rem; font-weight: 500; font-family: var(--font);
  border: 2px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; transition: var(--transition);
  white-space: nowrap;
}
.btn--primary  { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-h); }
.btn--outline  { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn--outline:hover { background: var(--primary); color: #fff; }
.btn--ghost    { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--border); }
.btn--danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { opacity: .85; }
.btn--full { width: 100%; }
.btn--lg   { padding: .8rem 1.75rem; font-size: 1rem; }
.btn--sm   { padding: .4rem .9rem; font-size: .85rem; }
.btn--xs   { padding: .25rem .6rem; font-size: .8rem; }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-row--center { justify-content: center; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card--highlight { border-color: var(--accent); }
.card__header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.card__body   { padding: 1.5rem; }
.card__footer { padding: .75rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }
.card__cover  { width: 100%; height: 140px; object-fit: cover; }
.card__title  { font-size: 1.1rem; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { padding: .9rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; }
.alert p { margin: 0; }
.alert p + p { margin-top: .35rem; }
.alert--error   { background: #fde8e8; border: 1px solid #f5c6c6; color: var(--danger); }
.alert--success { background: #e6f4ee; border: 1px solid #b7dfc8; color: var(--success); }
.alert--info    { background: #e8f0fe; border: 1px solid #c3d3f8; color: var(--primary); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge--pending     { background: #fff3cd; color: #856404; }
.badge--activated   { background: #d1ecf1; color: #0c5460; }
.badge--configured  { background: #d4edda; color: #155724; }
.badge--deactivated { background: #f5f5f5; color: #888; }

/* ── Forms ──────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group--inline { flex-direction: row; align-items: center; gap: .75rem; }
.form-label { font-size: .9rem; font-weight: 500; }
.form-hint  { font-size: .8rem; color: var(--text-muted); font-weight: 400; }
.form-input {
  width: 100%; padding: .65rem .875rem;
  font-size: .9375rem; font-family: var(--font);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  transition: border-color var(--transition);
  appearance: none;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(61,64,91,.1); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-input-file { font-size: .875rem; }
.form-section { display: flex; flex-direction: column; gap: 1rem; }
.form-section__title { font-size: 1rem; font-weight: 600; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }
.color-picker { width: 48px; height: 40px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 2px; cursor: pointer; }
.char-counter { font-size: .75rem; color: var(--text-muted); text-align: right; }

/* ── Upload zone ────────────────────────────────────────── */
.upload-zone {
  position: relative; border: 2px dashed var(--border); border-radius: var(--radius);
  overflow: hidden; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: border-color var(--transition);
}
.upload-zone:hover { border-color: var(--primary); }
.upload-zone__input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.upload-zone__ui { display: flex; flex-direction: column; align-items: center; gap: .4rem; pointer-events: none; }
.upload-zone__icon { font-size: 2rem; }
.upload-zone__text { font-size: .875rem; color: var(--text-muted); }
.upload-zone__preview { display: none; width: 100%; max-height: 220px; object-fit: cover; }
.upload-zone--has-image .upload-zone__ui { display: none; }
.upload-zone--has-image .upload-zone__preview { display: block; }
.current-image { display: flex; align-items: center; gap: .75rem; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }

/* ── Layout picker ──────────────────────────────────────── */
.layout-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.layout-option { display: flex; flex-direction: column; gap: .4rem; cursor: pointer; }
.layout-option input { position: absolute; opacity: 0; pointer-events: none; }
.layout-option__preview {
  border: 2px solid var(--border); border-radius: var(--radius);
  aspect-ratio: 3/4; overflow: hidden; display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
}
.layout-option:hover .layout-option__preview,
.layout-option--active .layout-option__preview {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(61,64,91,.15);
}
.layout-option__icon { font-size: 2.5rem; }
.layout-option__name { font-size: .85rem; font-weight: 600; }
.layout-option__desc { font-size: .75rem; color: var(--text-muted); }
/* CSS-only mockup backgrounds per layout */
.layout-option__preview--1 { background: #faf8f3; }
.layout-option__preview--2 { background: #0f0f0f; }
.layout-option__preview--3 { background: #fff; }
.layout-option__preview--4 { background: #f5f5f5; }
.layout-option__preview--5 { background: #111; }

/* ── Admin nav ──────────────────────────────────────────── */
.admin-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 1.5rem;
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow);
}
.admin-nav--super { background: #1a1a2e; }
.admin-nav__brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1rem; margin-right: auto; }
.admin-nav__links { display: flex; gap: .25rem; list-style: none; }
.admin-nav__links a {
  color: rgba(255,255,255,.75); text-decoration: none; padding: .4rem .75rem;
  border-radius: var(--radius-sm); font-size: .875rem;
  transition: background var(--transition);
}
.admin-nav__links a:hover,
.admin-nav__links a.active { background: rgba(255,255,255,.15); color: #fff; }

/* ── Admin main ─────────────────────────────────────────── */
.admin-main { padding: 2rem 0 4rem; }
.page-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 1rem; margin-bottom: 2rem;
}

/* ── Stats grid ─────────────────────────────────────────── */
.cards-grid { display: grid; gap: 1rem; }
.cards-grid--3 { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.cards-grid--2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; box-shadow: var(--shadow-sm);
}
.stat-card__icon  { font-size: 2rem; margin-bottom: .5rem; }
.stat-card__value { font-size: 1.6rem; font-weight: 700; }
.stat-card__label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── Table ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { padding: .7rem 1rem; text-align: left; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg); border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.slug-preview { font-size: .75rem; }
.action-btns { display: flex; gap: .35rem; }

/* ── Entries list ───────────────────────────────────────── */
.entries-list { display: flex; flex-direction: column; gap: 1rem; }
.entry-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; gap: 1rem; overflow: hidden; box-shadow: var(--shadow-sm);
}
.entry-card__media { flex-shrink: 0; width: 100px; }
.entry-card__photo { width: 100%; height: 100%; object-fit: cover; }
.entry-card__no-photo {
  width: 100%; height: 100%; background: var(--bg); display: flex;
  align-items: center; justify-content: center; font-size: 2rem; min-height: 100px;
}
.entry-card__body { flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.entry-card__meta { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.entry-card__meta time { font-size: .8rem; color: var(--text-muted); }
.entry-card__message { font-size: .9rem; }
.entry-card__answers { list-style: none; font-size: .8rem; color: var(--text-muted); display: flex; flex-direction: column; gap: .2rem; }
.entry-card__delete { margin-top: auto; align-self: flex-end; }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 4rem 1.5rem;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty-state--guest { background: transparent; border: none; }
.empty-state__icon { font-size: 3.5rem; margin-bottom: 1rem; }

/* ── Step list ──────────────────────────────────────────── */
.step-list { padding-left: 1.5rem; display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; }

/* ── Auth ───────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background: var(--bg);
}
.auth-wrap--super { background: #1a1a2e; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-lg);
}
.auth-card__back  { font-size: .85rem; color: var(--text-muted); text-decoration: none; display: block; margin-bottom: 1.5rem; }
.auth-card__badge { display: inline-block; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700; padding: .2rem .7rem; border-radius: 999px; margin-bottom: 1rem; text-transform: uppercase; letter-spacing: .06em; }
.auth-card__title { margin-bottom: .25rem; }
.auth-card__sub   { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }
.auth-card__footer { margin-top: 1.5rem; text-align: center; font-size: .85rem; color: var(--text-muted); }

/* ── Hero (home) ────────────────────────────────────────── */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 3rem 1.5rem; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #faf8f5 0%, #f0ecf8 100%);
}
.hero__inner { max-width: 520px; text-align: center; position: relative; z-index: 1; }
.hero__badge {
  display: inline-block; background: var(--accent); color: #fff;
  font-size: .75rem; font-weight: 700; padding: .3rem .9rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 1.25rem;
}
.hero__title { font-size: clamp(2.5rem, 8vw, 4.5rem); font-weight: 700; line-height: 1.1; margin-bottom: 1rem; }
.hero__sub   { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 2rem; }
.hero__actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.hero__deco { position: absolute; inset: 0; pointer-events: none; }
.deco-card {
  position: absolute; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 3rem; display: flex; align-items: center; justify-content: center;
  width: 80px; height: 80px;
}
.deco-card--1 { top: 10%; right: 8%; transform: rotate(8deg); }
.deco-card--2 { bottom: 20%; right: 15%; transform: rotate(-5deg); }
.deco-card--3 { top: 50%; left: 5%; transform: rotate(3deg); }

/* ── Guestbook hero ─────────────────────────────────────── */
.gb-hero {
  position: relative; background: var(--primary); color: #fff;
  padding: 3rem 1.5rem; text-align: center; overflow: hidden;
}
.gb-hero--has-cover::before {
  content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.45);
}
.gb-hero__cover {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0;
}
.gb-hero__content { position: relative; z-index: 1; }
.gb-hero__title   { font-size: clamp(1.8rem, 5vw, 3rem); margin-bottom: .5rem; }
.gb-hero__count   { color: rgba(255,255,255,.75); font-size: .95rem; margin-bottom: 1.5rem; }
.gb-hero__cta     { background: #fff; color: var(--primary); }
.gb-hero__cta:hover { background: var(--bg); }

/* ── Guest form ─────────────────────────────────────────── */
.guest-wrap { min-height: 100vh; background: var(--bg); display: flex; justify-content: center; align-items: flex-start; padding: 2rem 1rem 4rem; }
.guest-form-card { width: 100%; max-width: 560px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.guest-form-card__header { background: var(--primary); color: #fff; padding: 2rem 1.5rem; }
.guest-form-card__header h1 { font-size: 1.5rem; margin-bottom: .3rem; }
.guest-form-card__header p  { color: rgba(255,255,255,.75); }
.guest-form-card form { padding: 1.75rem; }
.guest-form-card__footer { padding: 1rem 1.75rem; border-top: 1px solid var(--border); text-align: center; font-size: .875rem; }

/* ── Thanks ─────────────────────────────────────────────── */
.thanks-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.thanks-card { text-align: center; background: var(--surface); border-radius: var(--radius-lg); padding: 3rem 2rem; box-shadow: var(--shadow-lg); max-width: 400px; width: 100%; }
.thanks-card__emoji { font-size: 4rem; margin-bottom: 1rem; }
.thanks-card h1 { font-size: 2rem; margin-bottom: .5rem; }

/* ── Error page ─────────────────────────────────────────── */
.error-page { text-align: center; padding: 6rem 1.5rem; }
.error-page__code { font-size: 6rem; font-weight: 800; color: var(--border); line-height: 1; margin-bottom: .5rem; }

/* ── FAB ────────────────────────────────────────────────── */
.gb-fab { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 200; }
.fab-btn {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 1.8rem; font-weight: 300;
  text-decoration: none; box-shadow: var(--shadow-lg);
  transition: transform var(--transition), background var(--transition);
}
.fab-btn:hover { background: var(--accent-h); transform: scale(1.1); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .entry-card { flex-direction: column; }
  .entry-card__media { width: 100%; height: 180px; }
  .admin-nav { gap: .5rem; padding: .6rem 1rem; }
  .admin-nav__links { font-size: .8rem; }
  .table th, .table td { padding: .6rem .75rem; }
  .deco-card { display: none; }
}
