/* PADI v1.0 — mobile-first stylesheet
   Target: works on 2G, <8KB minified.
   Approach: utility-light, component-based, dark-mode aware.
*/

:root {
  --accent: #0a7c5a;
  --accent-fg: #ffffff;
  --bg: #ffffff;
  --bg-subtle: #f5f5f5;
  --fg: #1a1a1a;
  --fg-muted: #6b6b6b;
  --border: #e2e2e2;
  --danger: #c81e1e;
  --warning: #d97706;
  --radius: 10px;
  --gap: 14px;
  --tap: 44px;
  --maxw: 540px;
}

.dark-theme {
  --bg: #0e0e10;
  --bg-subtle: #1a1a1d;
  --fg: #f0f0f2;
  --fg-muted: #9a9aa0;
  --border: #2a2a2e;
}

.retro-theme {
  --accent: #00aa00;
  --accent-fg: #000000;
  --bg: #000000;
  --bg-subtle: #111111;
  --fg: #00ff00;
  --fg-muted: #66aa66;
  --border: #004400;
  --radius: 0;
  font-family: "Courier New", monospace;
}

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

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:active { opacity: 0.7; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: var(--maxw);
  margin: 0 auto;
  background: var(--bg);
}

/* TOPBAR */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: max(12px, env(safe-area-inset-top));
}
.brand { font-size: 22px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.brand-dot { color: var(--fg); }
.topbar-nav { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.topbar-nav a { color: var(--fg); }
.link-quiet { color: var(--fg-muted); }

/* SITEBAR */
.sitebar {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 80%, #000));
  color: var(--accent-fg);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.sitebar-name { color: var(--accent-fg); font-weight: 700; font-size: 15px; }
.sitebar-meta { opacity: 0.85; }
.sitebar-manage { margin-left: auto; color: var(--accent-fg); text-decoration: underline; }

/* CONTENT */
.content { flex: 1; padding: 14px; padding-bottom: 80px; }

/* TYPOGRAPHY */
h1 { font-size: 24px; margin-bottom: 12px; letter-spacing: -0.02em; }
h2 { font-size: 19px; margin-bottom: 10px; }
h3 { font-size: 16px; margin-bottom: 8px; }
p  { margin-bottom: 10px; }
.muted { color: var(--fg-muted); }
.center { text-align: center; }
.small { font-size: 13px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--fg);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.1s;
  font-family: inherit;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 32px; padding: 6px 12px; font-size: 13px; }

/* FORMS */
form { display: flex; flex-direction: column; gap: 12px; }
label { font-weight: 600; font-size: 14px; display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 16px; /* prevent iOS zoom */
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field-error { color: var(--danger); font-size: 13px; }
.form-card {
  background: var(--bg-subtle);
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* CARDS */
.card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card-pad-lg { padding: 18px; }
.card-row { display: flex; gap: 12px; align-items: center; }

/* AVATAR */
.avatar {
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  object-fit: cover;
}
.avatar-initials { letter-spacing: -1px; }

/* LISTS */
.list { display: flex; flex-direction: column; gap: 0; }
.list-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}
.list-item:last-child { border-bottom: none; }

/* GUESTBOOK / Q&A ENTRIES */
.entry {
  background: var(--bg-subtle);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.entry-meta { font-size: 12px; color: var(--fg-muted); margin-top: 6px; }
.entry-author { font-weight: 700; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-fg);
}
.badge-soft { background: var(--bg-subtle); color: var(--fg-muted); border: 1px solid var(--border); }
.badge-warn { background: var(--warning); color: white; }
.badge-danger { background: var(--danger); color: white; }

/* TOGGLE SWITCH (feature on/off) */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 2px; top: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* DISCOVER CARDS (Tinder-style) */
.discover-deck { position: relative; min-height: 460px; }
.discover-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(0,0,0,0.08);
}
.discover-card-photo {
  width: 100%;
  height: 360px;
  object-fit: cover;
  background: var(--border);
}
.discover-card-info { padding: 14px; }
.discover-card-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}
.btn-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-circle.pass { background: var(--bg); color: var(--danger); border: 1px solid var(--border); }
.btn-circle.like { background: var(--accent); color: var(--accent-fg); }

/* ADS */
.ad { margin: 16px 0; text-align: center; min-height: 50px; }
.ad-header { padding: 8px 14px 0; }
.ad::before {
  content: 'ad';
  display: block;
  font-size: 10px;
  color: var(--fg-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* FOOTER */
.footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
}
.footer-inner { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.footer-brand { font-weight: 800; color: var(--accent); font-size: 18px; }
.footer-brand .brand-dot { color: var(--fg); }
.footer-tagline { color: var(--fg-muted); }
.footer-cta { color: var(--accent); font-weight: 600; margin-top: 4px; }
.footer-mini { color: var(--fg-muted); font-size: 11px; margin-top: 10px; }
.footer-copy { display: block; margin-top: 4px; }

/* ERRORS / FLASH */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 14px;
}
.flash-error { background: rgba(200,30,30,0.1); color: var(--danger); border: 1px solid var(--danger); }
.flash-ok { background: rgba(10,124,90,0.1); color: var(--accent); border: 1px solid var(--accent); }

/* TEMPLATES PICKER */
.template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.template-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  background: var(--bg-subtle);
}
.template-card.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--bg-subtle)); }
.template-card h3 { color: var(--accent); }

/* DATING / DISCOVER */
.match-card {
  background: var(--bg-subtle);
  padding: 16px;
  border-radius: 14px;
  text-align: center;
  border: 1px solid var(--accent);
}

/* COUNTER WIDGET */
.widget-counter {
  text-align: center;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  margin: 12px 0;
}
.widget-counter .num { font-size: 32px; font-weight: 800; color: var(--accent); }
.widget-counter .label { font-size: 12px; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* UTILITIES */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.hidden { display: none; }
.full { width: 100%; }

/* MEMBER WALL (homepage recent members grid) */
.member-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.member-card {
  text-align: center;
  text-decoration: none;
  color: inherit;
  padding: 8px 4px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  transition: transform 0.1s;
}
.member-card:active { transform: scale(0.95); }
.member-card .avatar { margin: 0 auto 6px; display: block; }
.member-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-time { font-size: 10px; color: var(--fg-muted); }

/* DATING TEMPLATE EXTRAS */
.hero-dating .btn-primary {
  background: linear-gradient(135deg, #f093fb, #f5576c);
}
.hero-dating h1 { letter-spacing: -0.03em; }

/* CONFESSIONS TEMPLATE EXTRAS */
.hero-confessions {
  font-family: "Courier New", monospace !important;
}
.hero-confessions input,
.hero-confessions textarea {
  background: #000 !important;
  color: #0f0 !important;
  border: 1px solid #0f0 !important;
  font-family: "Courier New", monospace !important;
}
.hero-confessions ::placeholder {
  color: #080 !important;
}
