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

:root {
  --primary:       #6c63ff;
  --primary-dark:  #5a52d5;
  --danger:        #ef4444;
  --success:       #22c55e;
  --warning:       #f59e0b;
  --bg:            #f4f5f8;
  --surface:       #ffffff;
  --border:        #e5e7eb;
  --text:          #111827;
  --text-muted:    #6b7280;
  --radius:        10px;
  --shadow:        0 2px 12px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --header-h:      56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary:     #7b73ff;
    --bg:          #0f0f1a;
    --surface:     #1a1a2b;
    --border:      #2a2a3d;
    --text:        #e8e8f0;
    --text-muted:  #8888a0;
    --shadow:      0 2px 12px rgba(0,0,0,.3);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.4);
  }
  .hero {
    background: linear-gradient(160deg, #1a1030 0%, #2a1040 55%, #1e1535 100%);
    color: var(--text);
  }
  .hero__badge { background: rgba(123,115,255,.15); border-color: rgba(123,115,255,.3); }
  .hero__phone { background: rgba(255,255,255,.05); border-color: rgba(123,115,255,.2); }
  .hero__phone-screen { background: rgba(123,115,255,.08); }
  .hero__phone-header { background: rgba(123,115,255,.1); }
  .hero__phone-header::before { background: rgba(123,115,255,.25); }
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── Header ────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.site-logo svg { color: var(--primary); }
.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-link { color: var(--text-muted); font-size: .9rem; transition: color .15s; }
.nav-link:hover, .nav-link.active { color: var(--primary); }
.nav-sep { color: var(--border); }
.nav-user { font-size: .9rem; color: var(--text-muted); }
.nav-logout { display: flex; align-items: center; }
.header-actions { display: flex; gap: 8px; }

/* ─── Layout ────────────────────────────────────────────── */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 700; flex: 1; }

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--bg); }
.btn--danger { color: var(--danger) !important; border-color: var(--danger) !important; }
.btn--danger:hover { background: var(--danger) !important; color: #fff !important; }
.btn--sm { padding: 5px 10px; font-size: .82rem; }
.btn--block { width: 100%; justify-content: center; }

/* ─── Forms ─────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; max-width: 600px; }
.form--wide { max-width: 100%; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 580px) { .form-row { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: .85rem; font-weight: 600; color: var(--text); }
.form-hint { font-weight: 400; color: var(--text-muted); }
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.form-input--error { border-color: var(--danger); }
.form-error { font-size: .8rem; color: var(--danger); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }
.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-right: 44px; }
.input-toggle-pw {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px;
}

/* ─── Copy row ──────────────────────────────────────────── */
.copy-row { display: flex; gap: 8px; }
.copy-row .form-input { flex: 1; }

/* ─── Template Picker ───────────────────────────────────── */
.template-picker { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
@media (max-width: 480px) { .template-picker { grid-template-columns: repeat(2,1fr); } }
.template-option {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  text-align: center;
}
.template-option.selected { border-color: var(--primary); transform: scale(1.03); }
.template-option span { display: block; padding: 6px; font-size: .82rem; font-weight: 500; }
.template-preview { height: 56px; }
.template-preview--modern  { background: linear-gradient(135deg,#6c63ff,#ff6584); }
.template-preview--classic { background: linear-gradient(135deg,#1a2535,#c9a840); }
.template-preview--rustic  { background: linear-gradient(135deg,#6b3e26,#d4a853); }
.template-preview--minimal { background: linear-gradient(135deg,#222,#888); }
.template-preview--wedding { background: linear-gradient(135deg,#f8f0e3,#e8d4b8); border: 1px solid #d4b896; }

/* ─── Logo Upload ───────────────────────────────────────── */
.logo-drop {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  overflow: hidden;
}
.logo-drop:hover, .logo-drop.drag-over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, transparent); }
.logo-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-muted); padding: 24px; font-size: .9rem; }
.logo-placeholder svg { opacity: .5; }
.logo-preview { max-height: 120px; object-fit: contain; padding: 12px; }

/* ─── Cards (Dashboard) ─────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px,1fr));
  gap: 20px;
}
.event-card {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.event-card__header { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 16px 0; gap: 8px; }
.event-card__logo { height: 40px; max-width: 80px; object-fit: contain; border-radius: 6px; }
.event-card__date { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.event-card__name { font-size: 1.05rem; font-weight: 700; padding: 8px 16px 2px; }
.event-card__occasion { font-size: .85rem; color: var(--text-muted); padding: 0 16px 10px; }
.event-card__stats { display: flex; align-items: center; gap: 12px; padding: 8px 16px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.stat { display: flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--text-muted); }
.stat--pending { color: var(--warning); font-weight: 600; }
.event-card__actions { display: flex; gap: 4px; align-items: center; padding: 10px 12px; margin-top: auto; }
.event-card__actions .btn--danger { margin-left: auto; }

/* ─── Badges ────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; text-transform: capitalize; }
.badge--modern  { background: color-mix(in srgb,#6c63ff 15%,transparent); color: #6c63ff; }
.badge--classic { background: color-mix(in srgb,#2c3e50 15%,transparent); color: #2c3e50; }
.badge--rustic  { background: color-mix(in srgb,#8b5e3c 15%,transparent); color: #8b5e3c; }
.badge--minimal { background: color-mix(in srgb,#555 15%,transparent); color: #555; }
.badge--wedding { background: color-mix(in srgb,#c9a96e 15%,transparent); color: #9a6f30; }
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 10px; font-size: .72rem; font-weight: 700; margin-left: 4px;
}

/* ─── Segments ──────────────────────────────────────────── */
.segments { display: flex; gap: 2px; background: var(--bg); border-radius: var(--radius); padding: 4px; margin-bottom: 20px; width: fit-content; }
.segment {
  padding: 7px 16px; border: none; border-radius: 8px; cursor: pointer;
  font-size: .88rem; font-weight: 500; color: var(--text-muted); background: transparent;
  transition: all .15s; display: flex; align-items: center;
}
.segment.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ─── Image Grid (Admin) ────────────────────────────────── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px,1fr));
  gap: 3px;
}
.img-cell {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
}
.img-cell img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.img-cell:hover img { transform: scale(1.05); }
.img-cell__actions {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  display: flex; justify-content: center; gap: 6px; padding: 8px 4px 6px;
  opacity: 0; transition: opacity .15s;
}
.img-cell:hover .img-cell__actions { opacity: 1; }
.img-cell__actions .btn { padding: 4px 8px; font-size: .78rem; }
.img-cell__badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: .72rem; padding: 2px 6px; border-radius: 8px;
}
.img-cell--skeleton { background: var(--border); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ─── Load More ─────────────────────────────────────────── */
.load-more-wrap { text-align: center; padding: 24px; }

/* ─── Lightbox ──────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.9); cursor: pointer; }
.lightbox__content { position: relative; z-index: 1; max-width: 95vw; max-height: 90dvh; display: flex; align-items: center; }
.lightbox__img { max-width: 95vw; max-height: 85dvh; object-fit: contain; border-radius: 4px; }
.lightbox__close {
  position: absolute; top: -36px; right: 0;
  background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; opacity: .7;
}
.lightbox__close:hover { opacity: 1; }

/* ─── Modal ─────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 900; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) { .modal { align-items: center; } }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.modal__box {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: 14px 14px 0 0; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg); max-height: 90dvh; overflow-y: auto;
}
@media (min-width: 600px) { .modal__box { border-radius: 14px; } }
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal__header h3 { font-size: 1rem; font-weight: 700; }
.modal__close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal__body { padding: 20px; }
.guest-url { font-size: .82rem; font-family: monospace; color: var(--text-muted); word-break: break-all; margin: 12px 0; }
.text-muted { color: var(--text-muted); font-size: .9rem; }

/* ─── Flash / Alerts ────────────────────────────────────── */
.flash, .alert {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: .9rem; margin-bottom: 16px; font-weight: 500;
}
.flash--success, .alert--success { background: color-mix(in srgb,var(--success) 12%,transparent); color: var(--success); border: 1px solid color-mix(in srgb,var(--success) 30%,transparent); }
.flash--error,   .alert--error   { background: color-mix(in srgb,var(--danger) 12%,transparent); color: var(--danger); border: 1px solid color-mix(in srgb,var(--danger) 30%,transparent); }

/* ─── Empty State ───────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 24px; text-align: center; color: var(--text-muted); gap: 12px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.empty-state p { font-size: .9rem; }

/* ─── Login Page ────────────────────────────────────────── */
.login-layout { display: flex; align-items: center; justify-content: center; min-height: 100dvh; background: var(--bg); }
.login-wrap { width: 100%; padding: 24px 16px; display: flex; justify-content: center; }
.login-box { width: 100%; max-width: 380px; }
.login-brand { text-align: center; margin-bottom: 32px; color: var(--primary); }
.login-brand svg { margin: 0 auto 10px; }
.login-brand h1 { font-size: 1.8rem; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.login-brand p { font-size: .82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; margin-top: 2px; }
.login-box .form { gap: 14px; }

/* ─── Toast ─────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--text); color: var(--surface);
  padding: 10px 16px; border-radius: var(--radius);
  font-size: .88rem; font-weight: 500;
  animation: slideIn .2s ease;
  pointer-events: auto;
  max-width: 320px;
}
.toast--success { background: var(--success); }
.toast--error   { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Public Home Layout ────────────────────────────────── */
.public-layout { min-height: 100dvh; display: flex; flex-direction: column; }
.btn--lg { padding: 14px 28px; font-size: 1rem; border-radius: 12px; font-weight: 700; }

/* Pub Nav */
.pub-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.88); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .pub-nav { background: rgba(26,26,43,.88); }
}
.pub-nav__inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 62px; display: flex; align-items: center; justify-content: space-between;
}
.pub-logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none;
}
.pub-logo svg { color: var(--primary); }

/* Hero */
.hero {
  background: linear-gradient(160deg, #f5f0ff 0%, #fce7f3 55%, #ede9fe 100%);
  color: var(--text); padding: 96px 24px 80px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 55% 50% at 10% 30%, rgba(139,92,246,.18) 0%, transparent 60%),
              radial-gradient(ellipse 45% 55% at 90% 70%, rgba(236,72,153,.12) 0%, transparent 60%);
  pointer-events: none;
}
.hero__inner {
  position: relative; z-index: 1;
  max-width: 600px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.hero__badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(108,99,255,.1); border: 1px solid rgba(108,99,255,.2);
  color: var(--primary);
  border-radius: 20px; padding: 5px 16px; font-size: .82rem; font-weight: 600;
}
.hero__title {
  font-size: clamp(2.4rem, 6vw, 3.8rem); font-weight: 900; line-height: 1.08; letter-spacing: -.03em;
  color: var(--text);
}
.hero__sub {
  font-size: clamp(.95rem, 2.5vw, 1.1rem); color: var(--text-muted); max-width: 500px; line-height: 1.75;
}
.hero__ctas { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Phone Mockup */
.hero__visual { position: relative; z-index: 1; margin-top: 56px; }
.hero__phone {
  width: 200px;
  background: rgba(255,255,255,.75); border: 1px solid rgba(108,99,255,.18);
  border-radius: 24px; padding: 12px;
  box-shadow: 0 20px 60px rgba(108,99,255,.2), 0 4px 16px rgba(0,0,0,.06);
  backdrop-filter: blur(16px);
}
.hero__phone-screen { background: rgba(108,99,255,.05); border-radius: 16px; overflow: hidden; }
.hero__phone-header { height: 32px; background: rgba(108,99,255,.07); display: flex; align-items: center; padding: 0 10px; gap: 6px; }
.hero__phone-header::before { content: ''; width: 60px; height: 8px; background: rgba(108,99,255,.18); border-radius: 4px; }
.hero__phone-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; padding: 2px;
}
.hero__phone-cell {
  aspect-ratio: 1; border-radius: 4px;
  background: linear-gradient(135deg, rgba(108,99,255,.3), rgba(236,72,153,.2));
  animation: cellFadeIn 1.2s ease both;
}
@keyframes cellFadeIn { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
.hero__phone-fab {
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  margin: 8px auto 6px;
  box-shadow: 0 4px 12px rgba(108,99,255,.4);
}

/* Section shared */
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-title { text-align: center; font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px; }
.section-sub { text-align: center; color: var(--text-muted); margin-bottom: 48px; font-size: 1rem; }

/* Features */
.features { padding: 80px 24px; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 20px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature-card__icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.feature-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: .9rem; color: var(--text-muted); line-height: 1.65; }

/* Steps */
.steps { background: var(--bg); padding: 80px 24px; }
.steps-list {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 0; flex-wrap: wrap; margin-top: 48px;
}
.step { flex: 1; min-width: 180px; max-width: 260px; text-align: center; padding: 0 16px; }
.step__num {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-weight: 900; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; box-shadow: 0 4px 16px color-mix(in srgb, var(--primary) 40%, transparent);
}
.step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step p { font-size: .88rem; color: var(--text-muted); line-height: 1.65; }
.step-divider {
  display: flex; align-items: center; padding-top: 24px; color: var(--border);
  flex-shrink: 0;
}
@media (max-width: 640px) { .step-divider { display: none; } .step { min-width: 140px; } }

/* CTA Band */
.cta-band {
  background: linear-gradient(135deg, #6c63ff 0%, #a855f7 100%);
  color: #fff; padding: 64px 24px;
}
.cta-band__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.cta-band__title { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.cta-band__sub { opacity: .85; font-size: .95rem; }

/* Pub Footer */
.pub-footer {
  border-top: 1px solid var(--border);
  padding: 24px; text-align: center;
  color: var(--text-muted); font-size: .85rem;
  margin-top: auto;
}
.pub-footer a { color: var(--primary); }

/* ── Toggle-Switch ──────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: default;
}
.toggle-label strong { font-size: .95rem; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
