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

:root {
  /* Brand Colors */
  --c-purple: #a855f7;
  --c-purple-dark: #7c3aed;
  --c-pink: #ec4899;
  --c-gradient: linear-gradient(135deg, var(--c-purple), var(--c-pink));
  --c-gradient-soft: linear-gradient(135deg, rgba(168,85,247,.15), rgba(236,72,153,.15));

  /* Backgrounds */
  --bg-base: #0a0a0f;
  --bg-card: #111118;
  --bg-card-hover: #18181f;
  --bg-glass: rgba(255,255,255,.04);
  --bg-glass-border: rgba(255,255,255,.08);

  /* Text */
  --text-primary: #f1f1f1;
  --text-secondary: #888;
  --text-muted: #444;

  /* Status */
  --c-online: #22c55e;
  --c-warning: #f59e0b;
  --c-error: #ef4444;
  --c-info: #3b82f6;

  /* Intent colors */
  --c-intent-networking: #3b82f6;
  --c-intent-friendship: #22c55e;
  --c-intent-romantic: #ec4899;
  --c-intent-spicy: #f97316;
  --c-intent-chat: #888;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-glow: 0 0 40px rgba(168,85,247,.25);
  --shadow-card: 0 4px 24px rgba(0,0,0,.4);

  /* Transitions */
  --t-fast: 150ms ease;
  --t-mid: 300ms ease;
  --t-slow: 500ms cubic-bezier(.16,1,.3,1);

  /* Safe areas for mobile */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; border-radius: var(--r-sm); }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, textarea { font-family: inherit; outline: none; }
a { color: inherit; text-decoration: none; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

/* ===== TYPOGRAPHY ===== */
.text-gradient {
  background: var(--c-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; line-height: 1.1; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }

/* ===== GLASS CARD ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
}
.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--r-lg);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--r-full);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--t-mid);
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--t-fast);
}
.btn:hover::after { background: rgba(255,255,255,.08); }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--c-gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  color: var(--text-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-icon {
  width: 44px; height: 44px;
  padding: 0;
  border-radius: var(--r-full);
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  color: var(--text-primary);
  font-size: 1.1rem;
}
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== INPUTS ===== */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.input {
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--t-fast);
  width: 100%;
}
.input:focus { border-color: var(--c-purple); }
.input::placeholder { color: var(--text-muted); }
.input-error { border-color: var(--c-error) !important; }

/* ===== AVATAR ===== */
.avatar {
  border-radius: var(--r-full);
  object-fit: cover;
  background: var(--c-gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--c-purple);
  flex-shrink: 0;
}
.avatar-sm { width: 36px; height: 36px; font-size: 0.85rem; }
.avatar-md { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 1.8rem; }
.avatar-xl { width: 120px; height: 120px; font-size: 2.5rem; }

/* Online dot */
.avatar-wrap { position: relative; display: inline-flex; }
.online-dot {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 12px; height: 12px;
  background: var(--c-online);
  border: 2px solid var(--bg-base);
  border-radius: var(--r-full);
}

/* ===== INTENT BADGES ===== */
.intent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid;
}
.intent-networking { color: var(--c-intent-networking); border-color: var(--c-intent-networking); background: rgba(59,130,246,.1); }
.intent-friendship  { color: var(--c-intent-friendship);  border-color: var(--c-intent-friendship);  background: rgba(34,197,94,.1);  }
.intent-romantic    { color: var(--c-intent-romantic);    border-color: var(--c-intent-romantic);    background: rgba(236,72,153,.1); }
.intent-spicy       { color: var(--c-intent-spicy);       border-color: var(--c-intent-spicy);       background: rgba(249,115,22,.1); }
.intent-chat_only   { color: var(--c-intent-chat);        border-color: var(--c-intent-chat);        background: rgba(136,136,136,.1); }

/* ===== VIP BADGE ===== */
.vip-badge {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #1a0a00;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--r-full);
  letter-spacing: .05em;
}

/* ===== NAVIGATION BAR ===== */
.nav-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10,10,15,.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--bg-glass-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-muted);
  transition: color var(--t-fast);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.nav-item.active { color: var(--c-purple); }
.nav-item svg { width: 22px; height: 22px; }
.nav-fab {
  width: 52px; height: 52px;
  background: var(--c-gradient);
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-glow);
  transition: transform var(--t-mid), box-shadow var(--t-mid);
}
.nav-fab:hover { transform: scale(1.1); box-shadow: 0 0 60px rgba(168,85,247,.4); }

/* ===== PAGE LAYOUT ===== */
.page {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(64px + var(--safe-bottom) + var(--space-md));
}
.page.active { display: flex; }

/* ===== SPLASH / AUTH ===== */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(168,85,247,.2) 0%, transparent 70%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}
.logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

/* ===== SHUFFLE CARD ===== */
.shuffle-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  gap: var(--space-lg);
}
.profile-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: cardIn var(--t-slow) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.profile-card__banner {
  height: 180px;
  background: var(--c-gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.profile-card__avatar-wrap {
  position: absolute;
  bottom: -36px;
  left: var(--space-lg);
}
.profile-card__body {
  padding: calc(36px + var(--space-md)) var(--space-lg) var(--space-lg);
}
.profile-card__name { font-size: 1.3rem; font-weight: 700; }
.profile-card__intents { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-sm); }
.shuffle-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.btn-skip {
  width: 56px; height: 56px;
  border-radius: var(--r-full);
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  color: var(--text-secondary);
  font-size: 1.3rem;
  transition: all var(--t-mid);
}
.btn-skip:hover { border-color: var(--c-error); color: var(--c-error); }
.btn-chat {
  flex: 1;
  max-width: 160px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--c-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: var(--shadow-glow);
  transition: all var(--t-mid);
}
.btn-chat:hover { transform: scale(1.05); }

/* ===== CHAT LIST ===== */
.chat-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
  cursor: pointer;
}
.chat-item:hover { background: var(--bg-card-hover); }
.chat-item__info { flex: 1; min-width: 0; }
.chat-item__name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item__preview { font-size: 0.82rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* ===== CHAT VIEW ===== */
.chat-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: rgba(10,10,15,.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bg-glass-border);
  position: sticky; top: 0; z-index: 10;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.92rem;
  line-height: 1.5;
  position: relative;
  animation: msgIn var(--t-fast) both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-out {
  align-self: flex-end;
  background: var(--c-gradient);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-in {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  border-bottom-left-radius: 4px;
}
.msg-system {
  align-self: center;
  background: var(--c-gradient-soft);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--r-full);
  font-size: 0.8rem;
  color: var(--c-purple);
  padding: 6px 16px;
  text-align: center;
}
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
  background: rgba(10,10,15,.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--bg-glass-border);
}
.chat-input {
  flex: 1;
  background: var(--bg-glass);
  border: 1px solid var(--bg-glass-border);
  border-radius: 22px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color var(--t-fast);
}
.chat-input:focus { border-color: var(--c-purple); }

/* ===== REVEAL BANNER ===== */
.reveal-banner {
  margin: var(--space-sm) var(--space-lg);
  padding: var(--space-md);
  border-radius: var(--r-md);
  background: var(--c-gradient-soft);
  border: 1px solid rgba(168,85,247,.3);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: slideDown 400ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal-banner__text { flex: 1; font-size: 0.9rem; }
.reveal-banner__actions { display: flex; gap: var(--space-sm); }

/* ===== MEDIA REQUEST ===== */
.media-request-msg {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-glass);
  border: 1px dashed var(--bg-glass-border);
  border-radius: var(--r-md);
}
.media-request-msg .media-type-icon { font-size: 2rem; }

/* ===== ONBOARDING ===== */
.onboarding-step { animation: cardIn var(--t-slow) both; }
.intent-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.intent-option {
  padding: var(--space-md);
  border-radius: var(--r-md);
  border: 2px solid var(--bg-glass-border);
  background: var(--bg-glass);
  text-align: center;
  cursor: pointer;
  transition: all var(--t-mid);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}
.intent-option:hover { border-color: var(--c-purple); background: rgba(168,85,247,.1); }
.intent-option.selected { border-color: var(--c-purple); background: rgba(168,85,247,.15); }
.intent-option .emoji { font-size: 2rem; }
.intent-option .label { font-size: 0.85rem; font-weight: 600; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
  width: 90%;
  max-width: 360px;
}
.toast {
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  animation: toastIn 300ms cubic-bezier(.16,1,.3,1) both;
  pointer-events: all;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast-error { border-color: var(--c-error); color: var(--c-error); }
.toast-success { border-color: var(--c-online); color: var(--c-online); }

/* ===== PROFILE PAGE ===== */
.profile-header {
  background: radial-gradient(ellipse 120% 80% at 50% 0%, rgba(168,85,247,.2) 0%, transparent 70%);
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

/* ===== UTILITY ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-secondary); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--bg-glass-border);
  border-top-color: var(--c-purple);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
