/* ===== GLOBAL THEME ===== */
:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --bg4: #22222f;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #c084fc;
  --accent2: #a855f7;
  --accent-glow: rgba(192,132,252,0.15);
  --accent-dim: rgba(192,132,252,0.08);
  --text: #f0eeff;
  --text2: #a09abb;
  --text3: #6b6880;
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.1);
  --red: #f87171;
  --red-dim: rgba(248,113,113,0.1);
  --amber: #fbbf24;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --font-display: 'DM Serif Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --transition: 0.2s ease;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== NOISE TEXTURE ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ===== LAYOUT ===== */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.logo span { color: var(--text); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== BOTTOM NAV ===== */
nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text3);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.3px;
  transition: color var(--transition);
}

.nav-tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.nav-tab:hover { color: var(--text2); }

.nav-tab.active {
  color: var(--accent);
}

/* ===== MAIN CONTENT ===== */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 90px;
}

/* ===== PAGES ===== */
.page { width: 100%; max-width: 520px; }

/* ===== HOME PAGE ===== */
.home-hero {
  text-align: center;
  margin-bottom: 48px;
}

.home-hero h1 {
  font-family: var(--font-display);
  font-size: 52px;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--text);
}

.home-hero h1 em {
  font-style: italic;
  color: var(--accent);
}

.home-hero p {
  font-size: 16px;
  color: var(--text2);
  line-height: 1.6;
  max-width: 360px;
  margin: 0 auto;
}

.home-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dim), var(--bg4));
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  position: relative;
}

.avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.3;
}

.username-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-body);
  outline: none;
  transition: var(--transition);
  text-align: center;
  margin-bottom: 24px;
}

.username-input:focus {
  border-color: var(--accent);
  background: var(--bg3);
}

.username-input::placeholder { color: var(--text3); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: var(--font-body);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
  width: 100%;
}

.btn-primary:hover {
  background: #d8a4fe;
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
}

.btn-secondary:hover { background: var(--bg4); }

.btn-green {
  background: var(--green);
  color: #0a0a0f;
}

.btn-green:hover { background: #6ee79b; transform: translateY(-1px); }

.btn-red {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}

.btn-red:hover { background: var(--red-dim); }

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
}

/* ===== SEARCHING PAGE ===== */
.searching-center {
  text-align: center;
}

.wave-animation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 80px;
  margin: 32px auto;
}

.wave-bar {
  width: 4px;
  border-radius: 4px;
  background: var(--accent);
  animation: wave 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 24px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 40px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 56px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 64px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 56px; animation-delay: 0.4s; }
.wave-bar:nth-child(6) { height: 40px; animation-delay: 0.5s; }
.wave-bar:nth-child(7) { height: 24px; animation-delay: 0.6s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 1; }
}

.searching-label {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 8px;
}

.searching-sub {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 32px;
}

.online-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--green-dim);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 100px;
  font-size: 13px;
  color: var(--green);
  margin-bottom: 32px;
}

/* ===== IN-CALL PAGE ===== */
.call-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.call-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.caller-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg4);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
  flex-shrink: 0;
}

.caller-avatar.speaking::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: speaking-ring 1s ease-in-out infinite;
}

@keyframes speaking-ring {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3); }
}

.caller-info { flex: 1; }
.caller-name { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.caller-status { font-size: 13px; color: var(--green); display: flex; align-items: center; gap: 6px; }

.timer-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
}

.timer-value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color var(--transition);
}

.timer-value.warning { color: var(--amber); }
.timer-value.danger { color: var(--red); }
.timer-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }

.timer-bar-wrap {
  padding: 0 24px;
  margin: 16px 0 0;
}

.timer-bar-bg {
  height: 3px;
  background: var(--bg4);
  border-radius: 3px;
  overflow: hidden;
}

.timer-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 1s linear, background 1s;
}

.timer-bar-fill.warning { background: var(--amber); }
.timer-bar-fill.danger { background: var(--red); }

/* Visualizer */
.audio-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 60px;
  padding: 0 24px;
  margin: 16px 0;
}

.viz-bar {
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.6;
  transition: height 0.1s ease;
}

/* Call actions */
.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 24px;
  border-top: 1px solid var(--border);
}

.call-actions .btn { font-size: 14px; padding: 13px 20px; }

.mute-btn {
  position: absolute;
  bottom: 20px;
  right: 20px;
}

.call-footer {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mute-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  color: var(--text2);
}

.mute-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.end-call {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--red);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
}

/* ===== MATCHED PAGE ===== */
.matched-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
}

.matched-header {
  padding: 32px 24px 24px;
  background: linear-gradient(180deg, rgba(192,132,252,0.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}

.match-emoji { font-size: 48px; margin-bottom: 16px; }

.match-title {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 8px;
}

.match-sub { color: var(--text2); font-size: 14px; }

.match-avatars {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 24px 0 16px;
}

.match-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.match-connector {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent));
  align-self: center;
  position: relative;
}

.match-connector::before {
  content: '♥';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--accent);
}

.match-actions {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== MESSAGES PAGE ===== */
main.messages-main {
  padding: 0;
  align-items: stretch;
  /*justify-content: flex-start;*/
}

.messages-full {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.msg-page-header {
  padding: 20px 20px 12px;
}

.msg-page-header h2 {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 20px 10px;
}

/* Stories */
.stories-section { padding-bottom: 4px; }

.stories-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 20px 12px;
  scrollbar-width: none;
}
.stories-row::-webkit-scrollbar { display: none; }

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.story-ring {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c084fc, #7c3aed, #4f46e5);
  padding: 2.5px;
  transition: transform var(--transition);
}

.story-item:active .story-ring { transform: scale(0.93); }

.story-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg3);
  border: 2.5px solid var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.story-name {
  font-size: 11px;
  color: var(--text2);
  max-width: 66px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Conversation list */
.conv-list-mobile { display: flex; flex-direction: column; }

.conv-item-mobile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.conv-item-mobile:active { background: var(--bg3); }

.conv-avatar-mobile {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.conv-body-mobile { flex: 1; min-width: 0; }

.conv-row-mobile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.conv-name-mobile { font-size: 15px; font-weight: 600; color: var(--text); }
.conv-time-mobile { font-size: 12px; color: var(--text3); flex-shrink: 0; margin-left: 8px; }
.conv-preview-mobile {
  font-size: 13px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty state */
.msg-empty-state {
  text-align: center;
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 520px;
}

/* ── Mobile chat (full-screen overlay) ── */
.chat-mobile {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.chat-mobile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.chat-back {
  width: 38px;
  height: 38px;
  border: none;
  background: none;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--transition);
}
.chat-back:active { background: var(--bg3); }

.chat-mobile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-mobile-info { flex: 1; min-width: 0; }
.chat-username { font-weight: 600; font-size: 15px; }
.chat-online { font-size: 12px; color: var(--green); }

.chat-mobile-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: none;
}
.chat-mobile-messages::-webkit-scrollbar { display: none; }

.chat-empty {
  text-align: center;
  color: var(--text3);
  font-size: 14px;
  margin: auto;
  padding: 40px 20px;
}
.chat-empty-icon { font-size: 40px; margin-bottom: 12px; }

.msg { display: flex; flex-direction: column; }
.msg.mine { align-items: flex-end; }
.msg.theirs { align-items: flex-start; }

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.msg.mine .msg-bubble {
  background: var(--accent);
  color: #0a0a0f;
  border-bottom-right-radius: 4px;
}

.msg.theirs .msg-bubble {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-time {
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
  padding: 0 4px;
}

.chat-mobile-input {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 11px 18px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--border2); }
.chat-input::placeholder { color: var(--text3); }

.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  color: #0a0a0f;
}
.chat-send:active { transform: scale(0.92); }

/* ===== NOTIFICATION ===== */
.notif {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 14px;
  color: var(--text);
  z-index: 999;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 300px;
}

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

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-col { flex-direction: column; }
.w-full { width: 100%; }

.demo-banner {
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--amber);
  text-align: center;
  margin-bottom: 20px;
}
/* ===== LOGIN / AUTH PAGE ===== */
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.auth-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--text);
}

.auth-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.auth-email {
  font-size: 13px;
  color: var(--text3);
  margin-top: -8px;
}

.auth-sub {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.5;
}

.auth-stats {
  display: flex;
  gap: 32px;
  padding: 16px 24px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  width: 100%;
  justify-content: center;
}

.auth-stat { text-align: center; }

.auth-stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  color: var(--accent);
}

.auth-stat-label {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.username-section { width: 100%; text-align: left; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 13px 20px;
  background: #fff;
  color: #3c4043;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow var(--transition);
}

.btn-google:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.3); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: var(--text3);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== CHAT ACTIONS ===== */
.chat-action-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--bg3);
  color: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
  margin-left: auto;
}
.chat-action-btn:active { background: var(--bg4); }

/* Input with icon inside */
.chat-input-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chat-input-container .chat-input {
  padding-right: 44px;
}

.img-picker-wrap {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.chat-img-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color var(--transition);
  padding: 0;
}
.chat-img-btn:active { color: var(--accent); }

/* Image picker menu */
.img-picker-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 160px;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  z-index: 50;
}
.img-picker-menu.open { display: flex; }

.img-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  font-family: var(--font-body);
}
.img-picker-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.img-picker-item:active { background: var(--bg4); }

/* Image messages */
.msg-image-bubble { background: none !important; border: none !important; padding: 0 !important; }

.msg-img {
  max-width: 220px;
  max-height: 280px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  cursor: pointer;
}

/* Image modal / lightbox */
.img-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.img-modal.visible { opacity: 1; }

.img-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.93);
}

.img-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.15s;
}
.img-modal-close:active { background: rgba(255,255,255,0.22); }

.img-modal-img {
  position: relative;
  z-index: 1001;
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 10px;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-drag: none;
}

/* ===== ONLINE BADGES ===== */
.story-avatar-wrap {
  position: relative;
}

.online-badge-story {
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 6px rgba(74,222,128,0.6);
}

.conv-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.online-badge-conv {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
  border: 2.5px solid var(--bg);
  box-shadow: 0 0 6px rgba(74,222,128,0.5);
}

/* ===== PROFILE PAGE ===== */
.profile-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 24px;
}

/* Photo section */
.profile-photo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 20px;
  gap: 20px;
}

.profile-photo-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}

.profile-photo-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

.profile-photo-initials {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 600;
  color: #fff;
  border: 3px solid var(--accent);
}

.profile-photo-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.profile-photo-wrap:hover .profile-photo-overlay,
.profile-photo-wrap:active .profile-photo-overlay { opacity: 1; }

/* Stats row */
.profile-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 28px;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.profile-stat-val {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}

.profile-stat-lbl {
  font-size: 12px;
  color: var(--text3);
}

.profile-stat-sep {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* Fields */
.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border);
}

.profile-field {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.field-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-body);
  padding: 0;
}
.field-input::placeholder { color: var(--text3); }

.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-row .field-input { flex: 1; }

.btn-locate {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.btn-locate:active { background: var(--bg4); }

/* Chips */
.chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}
.chip.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Actions */
.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 20px 0;
}
