/* ==========================================================================
   NEXUS CHAT - Modern Responsive Glassmorphism Design System
   ========================================================================== */

:root, [data-theme="dark"] {
  --bg-dark: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-sidebar: rgba(13, 19, 33, 0.85);
  --bg-chat-main: rgba(11, 15, 25, 0.95);
  --bg-chat-header: rgba(17, 24, 39, 0.85);
  --bg-chat-input: rgba(17, 24, 39, 0.95);
  --bg-chat-tabs-bar: rgba(0, 0, 0, 0.4);
  --bg-chat-tab: rgba(255, 255, 255, 0.04);
  --bg-chat-tab-active: rgba(17, 24, 39, 0.95);
  --bg-native-ad: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(17, 24, 39, 0.9));
  --text-ad-title: #ffffff;
  --bg-mobile-nav: rgba(9, 13, 22, 0.95);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(6, 182, 212, 0.5);
  
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --accent-purple: #8b5cf6;
  --accent-pink: #ec4899;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --msg-received-bg: rgba(31, 41, 55, 0.9);
  --msg-received-text: #f3f4f6;
  --input-bg: rgba(0, 0, 0, 0.4);
  --header-bg: rgba(9, 13, 22, 0.85);
  --modal-bg: rgba(17, 24, 39, 0.95);
  --body-grad-1: rgba(6, 182, 212, 0.08);
  --body-grad-2: rgba(139, 92, 246, 0.08);

  /* Top Ad Banner Theme Variables */
  --bg-top-ad: linear-gradient(90deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  --border-top-ad: var(--border-glass);
  --text-top-ad: var(--text-main);
  --tag-ad-bg: rgba(236, 72, 153, 0.15);
  --tag-ad-color: var(--accent-pink);
  --tag-ad-border: rgba(236, 72, 153, 0.35);

  /* Trust Badges Theme Variables (Center Hero Boxes) */
  --bg-trust-badge: rgba(17, 24, 39, 0.85);
  --border-trust-badge: var(--border-glass);
  --text-trust-badge: var(--text-main);
  --shadow-trust-badge: 0 4px 12px rgba(0, 0, 0, 0.35);
  --hover-bg-trust-badge: rgba(236, 72, 153, 0.12);
  --hover-border-trust-badge: rgba(236, 72, 153, 0.5);
  --hover-text-trust-badge: #ffffff;
  --hover-shadow-trust-badge: 0 6px 18px rgba(236, 72, 153, 0.25);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', var(--font-sans);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.2);
  --shadow-purple-glow: 0 0 25px rgba(139, 92, 246, 0.25);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-dark: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(241, 245, 249, 1);
  --bg-sidebar: rgba(255, 255, 255, 0.94);
  --bg-chat-main: #f8fafc;
  --bg-chat-header: rgba(241, 245, 249, 0.95);
  --bg-chat-input: rgba(255, 255, 255, 0.95);
  --bg-chat-tabs-bar: #e2e8f0;
  --bg-chat-tab: rgba(255, 255, 255, 0.6);
  --bg-chat-tab-active: #ffffff;
  --bg-native-ad: linear-gradient(135deg, #ffffff, #f1f5f9);
  --text-ad-title: #0f172a;
  --bg-mobile-nav: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(248, 250, 252, 0.85);
  --border-glass: rgba(0, 0, 0, 0.09);
  --border-focus: rgba(2, 132, 199, 0.6);
  
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent-purple: #7c3aed;
  --accent-pink: #db2777;
  --accent-green: #059669;
  --accent-amber: #d97706;
  --accent-red: #dc2626;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --msg-received-bg: #e2e8f0;
  --msg-received-text: #0f172a;
  --input-bg: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.92);
  --modal-bg: #ffffff;
  --body-grad-1: rgba(124, 58, 237, 0.05);
  --body-grad-2: rgba(2, 132, 199, 0.05);

  /* Top Ad Banner Theme Variables */
  --bg-top-ad: linear-gradient(90deg, #f8fafc, #edf2f7);
  --border-top-ad: rgba(0, 0, 0, 0.09);
  --text-top-ad: #0f172a;
  --tag-ad-bg: rgba(219, 39, 119, 0.12);
  --tag-ad-color: #be185d;
  --tag-ad-border: rgba(219, 39, 119, 0.3);

  /* Trust Badges Theme Variables (Center Hero Boxes) */
  --bg-trust-badge: #ffffff;
  --border-trust-badge: rgba(0, 0, 0, 0.1);
  --text-trust-badge: #0f172a;
  --shadow-trust-badge: 0 3px 10px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --hover-bg-trust-badge: rgba(2, 132, 199, 0.08);
  --hover-border-trust-badge: rgba(2, 132, 199, 0.45);
  --hover-text-trust-badge: #0284c7;
  --hover-shadow-trust-badge: 0 6px 18px rgba(2, 132, 199, 0.16);
}

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

.hidden {
  display: none !important;
}

html, body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  background-image: 
    radial-gradient(circle at 15% 15%, var(--body-grad-1) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, var(--body-grad-2) 0%, transparent 40%);
  background-attachment: fixed;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.25);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Header */
.app-header {
  height: 68px;
  flex-shrink: 0;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.logo-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.75rem !important;
  cursor: pointer;
  user-select: none;
}

.header-logo-icon {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(168, 85, 247, 0.35));
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.header-logo-icon:hover {
  transform: scale(1.05);
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #f43f5e 0%, #a855f7 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-tagline-sub {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Hero Branding Showcase for Strangora */
.strangora-hero-banner {
  text-align: center;
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-logo-full {
  max-width: 320px;
  width: 88%;
  height: auto;
  object-fit: contain;
  margin-bottom: 0.85rem;
  filter: drop-shadow(0 12px 30px rgba(168, 85, 247, 0.3));
  transition: transform 0.3s ease;
}

.hero-logo-full:hover {
  transform: translateY(-2px);
}

[data-theme="light"] .hero-logo-full {
  filter: drop-shadow(0 8px 24px rgba(168, 85, 247, 0.22));
}

.hero-slogan {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: #e2e8f0;
  text-transform: uppercase;
  margin-top: 0.2rem;
  margin-bottom: 0.75rem;
  position: relative;
  display: inline-block;
  padding: 0 1rem 0.4rem 1rem;
}

.hero-slogan::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, #06b6d4, #a855f7, #ec4899);
  border-radius: var(--radius-full);
}

/* Strangora 4 Core Trust Badges (From uploaded logo) */
.strangora-trust-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  width: 100%;
}

.trust-badge {
  background: var(--bg-trust-badge);
  border: 1px solid var(--border-trust-badge);
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-trust-badge);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--shadow-trust-badge);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.trust-badge:hover {
  border-color: var(--hover-border-trust-badge);
  background: var(--hover-bg-trust-badge);
  color: var(--hover-text-trust-badge);
  box-shadow: var(--hover-shadow-trust-badge);
  transform: translateY(-1px);
}

.badge-icon {
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-random-match {
  background: linear-gradient(135deg, var(--accent-purple), var(--primary));
  color: #fff;
  border: none;
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
  transition: var(--transition);
}

.btn-random-match:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.btn-random-match.searching {
  animation: pulseGlow 1.5s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.user-badge-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
}

.vip-toggle-btn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-amber);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.vip-toggle-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

/* Banner Advertisement Slot */
.ad-banner-slot {
  flex-shrink: 0;
  background: var(--bg-top-ad);
  border-bottom: 1px solid var(--border-top-ad);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-top-ad);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.ad-banner-slot.hidden {
  display: none;
}

.ad-banner-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

#topAdText {
  color: var(--text-top-ad);
  transition: color 0.3s ease;
}

#topAdText strong {
  color: var(--text-top-ad);
  font-weight: 700;
}

.ad-tag {
  background: var(--tag-ad-bg);
  color: var(--tag-ad-color);
  border: 1px solid var(--tag-ad-border);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.ad-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  transition: color 0.2s ease;
}

.ad-close-btn:hover {
  color: var(--text-top-ad);
}

/* Page Containers */
.page-view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.page-view.active {
  display: flex;
  flex-direction: column;
}

#onboardingPage {
  overflow-y: auto;
  overscroll-behavior: contain;
}

#dashboardPage {
  height: 100%;
  overflow: hidden;
}

/* ==========================================================================
   PAGE 1: ONBOARDING / STEP 1 (GENDER & AGE SELECTION)
   ========================================================================== */
.onboarding-container {
  max-width: 820px;
  margin: 2.5rem auto;
  width: 92%;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.4s ease-out;
}

[data-theme="light"] .onboarding-container {
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.08);
}

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

.onboarding-header {
  text-align: center;
  margin-bottom: 2rem;
}

.onboarding-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.onboarding-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.mode-switcher {
  display: flex;
  background: var(--input-bg);
  padding: 4px;
  border-radius: var(--radius-full);
  width: fit-content;
  margin: 0 auto 2rem auto;
  border: 1px solid var(--border-glass);
}

.mode-tab {
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.mode-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.auth-sub-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px;
  border-radius: var(--radius-md);
  width: fit-content;
  margin: -1rem auto 1.5rem auto;
  border: 1px solid var(--border-glass);
}

.auth-sub-tab {
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
}

.auth-sub-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-green);
  color: #6ee7b7;
}

.terms-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.terms-checkbox-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.terms-checkbox-wrap a {
  color: var(--primary);
  text-decoration: underline;
}

.onboarding-legal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.onboarding-legal-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.onboarding-legal-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

body.modal-open {
  overflow: hidden !important;
}

.legal-modal-card {
  max-width: 680px;
  width: 92%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.legal-scroll-body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.legal-scroll-body h4 {
  color: var(--text-main);
  font-size: 1.02rem;
  font-weight: 700;
  margin: 1.4rem 0 0.4rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-glass);
}

.legal-scroll-body h5 {
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0.9rem 0 0.3rem 0;
}

.legal-scroll-body p {
  margin-bottom: 0.75rem;
}

.legal-scroll-body ul, .legal-scroll-body ol {
  padding-left: 1.35rem;
  margin: 0.4rem 0 0.75rem 0;
}

.legal-scroll-body li {
  margin-bottom: 0.35rem;
}

.legal-highlight-box {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  font-size: 0.84rem;
}

.legal-highlight-box.warning {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.legal-highlight-box.success {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}

.sidebar-legal-footer {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-glass);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.sidebar-legal-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.sidebar-legal-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.account-auth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-control, select.form-control {
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

/* Gender Selection Cards */
.gender-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.gender-card {
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-main);
}

.gender-card:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.gender-card.selected {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.15);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

[data-theme="light"] .gender-card.selected {
  background: rgba(2, 132, 199, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.gender-icon {
  font-size: 1.5rem;
}

.gender-name {
  font-size: 0.85rem;
  font-weight: 600;
}

/* Age Slider Container */
.age-slider-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.age-slider {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.age-display-badge {
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
  min-width: 65px;
  text-align: center;
}

/* CTA Button */
.btn-primary-lg {
  width: 100%;
  padding: 1.1rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.3);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-primary-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(6, 182, 212, 0.45);
}

/* ==========================================================================
   PAGE 2: DASHBOARD / LOBBY & MULTI-USER CHAT
   ========================================================================== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 340px 1fr 300px;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 1200px) {
  .dashboard-layout {
    grid-template-columns: 320px 1fr;
  }
  .right-sidebar {
    display: none !important;
  }
}

/* Left Sidebar: Online User List & Gender Filter */
.left-sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 1.25rem 1rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.online-count-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Gender Filter Pills (STRICTLY GENDER FILTER ONLY) */
.gender-filter-bar {
  display: flex;
  gap: 0.35rem;
  background: var(--input-bg);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-bottom: 0.5rem;
}

.filter-pill {
  flex: 1;
  padding: 0.45rem 0.3rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.filter-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.filter-pill.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

/* User List Container */
.user-list-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

/* Online User Card */
.user-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: var(--transition);
  cursor: pointer;
}

.user-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(6, 182, 212, 0.3);
  transform: translateX(2px);
}

.user-card.active-chat {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.1);
}

.user-card-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.user-card-avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg-dark);
}

.user-card-info {
  flex: 1;
  min-width: 0;
}

.user-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.user-card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-id {
  font-size: 0.72rem;
  color: var(--primary);
  font-family: monospace;
  background: rgba(6, 182, 212, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
}

.user-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-message-sm {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-message-sm:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

/* Center Column: Multi-User Chat Area */
.chat-main-area {
  display: flex;
  flex-direction: column;
  background: var(--bg-chat-main);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Chat Tabs Bar (Supports messaging multiple users!) */
.chat-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-chat-tabs-bar);
  padding: 0.5rem 1rem 0 1rem;
  border-bottom: 1px solid var(--border-glass);
  overflow-x: auto;
  flex-shrink: 0;
}

.chat-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-chat-tab);
  border: 1px solid var(--border-glass);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  max-width: 180px;
}

.chat-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.chat-tab.active {
  background: var(--bg-chat-tab-active);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.chat-tab-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 2px;
  border-radius: 50%;
}

.chat-tab-close:hover {
  color: var(--accent-red);
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-pink);
  box-shadow: 0 0 8px var(--accent-pink);
}

/* Empty State Window */
.empty-chat-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

/* Active Chat Container */
.chat-window {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-header {
  padding: 0.85rem 1.25rem;
  background: var(--bg-chat-header);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-user-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.chat-user-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-action-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-action-icon:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.12);
}

.btn-action-icon.block-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Chat Messages Feed */
.messages-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.msg-row.sent {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.received {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
}

.msg-row.sent .msg-bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-purple) 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
}

.msg-row.received .msg-bubble {
  background: var(--msg-received-bg);
  border: 1px solid var(--border-glass);
  color: var(--msg-received-text);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 0.9rem;
  background: var(--msg-received-bg);
  border-radius: 14px;
  width: fit-content;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.dot-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseDot 1.4s infinite ease-in-out;
}
.dot-pulse:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulseDot {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 0.85rem 1.25rem 1.15rem 1.25rem;
  background: var(--bg-chat-input);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.chat-input-field {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  outline: none;
}

.chat-input-field:focus {
  border-color: var(--primary);
}

.btn-send {
  background: linear-gradient(135deg, var(--primary), var(--accent-purple));
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.btn-send:hover {
  transform: scale(1.05);
}

/* Right Sidebar: Profile & Native Sidebar Ad Card */
.right-sidebar {
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-glass);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  height: 100%;
  min-height: 0;
}

/* Native Sidebar Advertisement Card */
.native-ad-card {
  background: var(--bg-native-ad);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  position: relative;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.native-ad-card.hidden {
  display: none;
}

.ad-badge-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.ad-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.ad-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-ad-title);
}

.ad-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.ad-cta-btn {
  width: 100%;
  padding: 0.6rem;
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--accent-amber);
  color: var(--accent-amber);
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.ad-cta-btn:hover {
  background: var(--accent-amber);
  color: #000;
}

/* Mobile Bottom Navigation Bar */
.mobile-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-mobile-nav);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-glass);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item-icon {
  font-size: 1.2rem;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 480px;
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.6);
  animation: fadeIn 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Responsive Rules for Mobile & Tablet */
@media (max-width: 768px) {
  .app-header {
    padding: 0 1rem;
    height: 60px;
    flex-shrink: 0;
  }
  
  #dashboardPage {
    height: 100%;
    padding-bottom: 60px; /* Leave space for 60px fixed bottom nav bar */
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
    height: 100%;
    min-height: 0;
  }

  .left-sidebar {
    display: flex;
  }

  .chat-main-area {
    display: none;
  }

  .dashboard-layout.mobile-chat-view .left-sidebar {
    display: none;
  }

  .dashboard-layout.mobile-chat-view .chat-main-area {
    display: flex;
  }

  .mobile-nav-bar {
    display: flex;
  }

  .onboarding-container {
    padding: 1.5rem;
    margin: 1rem auto;
  }

  .onboarding-title {
    font-size: 1.75rem;
  }
}
