/* ==========================================
   RAPCHAT - Main Stylesheet
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-tertiary: #1a1a24;
  --bg-elevated: #20202c;
  --bg-input: #16161f;

  --accent: #00c6ff;
  --accent2: #0072ff;
  --accent-glow: rgba(0, 198, 255, 0.15);
  --accent-grad: linear-gradient(135deg, #00c6ff, #0072ff);

  --text-primary: #f0f0f5;
  --text-secondary: #8b8b9e;
  --text-muted: #555568;

  --border: rgba(255,255,255,0.07);
  --border-focus: rgba(0, 198, 255, 0.4);

  --bubble-out: linear-gradient(135deg, #0072ff, #00c6ff);
  --bubble-in: #1e1e2c;

  --online: #22c55e;
  --offline: #555;
  --danger: #ef4444;
  --warning: #f59e0b;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px rgba(0, 198, 255, 0.2);

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

  --sidebar-width: 380px;
  --topbar-height: 64px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f7f8fa;
  --bg-elevated: #ffffff;
  --bg-input: #f0f2f5;
  --text-primary: #111111;
  --text-secondary: #555577;
  --text-muted: #999aaa;
  --border: rgba(0,0,0,0.08);
  --bubble-in: #e8e8ef;
  --shadow-md: 0 8px 32px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; font-size: 16px; }

body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 2px; }

/* ---- AUTH PAGES ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
  overflow-y: auto;
  position: relative;
}

.auth-page::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(0,198,255,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(0,114,255,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  position: relative;
  animation: fadeUp 0.5s ease;
}

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

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-mark {
  width: 64px;
  height: 64px;
  background: var(--accent-grad);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow);
}

.auth-logo .logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 3px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo .logo-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ---- FORM ELEMENTS ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-muted); }

.input-wrap {
  position: relative;
}

.input-wrap .form-input {
  padding-right: 44px;
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  transition: color var(--transition);
}

.input-icon:hover { color: var(--accent); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  width: 100%;
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 114, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 114, 255, 0.4);
}

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

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-ghost {
  background: none;
  color: var(--accent);
  width: auto;
  padding: 6px 0;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---- FORM FOOTER ---- */
.form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.form-footer a:hover { text-decoration: underline; }

/* ---- OTP ---- */
.otp-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.otp-input {
  width: 52px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: monospace;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.otp-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ---- ALERT ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-error { background: rgba(239,68,68,0.1); color: #ff6b6b; border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.alert-info { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(0,198,255,0.2); }

/* ==========================================
   CHAT APP LAYOUT
   ========================================== */

.app-layout {
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.icon-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-bar {
  padding: 12px 20px;
  flex-shrink: 0;
}

.search-input-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 16px 10px 40px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--border-focus); }
.search-input::placeholder { color: var(--text-muted); }

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.chat-item:hover { background: var(--bg-elevated); }
.chat-item.active { background: var(--bg-tertiary); }
.chat-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent-grad);
  border-radius: 0 2px 2px 0;
}

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

.avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  border: 2px solid var(--border);
}

.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.avatar.xl { width: 80px; height: 80px; font-size: 30px; }

.online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--online);
  border: 2px solid var(--bg-secondary);
}

.online-dot.offline { background: var(--offline); }

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

.chat-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.chat-time {
  font-size: 11px;
  color: var(--text-muted);
}

.unread-badge {
  min-width: 20px;
  height: 20px;
  background: var(--accent-grad);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ---- MAIN CHAT AREA ---- */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
  position: relative;
}

.chat-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(0,198,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

/* Empty state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
}

.chat-empty svg { opacity: 0.3; }
.chat-empty h3 { font-size: 20px; font-weight: 600; color: var(--text-secondary); }
.chat-empty p { font-size: 14px; text-align: center; max-width: 300px; }

/* Chat Header */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 5;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-header-name {
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-status {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-header-status.online { color: var(--online); }

/* Messages */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-date-divider {
  text-align: center;
  margin: 12px 0;
  position: relative;
}

.msg-date-divider span {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 14px;
  border-radius: var(--radius-full);
}

.msg-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 68%;
}

.msg-group.sent { align-self: flex-end; align-items: flex-end; }
.msg-group.received { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  position: relative;
  word-break: break-word;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: scale(0.95) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.sent .msg-bubble {
  background: var(--bubble-out);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.received .msg-bubble {
  background: var(--bubble-in);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.msg-bubble.first { border-radius: 18px; }
.sent .msg-bubble.first { border-bottom-right-radius: 4px; }
.received .msg-bubble.first { border-bottom-left-radius: 4px; }

.msg-text { font-size: 15px; line-height: 1.5; }

.msg-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  justify-content: flex-end;
}

.msg-time {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
}

.received .msg-time { color: var(--text-muted); }

.msg-ticks { display: flex; align-items: center; }
.msg-ticks svg { width: 16px; height: 16px; }

/* Deleted message */
.msg-deleted {
  font-style: italic;
  opacity: 0.6;
  font-size: 14px;
}

/* Media messages */
.msg-image {
  max-width: 260px;
  max-height: 260px;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  width: 100%;
}

.msg-video {
  max-width: 260px;
  border-radius: 12px;
  width: 100%;
}

.msg-audio { width: 200px; }

.msg-audio audio {
  width: 100%;
  height: 36px;
  filter: invert(0);
}

.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.15);
  border-radius: 10px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
}

.msg-file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.msg-file-size { font-size: 11px; opacity: 0.7; }

/* Context menu */
.ctx-menu {
  position: fixed;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  min-width: 160px;
  animation: ctxIn 0.15s ease;
}

@keyframes ctxIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background var(--transition);
}

.ctx-item:hover { background: var(--bg-tertiary); }
.ctx-item.danger { color: var(--danger); }

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--bubble-in);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  width: fit-content;
  margin: 4px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Input Bar */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-bar-attach {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.attach-menu {
  position: absolute;
  bottom: 80px;
  left: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.2s ease;
}

.attach-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background var(--transition);
  white-space: nowrap;
}

.attach-item:hover { background: var(--bg-tertiary); }

.attach-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.message-input-wrap {
  flex: 1;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 10px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  transition: border-color var(--transition);
  max-height: 120px;
}

.message-input-wrap:focus-within { border-color: var(--border-focus); }

.message-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  resize: none;
  max-height: 96px;
  line-height: 1.5;
  min-height: 24px;
}

.message-input::placeholder { color: var(--text-muted); }

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent-grad);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0,114,255,0.3);
}

.send-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(0,114,255,0.4); }
.send-btn:active { transform: scale(0.96); }

/* Record button */
.record-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.record-btn.recording {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.4);
  color: var(--danger);
  animation: recordPulse 1s infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Upload preview */
.upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.upload-preview img { height: 48px; border-radius: 6px; object-fit: cover; }

/* ---- PROFILE PANEL ---- */
.profile-panel {
  width: 320px;
  min-width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.profile-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-panel-header h3 { font-size: 16px; font-weight: 600; }

.profile-panel-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  border-bottom: 1px solid var(--border);
}

.profile-panel-name {
  font-size: 20px;
  font-weight: 700;
  margin-top: 12px;
}

.profile-panel-username {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.profile-panel-bio {
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  margin-top: 8px;
  padding: 0 16px;
  line-height: 1.5;
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding: 0 20px;
  width: 100%;
}

.profile-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
}

.info-section {
  padding: 20px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-item:last-child { border-bottom: none; }
.info-item-icon { color: var(--text-muted); flex-shrink: 0; }
.info-item-content {}
.info-item-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.info-item-value { color: var(--text-primary); }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 420px;
  animation: modalIn 0.25s ease;
  overflow: hidden;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(16px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 { font-size: 17px; font-weight: 600; }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn { flex: 1; }

/* ---- SETTINGS PAGE ---- */
.settings-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-secondary);
  overflow-y: auto;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-section {
  padding: 20px;
}

.settings-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 4px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.settings-item:hover { background: var(--bg-elevated); }

.settings-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-item-info { flex: 1; }
.settings-item-label { font-size: 15px; font-weight: 500; }
.settings-item-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.settings-item-action { color: var(--text-muted); }

/* Toggle switch */
.toggle {
  width: 44px;
  height: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle.on { background: var(--accent); border-color: var(--accent); }

.toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle.on::after { transform: translateX(20px); }

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ---- LANDING PAGE ---- */
.landing-page {
  min-height: 100vh;
  overflow-y: auto;
  background: var(--bg-primary);
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.landing-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.landing-nav-links {
  display: flex;
  gap: 12px;
}

.landing-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 24px 60px;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(0,198,255,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content { max-width: 700px; position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-glow);
  border: 1px solid rgba(0,198,255,0.2);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 28px;
}

.hero-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(42px, 8vw, 80px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 20px;
}

.hero-title span {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-cta .btn { width: auto; }

/* Features section */
.features-section {
  padding: 80px 48px;
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
}

.section-sub {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 56px;
  font-size: 16px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: rgba(0,198,255,0.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--accent-glow);
  border: 1px solid rgba(0,198,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--accent);
  font-size: 24px;
}

.feature-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.feature-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.6; }

/* ---- IMAGE LIGHTBOX ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: pointer;
}

.lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: var(--radius-md);
  object-fit: contain;
}

/* ---- SEARCH RESULTS ---- */
.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  margin-top: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--bg-tertiary); }

/* ---- NOTIFICATIONS ---- */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-item:hover { background: var(--bg-elevated); }
.notif-item.unread { background: var(--accent-glow); }

.notif-content { flex: 1; min-width: 0; }
.notif-text { font-size: 14px; line-height: 1.5; }
.notif-time { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- TOAST ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 360px;
  text-align: center;
}

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

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
  :root { --sidebar-width: 100vw; }

  .app-layout {
    position: relative;
  }

  /* Mobile: sidebar fills screen, chat hidden behind */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 20;
    transform: translateX(0);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }

  .sidebar.hidden {
    transform: translateX(-100%);
  }

  .chat-main {
    position: fixed;
    inset: 0;
    width: 100%;
    z-index: 10;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }

  .chat-main.active {
    transform: translateX(0);
  }

  .profile-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    z-index: 30;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .profile-panel.active {
    transform: translateX(0);
  }

  /* Show back button in chat header on mobile */
  .back-btn { display: flex !important; }

  /* Auth pages */
  .auth-card { padding: 28px 20px; }

  /* Landing */
  .landing-nav { padding: 16px 20px; }
  .landing-nav-links .btn-secondary { display: none; }
  .features-section { padding: 60px 20px; }

  .chat-header { padding: 10px 12px; }
  .messages-area { padding: 12px; }
  .chat-input-bar { padding: 10px; }

  .profile-panel { min-width: unset; }

  .otp-input { width: 44px; height: 50px; font-size: 20px; }
}

@media (min-width: 769px) {
  .back-btn { display: none !important; }

  .chat-main {
    transform: none !important;
  }

  .sidebar {
    transform: none !important;
  }
}

/* PWA install banner */
.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 500;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.install-banner-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-banner-info { flex: 1; }
.install-banner-title { font-weight: 600; font-size: 15px; }
.install-banner-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.install-banner-btns { display: flex; gap: 8px; flex-shrink: 0; }
.install-banner-btns .btn { width: auto; padding: 8px 16px; font-size: 13px; }

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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