/* ============================================================
   CHAT APP — Shared Design System
   ============================================================ */

:root {
  --bg-black:        #000000;
  --bg-card:         #120826;
  --mid-purple:      #5B21B6;
  --primary-purple:  #7C3AED;
  --light-purple:    #C4B5FD;
  --soft-light:      #EDE9FE;
  --overlay:         #1E1B4B;
  --overlay-hover:   #252168;
  --error-red:       #F87171;
  --success-green:   #34D399;
  --transition-fast: 0.18s ease;
  --transition-med:  0.32s ease;
--radius-sm:       8px;
  --radius-md:       14px;
  --radius-lg:       20px;
  --card-width:      420px;
  --font-app: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Neumorphic soft-depth (kept on the existing colour palette) */
  --neu-shadow: 8px 8px 14px rgba(0,0,0,.45), -6px -6px 12px rgba(196,181,253,.05);
  --neu-inset:  inset 5px 5px 10px rgba(0,0,0,.38), inset -4px -4px 9px rgba(196,181,253,.05);
  --neu-tile:   6px 6px 13px rgba(0,0,0,.38), -5px -5px 11px rgba(196,181,253,.045);
  --bg-surface: #171129;
}

/* ── Light Mode Override ──────────────────────────────────── */
[data-theme="light"] {
  --bg-black:        #F5F3FF;
  --bg-card:         #FFFFFF;
  --mid-purple:      #7C3AED;
  --primary-purple:  #6D28D9;
  --light-purple:    #5B21B6;
  --soft-light:      #1E1B4B;
  --overlay:         #EDE9FE;
  --overlay-hover:   #DDD6FE;
  --error-red:       #DC2626;
  --success-green:   #059669;
  --neu-shadow: 8px 8px 14px rgba(49,20,91,.10), -6px -6px 12px rgba(255,255,255,.9);
  --neu-inset:  inset 5px 5px 9px rgba(49,20,91,.10), inset -4px -4px 9px rgba(255,255,255,.85);
  --neu-tile:   6px 6px 11px rgba(49,20,91,.08), -5px -5px 10px rgba(255,255,255,.85);
  --bg-surface: #F0ECFB;
}

[data-theme="light"] .page-shell {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,.12) 0%, transparent 70%), radial-gradient(ellipse 50% 40% at 100% 100%, rgba(91,33,182,.08) 0%, transparent 60%), var(--bg-black);
}

[data-theme="light"] .page-shell::before {
  background-image: linear-gradient(rgba(124,58,237,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(124,58,237,.08) 1px, transparent 1px);
}

[data-theme="light"] .card {
  border-color: rgba(124,58,237,.15);
  box-shadow: 0 0 0 1px rgba(124,58,237,.08), 0 20px 60px rgba(0,0,0,.08), 0 0 40px rgba(124,58,237,.04);
}

[data-theme="light"] .input-field {
  border-color: rgba(91,33,182,.2);
}

[data-theme="light"] .input-field::placeholder { color: rgba(91,33,182,.4); }

[data-theme="light"] .input-field:focus {
  background: #F5F3FF;
  box-shadow: 0 0 0 3px rgba(109,40,217,.12);
}

[data-theme="light"] .btn-secondary {
  border-color: rgba(91,33,182,.2);
  color: var(--light-purple);
}

[data-theme="light"] .btn-secondary:hover {
  background: #EDE9FE;
  border-color: var(--primary-purple);
}

[data-theme="light"] .country-dropdown {
  border-color: rgba(124,58,237,.18);
  box-shadow: 0 16px 40px rgba(0,0,0,.1);
}

[data-theme="light"] .divider::before,
[data-theme="light"] .divider::after { background: rgba(91,33,182,.15); }

[data-theme="light"] .divider span { color: rgba(91,33,182,.45); }

[data-theme="light"] .card-footer { color: rgba(91,33,182,.5); }

[data-theme="light"] .toggle-track { border-color: rgba(91,33,182,.2); }

[data-theme="light"] .toast { box-shadow: 0 8px 24px rgba(0,0,0,.1); }
[data-theme="light"] .toast.error { background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.25); }
[data-theme="light"] .toast.success { background: rgba(5,150,105,.08); border-color: rgba(5,150,105,.25); }
[data-theme="light"] .toast.info { background: rgba(109,40,217,.08); border-color: rgba(109,40,217,.2); }

[data-theme="light"] .otp-box { border-color: rgba(91,33,182,.2); }
[data-theme="light"] .otp-box:focus { background: #F5F3FF; }

[data-theme="light"] .country-select-btn { border-color: rgba(91,33,182,.2); }
[data-theme="light"] .country-search { border-bottom-color: rgba(91,33,182,.1); }

[data-theme="light"] .brand-icon { box-shadow: 0 8px 24px rgba(109,40,217,.3); }

[data-theme="light"] .resend-row { color: rgba(91,33,182,.45); }
[data-theme="light"] .field-msg { color: var(--light-purple); }
[data-theme="light"] .remember-label { color: var(--light-purple); }

/* ── Theme Toggle Button ──────────────────────────────────── */
.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(196,181,253,.2);
  background: var(--bg-card);
  color: var(--light-purple);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.theme-toggle:hover {
  background: var(--primary-purple);
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(124,58,237,.4);
}
.theme-toggle svg { width: 20px; height: 20px; transition: transform 0.3s ease; }
.theme-toggle:hover svg { transform: rotate(30deg); }

/* Hide the wrong icon */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

[data-theme="light"] .theme-toggle {
  border-color: rgba(109,40,217,.15);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

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

/* ── App shell: the document never scrolls, only panels do ── */
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { font-family: var(--font-app); background: var(--bg-black); color: var(--soft-light); -webkit-font-smoothing: antialiased; }
a { color: var(--light-purple); text-decoration: none; }
a:hover { text-decoration: underline; }

/* App chrome never selects text on tap targets */
button, a, input, textarea, select, label,
.nav-item, .icon-btn, .tab-btn, .m-tab, .s-tab, .conv-item,
.media-tile, .media-item, .action-btn, .picker-option, .gender-pill,
.avatar-preview, .theme-toggle, .brand-icon {
  -webkit-tap-highlight-color: transparent;
}
button, .nav-item, .icon-btn, .tab-btn, .m-tab, .s-tab, .conv-item,
.media-tile, .media-item, .action-btn, .picker-option, .gender-pill,
.toggle-track, .theme-toggle {
  -webkit-user-select: none;
  user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; }

/* App scrollbars: thin, unobtrusive */
* { scrollbar-width: thin; scrollbar-color: rgba(196,181,253,.2) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(196,181,237,.18); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(196,181,253,.32); }

/* iOS momentum scrolling on every scroll container */
.page-shell, .messages-area, .conv-list, .details-drawer,
.profile-info, .profile-media, .country-list {
  -webkit-overflow-scrolling: touch;
}

.page-shell {
  position: relative;
  display: flex;
  height: 100vh;
  height: 100dvh;
  padding: 24px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,.35) 0%, transparent 70%), radial-gradient(ellipse 50% 40% at 100% 100%, rgba(91,33,182,.25) 0%, transparent 60%), var(--bg-black);
}

/* Screen transition (app push feel) */
@keyframes screenIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.page-shell, .app-frame { animation: screenIn .26s cubic-bezier(.22,.61,.36,1) both; }

.page-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(124,58,237,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(124,58,237,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridDrift 30s linear infinite;
  pointer-events: none;
}

@keyframes gridDrift { 0% { background-position: 0 0; } 100% { background-position: 40px 40px; } }

.card {
  background: var(--bg-card);
  border: 1px solid rgba(196,181,253,.1);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: var(--card-width);
  margin: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  box-shadow: var(--neu-shadow);
  animation: cardIn 0.45s cubic-bezier(.22,.61,.36,1) both;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(28px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.brand { text-align: center; margin-bottom: 32px; }
.brand-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary-purple), var(--mid-purple));
  border-radius: 18px; margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(124,58,237,.45);
  animation: iconPulse 3s ease-in-out infinite;
}
@keyframes iconPulse { 0%,100% { box-shadow: 0 8px 24px rgba(124,58,237,.45); } 50% { box-shadow: 0 8px 36px rgba(124,58,237,.7); } }
.brand-icon svg { width: 32px; height: 32px; fill: #fff; }
.brand h1 { font-size: 1.6rem; font-weight: 800; color: var(--soft-light); letter-spacing: -0.5px; }
.brand p { font-size: 0.85rem; color: var(--light-purple); margin-top: 4px; }

.step-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 28px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--overlay); transition: all var(--transition-med); }
.step-dot.active { background: var(--primary-purple); width: 24px; border-radius: 4px; box-shadow: 0 0 8px rgba(124,58,237,.6); }
.step-dot.done { background: var(--mid-purple); }

.section-title { font-size: 1.15rem; font-weight: 700; color: var(--soft-light); margin-bottom: 6px; }
.section-sub { font-size: 0.82rem; color: var(--light-purple); margin-bottom: 24px; line-height: 1.5; }

.tab-switcher { display: grid; grid-template-columns: 1fr 1fr; background: var(--overlay); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; gap: 4px; }
.tab-btn { padding: 9px 12px; border: none; background: transparent; color: var(--light-purple); font-size: 0.83rem; font-weight: 600; border-radius: 6px; cursor: pointer; transition: all var(--transition-fast); font-family: inherit; }
.tab-btn.active { background: var(--primary-purple); color: #fff; box-shadow: 0 4px 12px rgba(124,58,237,.4); }
.tab-btn:hover:not(.active) { background: var(--overlay-hover); color: var(--soft-light); }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--light-purple); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.5px; }

.phone-row { display: flex; gap: 10px; }
.country-select-wrap { position: relative; flex: 0 0 110px; }
.country-select-btn {
  width: 100%; height: 48px;
  background: var(--overlay); border: 1px solid rgba(196,181,253,.18); border-radius: var(--radius-sm);
  color: var(--soft-light); font-size: 0.88rem; font-weight: 600; font-family: inherit;
  display: flex; align-items: center; justify-content: space-between; padding: 0 12px;
  cursor: pointer; transition: border-color var(--transition-fast), background var(--transition-fast);
}
.country-select-btn:hover, .country-select-btn.open { border-color: var(--primary-purple); background: var(--overlay-hover); }
.country-select-btn svg { width: 14px; height: 14px; fill: var(--light-purple); transition: transform var(--transition-fast); }
.country-select-btn.open svg { transform: rotate(180deg); }

.country-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 260px;
  background: var(--bg-card); border: 1px solid rgba(196,181,253,.2);
  border-radius: var(--radius-md); box-shadow: 0 16px 40px rgba(0,0,0,.6);
  z-index: 100; overflow: hidden; display: none; animation: dropIn 0.18s ease;
}
.country-dropdown.open { display: block; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.country-search { width: 100%; padding: 10px 14px; background: var(--overlay); border: none; border-bottom: 1px solid rgba(196,181,253,.1); color: var(--soft-light); font-size: 0.84rem; font-family: inherit; outline: none; }
.country-search::placeholder { color: rgba(196,181,253,.45); }
.country-list { max-height: 200px; overflow-y: auto; }
.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-thumb { background: var(--mid-purple); border-radius: 2px; }
.country-item { padding: 10px 14px; font-size: 0.84rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; color: var(--soft-light); transition: background var(--transition-fast); }
.country-item:hover { background: var(--overlay); }
.country-item span.dial { color: var(--light-purple); font-size: 0.8rem; }

.input-field {
  width: 100%; height: 48px;
  background: var(--overlay); border: 1px solid rgba(196,181,253,.18); border-radius: var(--radius-sm);
  color: var(--soft-light); font-size: 0.95rem; font-family: inherit; padding: 0 14px; outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.input-field::placeholder { color: rgba(196,181,253,.35); }
.input-field:focus { border-color: var(--primary-purple); background: var(--overlay-hover); box-shadow: 0 0 0 3px rgba(124,58,237,.2); }
.input-field.error { border-color: var(--error-red); box-shadow: 0 0 0 3px rgba(248,113,113,.15); }
.input-field:disabled { opacity: 0.5; cursor: not-allowed; }

.password-wrap { position: relative; }
.password-wrap .input-field { padding-right: 48px; }
.pwd-toggle { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--light-purple); display: flex; align-items: center; padding: 0; transition: color var(--transition-fast); }
.pwd-toggle:hover { color: var(--soft-light); }
.pwd-toggle svg { width: 18px; height: 18px; }

.field-msg { font-size: 0.76rem; margin-top: 5px; color: var(--light-purple); min-height: 18px; display: flex; align-items: center; gap: 4px; transition: opacity var(--transition-fast); }
.field-msg.error { color: var(--error-red); }
.field-msg.success { color: var(--success-green); }

.remember-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.toggle-switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: var(--overlay); border-radius: 11px; cursor: pointer; border: 1px solid rgba(196,181,253,.2); transition: background var(--transition-med); }
.toggle-track::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--light-purple); border-radius: 50%; transition: transform var(--transition-med); }
.toggle-switch input:checked + .toggle-track { background: var(--primary-purple); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(18px); background: #fff; }
.remember-label { font-size: 0.83rem; color: var(--light-purple); cursor: pointer; }

.btn-primary {
  width: 100%; height: 50px;
  background: linear-gradient(135deg, var(--primary-purple) 0%, var(--mid-purple) 100%);
  border: none; border-radius: var(--radius-sm); color: #fff; font-size: 0.95rem; font-weight: 700;
  font-family: inherit; cursor: pointer; position: relative; overflow: hidden;
  transition: opacity var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 6px 20px rgba(124,58,237,.4); letter-spacing: 0.3px;
}
.btn-primary::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,0); transition: background var(--transition-fast); }
.btn-primary:hover:not(:disabled)::before { background: rgba(255,255,255,.08); }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-primary .spinner { display: none; width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
.btn-primary.loading .spinner { display: block; }
.btn-primary.loading .btn-text { opacity: 0; }
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.btn-secondary { width: 100%; height: 46px; background: transparent; border: 1px solid rgba(196,181,253,.25); border-radius: var(--radius-sm); color: var(--light-purple); font-size: 0.88rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: all var(--transition-fast); display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-secondary:hover { background: var(--overlay); border-color: var(--primary-purple); color: var(--soft-light); }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(196,181,253,.12); }
.divider span { font-size: 0.75rem; color: rgba(196,181,253,.5); font-weight: 500; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.8px; }

.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }

.otp-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 4px; }
.otp-box {
  width: 52px; height: 60px;
  background: var(--overlay); border: 1.5px solid rgba(196,181,253,.2); border-radius: var(--radius-sm);
  color: var(--soft-light); font-size: 1.4rem; font-weight: 700; font-family: inherit;
  text-align: center; outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  caret-color: var(--primary-purple);
}
.otp-box:focus { border-color: var(--primary-purple); background: var(--overlay-hover); box-shadow: 0 0 0 3px rgba(124,58,237,.25); }
.otp-box.filled { border-color: var(--mid-purple); }
.otp-box.error { border-color: var(--error-red); animation: shake .35s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; width: calc(100% - 40px); max-width: 420px; }
.toast { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 10px; pointer-events: all; animation: toastIn .3s ease; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.error { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.35); color: var(--error-red); }
.toast.success { background: rgba(52,211,153,.12); border: 1px solid rgba(52,211,153,.35); color: var(--success-green); }
.toast.info { background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.35); color: var(--light-purple); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
.toast.removing { animation: toastOut .3s ease forwards; }
@keyframes toastOut { from { opacity: 1; max-height: 80px; } to { opacity: 0; transform: translateY(-10px) scale(.95); max-height: 0; } }

.card-footer { text-align: center; margin-top: 24px; font-size: 0.8rem; color: rgba(196,181,253,.55); }
.card-footer a { color: var(--light-purple); font-weight: 600; }

.back-btn { background: none; border: none; color: var(--light-purple); font-size: 0.82rem; font-weight: 600; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; padding: 0; margin-bottom: 24px; transition: color var(--transition-fast); }
.back-btn:hover { color: var(--soft-light); }
.back-btn svg { width: 16px; height: 16px; }

.resend-row { text-align: center; margin-top: 18px; font-size: 0.8rem; color: rgba(196,181,253,.55); }
.resend-btn { background: none; border: none; color: var(--primary-purple); font-size: 0.8rem; font-weight: 700; cursor: pointer; font-family: inherit; padding: 0; }
.resend-btn:disabled { color: rgba(196,181,253,.35); cursor: not-allowed; }

/* ============================================================
   RESPONSIVE — Fit all devices
   ============================================================ */

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Safe areas (notches, home bars) — height handled by .page-shell */
.page-shell {
  padding-top:    calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  padding-left:   calc(16px + env(safe-area-inset-left));
  padding-right:  calc(16px + env(safe-area-inset-right));
}

/* ============================================================
   SHARED MOBILE APP CHROME (top bar + bottom nav)
   Reused by chat.html and profile.html
   ============================================================ */

.app-frame {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

.app-topbar {
  display: none;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: rgba(18,8,38,.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(196,181,253,.1);
}
[data-theme="light"] .app-topbar {
  background: rgba(255,255,255,.92);
  border-color: rgba(91,33,182,.12);
}
.app-topbar-title {
  flex: 1;
  min-width: 0;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--soft-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-topbar-sub {
  display: block;
  font-size: .72rem;
  font-weight: 500;
  color: var(--light-purple);
  margin-top: 1px;
}
.app-topbar .icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  box-shadow: var(--neu-tile);
  color: var(--light-purple);
  flex-shrink: 0;
}
[data-theme="light"] .app-topbar .icon-btn {
  background: #FFFFFF;
  box-shadow: var(--neu-tile);
  color: var(--primary-purple);
}

/* Bottom tab bar (shown on mobile only) */
.bottom-nav {
  display: none;
  flex-shrink: 0;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  padding: 8px calc(6px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(196,181,253,.1);
  z-index: 60;
  box-shadow: 0 -6px 20px rgba(0,0,0,.28);
}
[data-theme="light"] .bottom-nav {
  background: rgba(255,255,255,.94);
  border-top-color: rgba(91,33,182,.12);
  box-shadow: 0 -6px 20px rgba(91,33,182,.08);
}
.nav-item {
  flex: 1 1 0;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 2px 7px;
  border: none;
  background: none;
  color: rgba(196,181,253,.5);
  font-family: inherit;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition-fast), transform var(--transition-fast);
}
.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 20px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--primary-purple), var(--mid-purple));
  transform: translateX(-50%) scaleX(0);
  transition: transform var(--transition-fast);
}
.nav-item svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:active { transform: scale(.9); }
.nav-item:hover { color: var(--soft-light); }
.nav-item.active { color: var(--light-purple); background: none; box-shadow: none; }
.nav-item.active::before { transform: translateX(-50%) scaleX(1); }
[data-theme="light"] .nav-item { color: rgba(91,33,182,.55); }
[data-theme="light"] .nav-item:hover { color: var(--primary-purple); }
[data-theme="light"] .nav-item.active { color: var(--primary-purple); }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Small laptops */
@media (max-width: 1100px) {
  .card { padding: 36px 30px; }
}

/* Tablets / large phones landscape */
@media (max-width: 820px) {
  .page-shell { padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }
}

/* Phones */
@media (max-width: 560px) {
  .card { padding: 30px 22px; border-radius: 16px; }
  .social-row { grid-template-columns: 1fr; }
  .brand { margin-bottom: 24px; }
  .brand h1 { font-size: 1.45rem; }
  .dob-row { gap: 8px; }
  .gender-row { flex-direction: column; }
}

/* Small phones */
@media (max-width: 480px) {
  .otp-box { width: 44px; height: 54px; font-size: 1.2rem; }
  .otp-row { gap: 8px; }
}

/* Extra small phones */
@media (max-width: 380px) {
  .page-shell { padding: calc(16px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)); }
  .card { padding: 26px 16px; }
  .brand h1 { font-size: 1.3rem; }
  .otp-row { gap: 6px; }
  .otp-box { width: 40px; height: 50px; font-size: 1.1rem; }
  .phone-row { flex-direction: column; }
  .country-select-wrap { flex: 1 1 auto; width: 100%; }
  .section-title { font-size: 1.05rem; }
}

/* Short viewports (landscape phones) */
@media (max-height: 700px) and (max-width: 820px) {
  .page-shell { align-items: flex-start; }
}

/* ── App behaviour on touch devices ─────────────────────── */
@media (max-width: 768px) {
  /* 16px+ inputs stop iOS Safari from zooming the viewport on focus */
  .input-field,
  .otp-box,
  .country-search,
  .sidebar-search input,
  .msg-input { font-size: 16px; }

  /* Native app: no 300ms tap delay, no long-press text selection */
  button, a, .conv-item, .media-tile, .media-item, .nav-item { touch-action: manipulation; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
