/* ==========================================================================
   TalkTag — Futuristic Design System 2026
   Dark-first · Neon gradients · Glassmorphism · Ghost aesthetic
   ========================================================================== */

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

:root {
  /* --- Surfaces (deep space blacks) --- */
  --bg:           #0a0a12;
  --bg-soft:      #0f0f1a;
  --surface:      #14141f;
  --surface-2:    #1a1a28;
  --surface-3:    #20202f;
  --border:       #2a2a3a;
  --border-soft:  #232331;

  /* --- Neon accents --- */
  --purple:   #a855f7;
  --purple-d: #7c3aed;
  --pink:     #ec4899;
  --pink-d:   #db2777;
  --blue:     #3b82f6;
  --green:    #10b981;
  --orange:   #f59e0b;
  --cyan:     #06b6d4;
  --red:      #ef4444;

  /* --- Gradients --- */
  --grad-main:  linear-gradient(135deg, #ec4899 0%, #a855f7 55%, #6366f1 100%);
  --grad-purple:linear-gradient(135deg, #a855f7, #7c3aed);
  --grad-pink:  linear-gradient(135deg, #ec4899, #db2777);
  --grad-cta:   linear-gradient(135deg, #ec4899 0%, #a855f7 100%);

  /* --- Text --- */
  --text:      #f1f1f5;
  --text-soft: #a0a0b8;
  --text-mute: #6b6b80;

  /* --- Effects --- */
  --glow-purple: 0 0 24px rgba(168, 85, 247, 0.35);
  --glow-pink:   0 0 24px rgba(236, 72, 153, 0.35);
  --shadow:      0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg:   0 20px 60px rgba(0, 0, 0, 0.6);

  /* --- Glass --- */
  --glass:     rgba(26, 26, 40, 0.65);
  --glass-brd: rgba(255, 255, 255, 0.06);

  --radius:    18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--purple); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* --- Ambient background glow --- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(600px circle at 15% 10%, rgba(168,85,247,0.12), transparent 60%),
    radial-gradient(500px circle at 85% 90%, rgba(236,72,153,0.10), transparent 60%);
}

/* --- Mobile app shell (centered, max 480px) --- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
.gradient-text {
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.muted { color: var(--text-soft); }
.dim   { color: var(--text-mute); }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--grad-cta);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  width: 100%;
  transition: transform .12s, box-shadow .2s, opacity .2s;
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.3);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: none;
}
.btn-ghost:active { background: var(--surface-2); }
.btn-glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  color: var(--text);
  box-shadow: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-sm { padding: 10px 16px; font-size: 13px; width: auto; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 8px 24px rgba(239,68,68,0.3); }

/* ==========================================================================
   CARDS / GLASS PANELS
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
}
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.card-glow {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: var(--grad-main);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  pointer-events: none;
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.input, input[type=text], input[type=email], input[type=password], textarea {
  width: 100%;
  padding: 15px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-mute); }
.input:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}
textarea { resize: vertical; min-height: 90px; }
.field-hint { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.input-counter { float: right; font-size: 12px; color: var(--text-mute); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error   { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-info    { background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.25); color: #d8b4fe; }

/* ==========================================================================
   GHOST AVATAR
   ========================================================================== */
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.ghost-ring {
  padding: 3px;
  background: var(--grad-main);
  border-radius: 50%;
  display: inline-flex;
}
.ghost-ring .ghost-inner {
  background: var(--bg);
  border-radius: 50%;
  padding: 4px;
  display: inline-flex;
}
.online-dot {
  width: 12px; height: 12px;
  background: var(--green);
  border: 2.5px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16,185,129,0.6);
}

/* ==========================================================================
   TOP BAR / HEADER
   ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10,10,18,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar h2 { flex: 1; text-align: center; }
.icon-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.icon-btn:active { background: var(--surface-3); }

/* ==========================================================================
   BOTTOM NAVIGATION (floating)
   ========================================================================== */
.bottom-nav {
  position: sticky;
  bottom: 0;
  margin: 0 14px 14px;
  display: flex;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  z-index: 40;
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 0;
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 600;
  transition: color .15s;
}
.nav-item.active { color: var(--purple); }
.nav-item.active svg { filter: drop-shadow(0 0 6px rgba(168,85,247,0.6)); }

/* ==========================================================================
   CHAT LIST ITEM
   ========================================================================== */
.chat-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  transition: background .15s;
  position: relative;
}
.chat-row:active { background: var(--surface-2); }
.chat-row-av { position: relative; flex-shrink: 0; }
.chat-row-av .online-dot { position: absolute; bottom: 0; right: 0; }
.chat-row-body { flex: 1; min-width: 0; }
.chat-row-name { font-weight: 600; font-size: 15px; }
.chat-row-preview {
  font-size: 13px; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.chat-row-meta { text-align: right; flex-shrink: 0; }
.chat-row-time { font-size: 11px; color: var(--text-mute); }
.unread-badge {
  display: inline-block;
  min-width: 20px; height: 20px;
  line-height: 20px;
  text-align: center;
  background: var(--grad-cta);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  margin-top: 6px;
  box-shadow: var(--glow-pink);
}

/* ==========================================================================
   CHAT SCREEN — MESSAGE BUBBLES
   ========================================================================== */
.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.msg-row { display: flex; gap: 8px; align-items: flex-end; max-width: 85%; }
.msg-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.theirs { align-self: flex-start; }
.bubble {
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-row.mine .bubble {
  background: var(--grad-cta);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.msg-row.theirs .bubble {
  background: var(--surface-3);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.msg-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 3px;
  display: block;
}
.msg-row.mine .msg-time { text-align: right; }
.day-divider {
  align-self: center;
  font-size: 11px;
  color: var(--text-mute);
  background: var(--surface-2);
  padding: 4px 14px;
  border-radius: 999px;
  margin: 10px 0;
}

/* Typing indicator */
.typing-dots { display: inline-flex; gap: 3px; padding: 4px 0; }
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-mute);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Privacy banner inside chat */
.privacy-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: var(--radius-sm);
  margin: 12px 14px;
  font-size: 12.5px;
  color: var(--text-soft);
}

/* Chat input bar */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  background: rgba(10,10,18,0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-soft);
}
.chat-input-bar textarea {
  flex: 1;
  min-height: 46px;
  max-height: 120px;
  padding: 12px 16px;
  border-radius: 23px;
  resize: none;
  background: var(--surface-2);
}
.send-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--grad-cta);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--glow-purple);
  transition: transform .12s;
}
.send-btn:active { transform: scale(0.9); }

/* ==========================================================================
   LIST ROWS (settings / menu)
   ========================================================================== */
.menu-list { display: flex; flex-direction: column; }
.menu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.menu-row:last-child { border-bottom: none; }
.menu-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: rgba(168,85,247,0.12);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-body { flex: 1; min-width: 0; }
.menu-title { font-weight: 600; font-size: 15px; }
.menu-sub { font-size: 12.5px; color: var(--text-soft); margin-top: 1px; }
.menu-value { font-size: 13px; color: var(--purple); font-weight: 600; }
.section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-mute);
  text-transform: uppercase;
  margin: 22px 4px 8px;
}

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */
.toggle {
  position: relative;
  width: 48px; height: 28px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute;
  inset: 0;
  background: var(--surface-3);
  border-radius: 999px;
  transition: background .2s;
}
.toggle .thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.toggle input:checked + .track { background: var(--grad-purple); }
.toggle input:checked + .track .thumb { transform: translateX(20px); }

/* ==========================================================================
   PILLS / CHIPS / TABS
   ========================================================================== */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all .15s;
}
.pill.active {
  background: var(--grad-cta);
  color: #fff;
  border-color: transparent;
}
.tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}
.tab.active { background: var(--grad-cta); color: #fff; border-color: transparent; }

/* ==========================================================================
   AVATAR / THEME PICKER
   ========================================================================== */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.picker-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all .15s;
}
.picker-item.selected {
  border-color: var(--purple);
  box-shadow: var(--glow-purple);
}
.picker-item.selected::after {
  content: '✓';
  position: absolute;
  top: -8px; right: -8px;
  width: 22px; height: 22px;
  background: var(--grad-cta);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
}

/* ==========================================================================
   STEP PROGRESS (onboarding)
   ========================================================================== */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 0;
}
.step-node {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface-2);
  border: 2px solid var(--border);
  color: var(--text-mute);
}
.step-node.done { background: var(--grad-purple); border-color: transparent; color: #fff; }
.step-node.active {
  background: var(--grad-cta);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--glow-pink);
}
.step-line {
  width: 36px; height: 2px;
  background: var(--border);
}
.step-line.done { background: var(--purple); }
.step-labels {
  display: flex;
  justify-content: center;
  gap: 30px;
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
}

/* ==========================================================================
   QR DISPLAY
   ========================================================================== */
.qr-frame {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  display: inline-block;
  position: relative;
}
.qr-frame canvas, .qr-frame img { display: block; border-radius: 6px; }
.qr-center-logo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 52px; height: 52px;
  background: var(--grad-cta);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #fff;
}

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 50px 30px;
  color: var(--text-mute);
}
.empty .empty-icon {
  width: 90px; height: 90px;
  margin-bottom: 16px;
  opacity: 0.6;
}

/* ==========================================================================
   MODALS / SHEETS
   ========================================================================== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheetUp .25s ease-out;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 18px;
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   UTILITIES
   ========================================================================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }  .mt-16 { margin-top: 16px; }  .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; } .p-20 { padding: 20px; } .px-18 { padding-left: 18px; padding-right: 18px; }
.w-full { width: 100%; }
.scroll-y { overflow-y: auto; }
.relative { position: relative; }
.hidden { display: none !important; }
.fade-in { animation: fadeIn .3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar */
::-webkit-scrollbar { width: 0; height: 0; }

/* Safe area for notched phones */
.app { padding-bottom: env(safe-area-inset-bottom); }
