/* ═══════════════════════════════════════════════
   FLIPPERS APP — Design System
   Shared by admin (desktop) + couple (mobile)
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --cream:       #F7F4EE;
  --dark:        #1C1C1A;
  --green:       #2A4A1E;
  --green-light: #3D6B2C;
  --yellow:      #F0C93A;
  --red:         #C0392B;
  --muted:       #9A9A8E;
  --border:      #E0DDD5;
  --white:       #FFFFFF;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-pill: 999px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.14);

  --font-head:   'Syne', sans-serif;
  --font-body:   'Inter', sans-serif;

  --transition:  0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 600; }
p  { font-size: 1rem; font-weight: 400; color: var(--dark); }
small { font-size: 0.8rem; color: var(--muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  border: none; border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn-primary   { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--green-light); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-yellow    { background: var(--yellow); color: var(--dark); }
.btn-yellow:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ghost     { background: transparent; color: var(--dark); border: 2px solid var(--border); }
.btn-ghost:hover { border-color: var(--dark); }
.btn-danger    { background: var(--red); color: var(--white); }
.btn-danger:hover { opacity: 0.85; }
.btn-sm        { padding: 8px 16px; font-size: 0.85rem; border-radius: var(--radius-sm); }
.btn-lg        { padding: 16px 32px; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-full      { width: 100%; }
.btn:disabled  { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-dark {
  background: var(--dark);
  color: var(--cream);
  border-color: transparent;
}
.card-green {
  background: var(--green);
  color: var(--white);
  border-color: transparent;
}

/* ── Form elements ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
input[type="text"], input[type="email"], textarea, select {
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: 0.95rem;
  background: var(--white); color: var(--dark);
  transition: border-color var(--transition);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--green);
}
textarea { resize: vertical; min-height: 100px; }

/* ── Status badges ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-draft     { background: #EEE; color: var(--muted); }
.badge-published { background: #D4EDDA; color: #1A6B35; }
.badge-cellar    { background: #F0E6D3; color: #8B5E3C; }
.badge-active    { background: #D4EDDA; color: #1A6B35; }
.badge-pending   { background: #FFF3CD; color: #856404; }
.badge-completed { background: #E2E3E5; color: #495057; }
.badge-live      { background: var(--yellow); color: var(--dark); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Trait bars ── */
.trait-bars { display: flex; flex-direction: column; gap: 6px; }
.trait-row { display: flex; align-items: center; gap: 10px; }
.trait-label { font-size: 0.75rem; color: var(--muted); width: 120px; flex-shrink: 0; }
.trait-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.trait-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.5s ease; }
.trait-value { font-size: 0.75rem; font-weight: 600; color: var(--dark); width: 16px; text-align: right; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state h3 { color: var(--muted); font-size: 1rem; margin-bottom: 8px; }

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 24px;
}
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ── Toast notifications ── */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--dark); color: var(--cream);
  padding: 12px 20px; border-radius: var(--radius-md);
  font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

@keyframes slideIn {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ══════════════════════════════════════════════
   ADMIN LAYOUT (desktop)
══════════════════════════════════════════════ */

.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--dark);
  padding: 32px 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.sidebar-logo {
  padding: 0 24px 32px;
  font-family: var(--font-head);
  font-size: 1.3rem; font-weight: 800;
  color: var(--yellow);
  letter-spacing: -0.02em;
}
.sidebar-logo span { color: var(--cream); }

.sidebar-section { padding: 0 12px; margin-bottom: 8px; }
.sidebar-section-label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: #666; padding: 0 12px; margin-bottom: 4px;
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  color: #aaa; text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition);
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,0.08);
  color: var(--cream);
}
.sidebar-link.active { color: var(--yellow); }

.admin-main { padding: 40px; overflow-y: auto; }

.page-header { margin-bottom: 32px; }
.page-header h1 { margin-bottom: 8px; }
.page-header p { color: var(--muted); }

.page-actions { display: flex; gap: 12px; align-items: center; margin-bottom: 32px; }

/* ── Data table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 16px;
  font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.data-table tr:hover td { background: rgba(0,0,0,0.02); cursor: pointer; }
.data-table tr:last-child td { border-bottom: none; }

/* ── Grid layouts ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Stat cards ── */
.stat-card { background: var(--white); border-radius: var(--radius-lg); padding: 24px; border: 1px solid var(--border); }
.stat-card .stat-value { font-family: var(--font-head); font-size: 2.2rem; font-weight: 800; color: var(--green); }
.stat-card .stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
  padding: 10px 20px; border: none; background: none;
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all var(--transition);
}
.tab.active, .tab:hover { color: var(--dark); }
.tab.active { border-bottom-color: var(--green); color: var(--green); font-weight: 600; }

/* ══════════════════════════════════════════════
   COUPLE EXPERIENCE (mobile-first)
══════════════════════════════════════════════ */

.flip-app {
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
}

.flip-screen {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 32px 24px 100px;
  min-height: 100vh;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flip-screen-dark {
  background: var(--dark);
  color: var(--cream);
}
.flip-screen-green {
  background: var(--green);
  color: var(--white);
}
.flip-screen-yellow {
  background: var(--yellow);
  color: var(--dark);
}

/* Stage indicator */
.stage-indicator {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 32px;
}
.stage-dots { display: flex; gap: 5px; }
.stage-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transition: all var(--transition);
}
.stage-dot.done { background: rgba(255,255,255,0.6); }
.stage-dot.current { background: var(--yellow); width: 18px; border-radius: 3px; }
.stage-dot-dark { background: rgba(0,0,0,0.15); }
.stage-dot-dark.done { background: rgba(0,0,0,0.4); }
.stage-dot-dark.current { background: var(--green); }
.stage-num { font-size: 0.78rem; font-weight: 600; opacity: 0.5; margin-left: auto; }

/* Stage content */
.stage-name {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.12em; opacity: 0.6; margin-bottom: 16px;
}
.stage-text {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  font-weight: 700;
  line-height: 1.3;
  flex: 1;
}

/* Waiting state */
.waiting-state {
  text-align: center; padding: 40px 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.waiting-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-text { font-size: 0.95rem; opacity: 0.7; }

/* Bottom action bar */
.flip-bottom {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 430px;
  padding: 16px 24px 32px;
  background: linear-gradient(to top, rgba(28,28,26,0.95) 60%, transparent);
}
.flip-bottom-light {
  background: linear-gradient(to top, var(--cream) 60%, transparent);
}
.flip-bottom-green {
  background: linear-gradient(to top, var(--green) 60%, transparent);
}

/* Feedback button (always present) */
.feedback-btn {
  position: fixed; bottom: 88px; right: 16px;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--transition);
  backdrop-filter: blur(10px);
  z-index: 100;
  font-size: 1.1rem;
}
.feedback-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }
.feedback-btn-dark {
  background: rgba(0,0,0,0.2);
  border-color: rgba(0,0,0,0.2);
}

/* Intervention overlay */
.intervention-overlay {
  position: fixed; inset: 0;
  background: var(--yellow);
  color: var(--dark);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 32px;
  z-index: 500;
  animation: fadeIn 0.3s ease;
}
.intervention-overlay .intervention-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.15em; opacity: 0.5; margin-bottom: 24px;
}
.intervention-overlay .intervention-message {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 800;
  text-align: center; line-height: 1.2;
  flex: 1; display: flex; align-items: center;
}

/* Feedback panel */
.feedback-panel {
  position: fixed; inset: 0;
  background: var(--dark);
  color: var(--cream);
  padding: 40px 24px;
  z-index: 400;
  display: flex; flex-direction: column;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.feedback-panel h3 { margin-bottom: 8px; }
.feedback-panel p { opacity: 0.6; font-size: 0.9rem; margin-bottom: 24px; }
.feedback-panel textarea {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
  color: var(--cream); flex: 1;
}
.feedback-panel textarea::placeholder { color: rgba(255,255,255,0.3); }

/* Sit stage */
.sit-question {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 4.5vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
  flex: 1; display: flex; align-items: center;
  text-align: center;
}
.sit-progress {
  text-align: center; font-size: 0.8rem; opacity: 0.5;
  margin-bottom: 16px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
