/* =====================================================================
   QRKAWIN Design System — Premium Modern Wedding SaaS
   Palette: deep plum, warm ivory, muted rose, champagne gold, charcoal
   ===================================================================== */
:root {
  --plum: #5b2440;
  --plum-dark: #431b2f;
  --plum-900: #351524;
  --ivory: #faf5ee;
  --rose: #c9879a;
  --gold: #c2a25a;
  --gold-soft: #f3e8d3;
  --charcoal: #2c2a28;
  --muted: #7d756b;
  --line: #ece3d6;
  --card: #ffffff;
  --danger: #b42318;
  --success: #2e7d4f;
  --shadow: 0 1px 2px rgba(43, 27, 35, 0.05), 0 6px 18px rgba(43, 27, 35, 0.07);
  --radius: 14px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--charcoal);
  background: var(--ivory);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--plum); text-decoration: none; }
a:hover { color: var(--plum-dark); }
button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; }

h1, h2, h3, h4, h5 {
  color: var(--charcoal);
  line-height: 1.22;
  margin: 0 0 10px;
  font-weight: 700;
}
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 12px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
img { max-width: 100%; }

/* ---------------------------------------------------------
   Form controls (text-like inputs full width; controls exempt)
   --------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="search"],
input[type="tel"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--charcoal);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(91, 36, 64, 0.12);
}
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--charcoal); }

/* ---------------------------------------------------------
   Buttons (base = secondary outline; .btn-primary = filled)
   --------------------------------------------------------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--plum);
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
button:hover, .btn:hover { background: #f7efe7; border-color: var(--plum); }
button:active, .btn:active { transform: translateY(1px); }

.btn-primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn-primary:hover { background: var(--plum-dark); border-color: var(--plum-dark); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: #ab8b43; border-color: #ab8b43; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------------------------------------------------------
   App shell — sidebar + topbar + content (authenticated pages)
   --------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 262px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--plum) 0%, var(--plum-900) 100%);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), var(--rose));
  color: #fff; font-weight: 800; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .12em; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,.6); letter-spacing: .1em; margin: 0; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,.85);
  font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }

.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.18); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: #fff; }
.user-avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%;
  background: var(--gold); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(255,255,255,.6); }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 66px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.menu-btn { display: none; border: 1px solid var(--line); background: #fff; border-radius: 9px; }
.topbar-title { font-weight: 700; font-size: 15px; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.content { padding: 30px 34px 60px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------
   Guest layout (public pages)
   --------------------------------------------------------- */
.guest-body { min-height: 100vh; display: flex; flex-direction: column; }
.guest-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 22px; background: #fff; border-bottom: 1px solid var(--line);
}
.guest-content { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 28px 20px 50px; }
.guest-footer { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------
   Components
   --------------------------------------------------------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.page-header h1 { margin: 0; }
.breadcrumb { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.breadcrumb span { color: var(--charcoal); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

.welcome-card {
  background: linear-gradient(120deg, var(--plum) 0%, var(--plum-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 26px 28px; margin-bottom: 26px;
  box-shadow: var(--shadow);
}
.welcome-card h2 { color: #fff; margin: 0 0 6px; }
.welcome-card p { color: rgba(255,255,255,.78); margin: 0; }

.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 8px 0 16px; }
.section-head h2 { margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  text-transform: capitalize;
}
.badge-gold { background: var(--gold-soft); color: #8a6d2c; }
.badge-owner { background: var(--plum); color: #fff; }
.badge-admin { background: var(--rose); color: #3a1a26; }
.badge-staff { background: #efe8df; color: var(--muted); }
.badge-couple { background: var(--gold-soft); color: #8a6d2c; }
.badge-vendor { background: #e7ecf3; color: #38506b; }
.badge-success, .badge-approved { background: #e4f2e9; color: var(--success); }
.badge-pending { background: #f8edd8; color: #9a741f; }
.badge-rejected { background: #fbe5e2; color: var(--danger); }

.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 11px; font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
}
.alert-success { background: #e7f5ec; color: var(--success); border-color: #c4e5d0; }
.alert-error { background: #fbeae8; color: var(--danger); border-color: #f0c9c5; }

.toast-stack {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}

.empty-state {
  text-align: center; padding: 56px 24px;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty-icon {
  width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 16px;
  background: var(--gold-soft); color: var(--gold);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.empty-state h3 { margin: 0 0 6px; }
.empty-state p { color: var(--muted); max-width: 380px; margin: 0 auto 20px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; }

.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table th { background: #faf5ee; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }

/* ---------------------------------------------------------
   Workspace dashboard cards
   --------------------------------------------------------- */
.workspace-card {
  display: block; color: var(--charcoal); text-decoration: none;
  position: relative;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.workspace-card:hover { border-color: var(--plum); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(43, 27, 35, 0.12); }
.workspace-card h3 { margin: 0 30px 14px 0; font-size: 18px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 8px; }
.card-meta { margin-top: 14px; font-size: 13px; color: var(--muted); }
.card-arrow { position: absolute; top: 20px; right: 20px; color: var(--plum); font-size: 18px; font-weight: 700; }

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 262px; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease; height: 100vh;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .menu-btn { display: inline-flex; }
  .topbar-user .user-name { display: none; }
  .content { padding: 20px 16px 48px; }
}

@media (max-width: 430px) {
  .welcome-card { padding: 20px; }
  .card { padding: 16px; }
  h1 { font-size: 22px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .toast-stack { left: 16px; right: 16px; max-width: none; }
}

/* ---------------------------------------------------------
   Workspace management utilities
   --------------------------------------------------------- */
.muted { color: var(--muted); }
.mb { margin-bottom: 18px; }
.mt { margin-top: 12px; }
.btn-block { width: 100%; }
.toolbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.avatar {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%;
  background: var(--gold-soft); color: #8a6d2c;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin: 0 0 5px; }
.stat .stat-value { font-size: 21px; font-weight: 700; color: var(--charcoal); margin: 0; }

.field { margin-bottom: 16px; }

.list { display: flex; flex-direction: column; gap: 12px; }
.list-item {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.list-body { flex: 1; min-width: 180px; }
.list-body h4 { margin: 0 0 2px; }
.list-sub { color: var(--muted); font-size: 13px; margin: 0; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.photo-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.photo-card img { width: 100%; height: 160px; object-fit: cover; display: block; background: #f0e9de; }
.photo-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.photo-title { font-weight: 600; font-size: 14px; margin: 0; }
.photo-sub { color: var(--muted); font-size: 12px; margin: 0; }

.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1; min-width: 220px; margin: 0; }

.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------
   Event-specific components
   --------------------------------------------------------- */
.badge-draft { background: #efe8df; color: var(--muted); }
.badge-published { background: #e4f2e9; color: var(--success); }
.badge-completed { background: #e7ecf3; color: #38506b; }
.badge-archived { background: #ece5f0; color: #6b4a86; }

.event-card {
  display: flex; flex-direction: column; gap: 10px;
  color: var(--charcoal); text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.event-card:hover { border-color: var(--plum); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(43, 27, 35, 0.12); }
.event-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.event-head h3 { margin: 0; }
.event-meta { color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.event-stats { display: flex; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field { margin: 0; }

.setting { display: flex; align-items: flex-start; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; }
.setting .setting-copy { flex: 1; }
.setting .setting-copy h4 { margin: 0 0 4px; }
.setting-desc { color: var(--muted); font-size: 13px; margin: 0; }

.qr-wrap { text-align: center; margin: 22px 0; }
.qr-wrap img { width: 220px; max-width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   Gallery components
   --------------------------------------------------------- */
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #266a42; border-color: #266a42; color: #fff; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--charcoal);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.pill:hover { border-color: var(--plum); }
.pill.active { background: var(--plum); border-color: var(--plum); color: #fff; }

.photo-tile { position: relative; display: block; border-radius: 12px; overflow: hidden; aspect-ratio: 1 / 1; background: #f0e9de; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-card.status-pending { border-top: 3px solid var(--gold); }
.photo-card.status-approved { border-top: 3px solid var(--success); }
.photo-card.status-rejected { border-top: 3px solid var(--danger); }

.masonry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

.gallery-hero { text-align: center; margin: 8px 0 28px; }
.gallery-eyebrow { letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-size: 12px; font-weight: 700; margin: 0 0 8px; }
.gallery-hero h1 { font-size: 30px; }
.gallery-sub { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.lightbox { position: fixed; inset: 0; background: rgba(18, 12, 16, 0.94); display: none; align-items: center; justify-content: center; z-index: 200; padding: 22px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.lightbox-close {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px;
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.14);
  color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}

/* ---------------------------------------------------------
   Guest flow components
   --------------------------------------------------------- */
.guest-card { max-width: 460px; margin: 0 auto; text-align: center; }
.guest-card form { text-align: left; }
.text-sm { font-size: 12px; }

.camera-stage {
  position: relative; max-width: 500px; margin: 0 auto;
  border-radius: 14px; overflow: hidden; background: #232120;
  border: 6px solid #fff; box-shadow: var(--shadow);
}
.camera-stage video, .camera-stage canvas {
  width: 100%; display: block; aspect-ratio: 4 / 5; object-fit: cover;
}
.camera-stage img { width: 100%; display: block; height: auto; }

.camera-status { min-height: 24px; margin: 12px 0; font-size: 14px; color: var(--muted); text-align: center; }
.camera-status.error { color: var(--danger); }
.camera-status.success { color: var(--success); }

.camera-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 14px 0; }

/* Back button (topbar header) */
.back-btn { padding-left: 12px; padding-right: 12px; }

/* Disabled / loading button state */
button:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* Guest camera: prominent, consistent, touch-friendly action buttons */
.camera-actions { max-width: 500px; margin-left: auto; margin-right: auto; }
.camera-actions .btn { flex: 1 1 150px; min-height: 48px; font-size: 15px; }
.camera-actions .btn-primary { box-shadow: 0 4px 12px rgba(91, 36, 64, 0.22); }