:root {
  --bg-dark: #09090b;
  --bg-surface: #141417;
  --bg-card: #1c1c20;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent-white: #ffffff;
  --accent-pro: #d4af37;
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --success: #10b981;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --nav-bg: #141417;
}

/* Light Theme Variables */
@media (prefers-color-scheme: light) {
  :root {
    --bg-dark: #f4f4f5;
    --bg-surface: #ffffff;
    --bg-card: #e4e4e7;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.14);
    --text-main: #09090b;
    --text-muted: #71717a;
    --text-dim: #a1a1aa;
    --accent-white: #09090b;
    --nav-bg: #ffffff;
  }
}

[data-theme="dark"] {
  --bg-dark: #09090b;
  --bg-surface: #141417;
  --bg-card: #1c1c20;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.14);
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent-white: #ffffff;
  --nav-bg: #141417;
}

[data-theme="light"] {
  --bg-dark: #f4f4f5;
  --bg-surface: #ffffff;
  --bg-card: #e4e4e7;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.14);
  --text-main: #09090b;
  --text-muted: #71717a;
  --text-dim: #a1a1aa;
  --accent-white: #09090b;
  --nav-bg: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  width: 100%;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Container (No Left Vignette Shadow) */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-dark);
  overflow: hidden;
  box-shadow: none;
}

/* Top Header Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
  transition: background 0.3s ease;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-pro-pill {
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent-pro);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-auth-pill {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* Slide-out Side Hamburger Drawer (Zero Left Vignette Shadow when Closed) */
.hamburger-drawer {
  position: absolute;
  top: 0; left: 0;
  width: 280px;
  height: 100%;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: none;
}

.hamburger-drawer.open {
  transform: translateX(0);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.drawer-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.drawer-menu-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.2s;
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Theme Switcher inside Hamburger Drawer */
.drawer-theme-box {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 10px;
}

.drawer-theme-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.drawer-theme-row {
  display: flex;
  gap: 6px;
}

.theme-pill-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 0;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-pill-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-light);
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Auth Mode Toggle Switcher */
.mode-toggle-row {
  display: flex;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 16px;
}

.mode-toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 0;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-toggle-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Scrollable Main View Area */
.view-viewport {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.view-viewport::-webkit-scrollbar { display: none; }

.tab-view {
  padding: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}

.tab-view.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  position: relative;
}

/* 1. CALL VIEW */
.call-view-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  padding: 20px 0;
}

.hero-text h2 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.hero-text p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  margin-right: 4px;
}

.call-main-action {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin: 30px 0;
}

.pulse-call-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--accent-white);
  color: var(--bg-dark);
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
}

.pulse-call-circle:active {
  transform: scale(0.94);
}

.topic-pills-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.topic-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.topic-pill.active {
  background: var(--accent-white);
  color: var(--bg-dark);
  font-weight: 700;
  border-color: var(--accent-white);
}

/* Radar Search Matchmaking Overlay */
.radar-search-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-dark);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.radar-search-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.radar-spinner-box {
  position: relative;
  width: 140px; height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-wave {
  position: absolute;
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  animation: radarPulse 2s infinite cubic-bezier(0.16, 1, 0.3, 1);
}

.radar-wave:nth-child(2) { animation-delay: 0.6s; }
.radar-wave:nth-child(3) { animation-delay: 1.2s; }

@keyframes radarPulse {
  0% { transform: scale(0.4); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.radar-center-icon {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-size: 1.8rem;
}

/* 2. CHAT VIEW */
.friends-horizontal-list {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  overflow-x: auto;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.friends-horizontal-list::-webkit-scrollbar { display: none; }

.friend-item-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.friend-item-chip.active { opacity: 1; }
.friend-chip-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-light); }
.friend-chip-name { font-size: 0.7rem; color: var(--text-main); max-width: 65px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-messages-container {
  flex: 1;
  min-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0;
  margin-bottom: 12px;
}

.chat-messages-container::-webkit-scrollbar { display: none; }

.chat-message {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 80%;
  font-size: 0.85rem;
}

.chat-message.me {
  align-self: flex-end;
  background: var(--accent-white);
  color: var(--bg-dark);
  font-weight: 500;
  border: none;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

/* 3. PREMIUM REDESIGNED PROFILE VIEW */
.profile-view-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 20px;
}

.profile-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.avatar-edit-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 12px;
}

.profile-avatar-xl {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-light);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.avatar-camera-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-white);
  color: var(--bg-dark);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.profile-badges-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.profile-badge {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.profile-badge.pro {
  background: rgba(212, 175, 55, 0.12);
  color: var(--accent-pro);
  border-color: rgba(212, 175, 55, 0.3);
}

.profile-form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Logout Button (Exclusively inside Profile View) */
.btn-profile-logout-clean {
  width: 100%;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #f87171;
  padding: 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  transition: background 0.2s;
}

.btn-profile-logout-clean:active {
  background: rgba(220, 38, 38, 0.2);
}

/* Bottom Navigation Bar */
.bottom-nav-bar {
  height: 64px;
  background: var(--nav-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 10;
  transition: background 0.3s ease;
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  padding: 8px 0;
  transition: color 0.2s;
}

.nav-tab-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  transition: stroke 0.2s;
}

.nav-tab-btn.active {
  color: var(--text-main);
}

.nav-tab-btn.active svg {
  stroke: var(--text-main);
}

/* Modals */
.modal {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  overflow: hidden;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}

.modal.show {
  opacity: 1; pointer-events: auto;
}

.modal-card {
  width: 100%; max-width: 400px; background: var(--bg-surface);
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 24px; position: relative;
  max-height: calc(100% - 32px); overflow-x: hidden; overflow-y: auto;
  overscroll-behavior: contain;
  transform: scale(0.95); transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.show .modal-card {
  transform: scale(1);
}

.close-btn {
  position: absolute; top: 16px; right: 16px; background: transparent;
  border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer;
}

.dp-actions { display: flex; gap: 6px; }
.btn-sm {
  font-size: 0.75rem; padding: 5px 10px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); color: var(--text-main); cursor: pointer;
}
.btn-sm-danger { color: var(--danger); border-color: var(--danger-bg); }

.form-group { margin-bottom: 14px; text-align: left; }
.form-group label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.form-input {
  width: 100%; background: var(--bg-dark); border: 1px solid var(--border-color);
  color: var(--text-main); padding: 10px 14px; border-radius: var(--radius-sm); outline: none; font-size: 0.85rem;
}

.btn-primary {
  background: var(--accent-white); color: var(--bg-dark); border: none; width: 100%; padding: 14px;
  border-radius: var(--radius-md); font-size: 0.9rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.15s;
}

.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color);
  color: var(--text-main); padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.8rem;
}

/* Call Overlay */
.call-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: var(--bg-dark); z-index: 999; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; padding: 30px 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}

.call-overlay.show {
  opacity: 1; pointer-events: auto;
}

.speakers-area { display: flex; flex-direction: column; align-items: center; gap: 30px; margin: auto 0; }
.avatar-wrapper { width: 90px; height: 90px; border-radius: 50%; }
.avatar-wrapper img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-light); }
.speaking img { border-color: var(--success); box-shadow: 0 0 25px var(--success); }

.call-controls { display: flex; gap: 14px; margin-bottom: 20px; }

.drawer-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.drawer-footer .drawer-version { margin-top: 0; }
.settings-action { width: 100%; margin: 8px 0 14px; }
.people-row[data-user-id] { cursor: pointer; }
.people-row[data-user-id]:active { transform: scale(.99); }
.history-profile-row { width: 100%; color: var(--text-main); border: 0; text-align: left; font: inherit; }
.history-profile-row .ui-icon { width: 18px; height: 18px; margin-left: auto; color: var(--text-muted); }
.public-profile-card { text-align: center; }
.public-profile-card > .profile-avatar-xl { display: block; margin: 12px auto; }
.public-profile-bio { color: var(--text-muted); margin: 8px auto 16px; max-width: 28rem; }
.public-profile-details { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; color: var(--text-muted); font-size: .82rem; }
.public-profile-details span { border: 1px solid var(--border-color); border-radius: 999px; padding: 6px 10px; }
.public-profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.feedback-input { min-height: 140px; resize: vertical; margin-bottom: 14px; }
.google-account-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: 5px; border-radius: 50%; border: 1px solid currentColor; font-size: 10px; font-weight: 800; line-height: 1; }
.incoming-call-card { position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 24px; }
.incoming-call-card > div { width: min(100%, 390px); padding: 28px; border-radius: 26px; background: var(--surface); border: 1px solid var(--border-color); text-align: center; box-shadow: var(--shadow-lg); }
.incoming-call-card img { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; margin: 12px auto; }
.incoming-call-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.control-btn {
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border-color);
  color: var(--text-main); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.2rem;
}
.control-btn.btn-next { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.3); }
.control-btn.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }

/* 3-Dots Dropdown Menu */
.dropdown-menu {
  position: absolute; top: 60px; right: 20px;
  background: var(--bg-surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 8px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5); z-index: 1001; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}

.dropdown-menu.show { opacity: 1; pointer-events: auto; }
.dropdown-item {
  background: transparent; border: none; color: var(--text-main);
  padding: 10px 14px; border-radius: var(--radius-sm); text-align: left; font-size: 0.82rem; cursor: pointer;
}
.dropdown-item:hover { background: rgba(255,255,255,0.06); }

.cooldown-badge { font-size: 0.72rem; color: var(--success); margin-top: 4px; }
.cooldown-badge.restricted { color: #f59e0b; }

.hidden { display: none !important; }
