/* =========================================================
   LIGHTER & GHAZAL PRIVATE CHAT - SNAPCHAT STYLE CSS
   ========================================================= */

:root {
  --bg-main: #0b0e14;
  --bg-card: #151a23;
  --bg-surface: #1e2430;
  --bg-input: #12161f;
  
  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --lighter-primary: #ff5e36;
  --lighter-gradient: linear-gradient(135deg, #ff7a18 0%, #ff3b30 100%);
  --lighter-glow: rgba(255, 94, 54, 0.35);

  --ghazal-primary: #ff4d8d;
  --ghazal-gradient: linear-gradient(135deg, #ff758c 0%, #ff4b8b 100%);
  --ghazal-glow: rgba(255, 77, 141, 0.35);

  --accent-online: #10b981;
  --accent-seen: #00b4d8;
  --accent-viewonce: #f59e0b;
  --danger: #ef4444;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

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

input, textarea {
  user-select: text;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* =========================================================
   AUTH MODAL (Zero Trace, Always shows on entry)
   ========================================================= */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: radial-gradient(circle at 50% 20%, #1c2230 0%, #080a0f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: rgba(21, 26, 35, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  text-align: center;
  overflow: hidden;
  animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-glow {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 100px;
  background: radial-gradient(circle, rgba(255, 117, 140, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.auth-icon-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  margin-bottom: 14px;
}

.auth-card h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #ffffff 40%, #d1d5db 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.profile-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.profile-btn {
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  color: var(--text-secondary);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.05);
  transition: transform 0.2s ease;
}

.profile-name {
  font-size: 14px;
  font-weight: 700;
}

.profile-btn.active[data-user="lighter"] {
  border-color: var(--lighter-primary);
  background: rgba(255, 94, 54, 0.12);
  color: #fff;
  box-shadow: 0 0 20px var(--lighter-glow);
}

.profile-btn.active[data-user="lighter"] .profile-avatar {
  background: var(--lighter-gradient);
  transform: scale(1.08);
}

.profile-btn.active[data-user="ghazal"] {
  border-color: var(--ghazal-primary);
  background: rgba(255, 77, 141, 0.12);
  color: #fff;
  box-shadow: 0 0 20px var(--ghazal-glow);
}

.profile-btn.active[data-user="ghazal"] .profile-avatar {
  background: var(--ghazal-gradient);
  transform: scale(1.08);
}

.input-group {
  text-align: left;
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.pass-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.pass-wrapper input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 44px 14px 16px;
  color: #fff;
  font-size: 18px;
  letter-spacing: 3px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pass-wrapper input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.pass-wrapper .lock-icon {
  position: absolute;
  right: 14px;
  font-size: 16px;
  pointer-events: none;
}

.auth-error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
  font-weight: 600;
  text-align: center;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #ff7a18 0%, #ff4b8b 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 24px rgba(255, 75, 139, 0.35);
}

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

.auth-footer-tag {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* =========================================================
   MAIN CHAT LAYOUT
   ========================================================= */
.app-layout {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 768px; /* Responsive tablet/phone/PC centered */
  height: 100%;
  margin: 0 auto;
  position: relative;
  background: var(--bg-main);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

/* Header */
.chat-header {
  height: 64px;
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(17, 22, 31, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
  flex-shrink: 0;
}

.header-partner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.partner-avatar-wrap {
  position: relative;
}

.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border: 2px solid var(--border-active);
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  transition: background-color 0.3s;
}

.status-dot.online {
  background-color: var(--accent-online);
  box-shadow: 0 0 10px var(--accent-online);
}

.status-dot.offline {
  background-color: var(--text-muted);
}

.partner-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.partner-name-row h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
}

.verified-sparkle {
  font-size: 13px;
}

.status-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.status-label.online-text {
  color: var(--accent-online);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.my-badge-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:active {
  transform: scale(0.92);
  color: #fff;
}

/* =========================================================
   MESSAGES CONTAINER
   ========================================================= */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 24px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-watermark {
  text-align: center;
  margin: 30px auto 20px auto;
  opacity: 0.6;
}

.watermark-emojis {
  font-size: 26px;
  margin-bottom: 6px;
  letter-spacing: 6px;
}

.chat-watermark p {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

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

/* Message Rows & Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: popInMsg 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Consecutive Message Clustering & Spacing */
.msg-row.group-first,
.msg-row.group-single {
  margin-top: 10px;
}

.msg-row.group-last,
.msg-row.group-single {
  margin-bottom: 6px;
}

.msg-row.group-middle {
  margin-top: 1px;
}

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

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

.msg-sender-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
  padding: 0 4px;
}

.msg-bubble {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 11px 15px;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
}

/* Consecutive bubble rounding for modern clean messenger look */
.msg-row.outgoing.group-first .msg-bubble {
  border-bottom-right-radius: 6px;
}
.msg-row.outgoing.group-middle .msg-bubble {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}
.msg-row.outgoing.group-last .msg-bubble {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 4px;
}

.msg-row.incoming.group-first .msg-bubble {
  border-bottom-left-radius: 6px;
}
.msg-row.incoming.group-middle .msg-bubble {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}
.msg-row.incoming.group-last .msg-bubble {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 4px;
}

/* Outgoing Styling */
.msg-row.outgoing .msg-bubble {
  background: var(--lighter-gradient);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px var(--lighter-glow);
}

/* Custom override for Ghazal as outgoing */
body.user-ghazal .msg-row.outgoing .msg-bubble {
  background: var(--ghazal-gradient);
  box-shadow: 0 4px 15px var(--ghazal-glow);
}

/* Incoming Styling */
.msg-row.incoming .msg-bubble {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

/* Message Status Line (Delivered, Seen, Timestamp) */
.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.msg-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}

.msg-status-pill.status-delivered {
  color: var(--text-secondary);
}

.msg-status-pill.status-seen {
  color: var(--accent-seen);
}

/* Media in Chat */
.msg-image-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 4px;
  cursor: pointer;
  background: #000;
  max-width: 280px;
}

.msg-image-card img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.msg-image-card img:hover {
  transform: scale(1.02);
}

/* View Once Message Bubble */
.viewonce-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: rgba(245, 158, 11, 0.15) !important;
  border: 1px dashed rgba(245, 158, 11, 0.4) !important;
  color: #fbbf24 !important;
  transition: all 0.2s;
}

.viewonce-bubble:hover {
  background: rgba(245, 158, 11, 0.25) !important;
}

.viewonce-bubble.burned {
  cursor: not-allowed;
  opacity: 0.55;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-muted) !important;
}

.viewonce-icon-flame {
  font-size: 20px;
  animation: flicker 1.5s infinite;
}

.viewonce-info {
  display: flex;
  flex-direction: column;
}

.viewonce-title {
  font-weight: 700;
  font-size: 14px;
}

.viewonce-sub {
  font-size: 11px;
  opacity: 0.85;
}

/* =========================================================
   BOTTOM STATUS DOCK (Typing Indicator)
   ========================================================= */
.bottom-status-dock {
  display: flex;
  align-items: center;
  padding: 0 16px 8px 16px;
  min-height: 0;
  pointer-events: none;
}

/* Typing Bubble */
.typing-bubble-container {
  display: inline-flex;
  animation: popInMsg 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: auto;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.typing-user-icon {
  font-size: 14px;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: bounceDot 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

.typing-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* =========================================================
   FOOTER & INPUT BAR
   ========================================================= */
.chat-footer {
  background: rgba(17, 22, 31, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 10px 14px;
  padding-bottom: calc(10px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  z-index: 50;
}

.footer-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tool-btn:active {
  transform: scale(0.92);
  color: #fff;
}

.tool-btn.camera-btn:hover {
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.4);
}

.tool-btn.gallery-btn:hover {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.4);
}

.tool-btn.mic-btn:hover {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.4);
}

.tool-btn.mic-btn.recording {
  background: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  border-color: #ef4444;
  animation: pulseRed 1.2s infinite;
}

.tool-btn.viewonce-btn {
  font-weight: 800;
  font-size: 12px;
  gap: 2px;
}

.tool-btn.viewonce-btn.active {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.viewonce-tag {
  font-size: 11px;
}

.viewonce-flame {
  font-size: 12px;
}

.chat-input-wrapper {
  flex: 1;
}

.chat-input-wrapper input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 10px 18px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-wrapper input:focus {
  border-color: rgba(255, 255, 255, 0.25);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--lighter-gradient);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s;
  box-shadow: 0 4px 14px var(--lighter-glow);
}

body.user-ghazal .send-btn {
  background: var(--ghazal-gradient);
  box-shadow: 0 4px 14px var(--ghazal-glow);
}

.send-btn:active {
  transform: scale(0.92);
}

.viewonce-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #fcd34d;
  animation: slideDown 0.2s ease;
}

.btn-banner-close {
  background: none;
  border: none;
  color: #fcd34d;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 6px;
}

/* =========================================================
   FAST IN-APP CAMERA MODAL
   ========================================================= */
.camera-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  display: flex;
  flex-direction: column;
}

.camera-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.camera-top-bar {
  height: 60px;
  padding: 0 16px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.cam-title {
  font-weight: 700;
  font-size: 16px;
}

.cam-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.video-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-bottom-bar {
  padding: 20px 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.shutter-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
}

.shutter-btn:active {
  transform: scale(0.92);
}

.shutter-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #fbbf24;
  font-weight: 700;
}

.cam-sub-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* =========================================================
   PREVIEW MODAL
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.preview-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-active);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.preview-img-box {
  width: 100%;
  max-height: 55vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-img-box img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}

.preview-controls {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.viewonce-pill-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

.preview-action-row {
  display: flex;
  gap: 10px;
}

.btn-secondary {
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

/* =========================================================
   SNAPCHAT-STYLE VIEW ONCE SELF-DESTRUCT VIEWER
   ========================================================= */
.snap-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
}

.snap-timer-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  top: 0;
}

.snap-timer-bar {
  width: 100%;
  height: 100%;
  background: #f59e0b;
  transform-origin: left;
  transition: transform linear;
}

.snap-viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  padding-top: calc(14px + var(--safe-top));
  background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
  z-index: 10;
}

.snap-viewer-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
}

.snap-badge-1x {
  background: rgba(245, 158, 11, 0.3);
  border: 1px solid #f59e0b;
  color: #fbbf24;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 800;
}

.snap-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.snap-viewer-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.snap-viewer-footer {
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
}

/* =========================================================
   LIGHTBOX FOR NORMAL PHOTOS
   ========================================================= */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox-close {
  position: absolute;
  top: calc(16px + var(--safe-top));
  right: 16px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 10;
}

.lightbox-overlay img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* =========================================================
   VOICE MESSAGE UI & RECORDING BAR
   ========================================================= */
.voice-recording-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  animation: slideDown 0.2s ease;
}

.record-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
}

.record-action-btn:active {
  transform: scale(0.92);
}

.cancel-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--danger);
}

.send-record-btn {
  background: var(--lighter-gradient);
  color: #fff;
  box-shadow: 0 4px 14px var(--lighter-glow);
}

body.user-ghazal .send-record-btn {
  background: var(--ghazal-gradient);
  box-shadow: 0 4px 14px var(--ghazal-glow);
}

.recording-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-full);
  padding: 8px 16px;
}

.recording-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: pulseRed 1s infinite;
}

.recording-timer {
  font-weight: 700;
  font-size: 14px;
  color: #fca5a5;
  min-width: 40px;
}

.recording-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.recording-wave span {
  width: 3px;
  height: 12px;
  background: #f87171;
  border-radius: 2px;
  animation: soundWave 0.8s infinite ease-in-out alternate;
}

.recording-wave span:nth-child(2) { animation-delay: 0.15s; height: 18px; }
.recording-wave span:nth-child(3) { animation-delay: 0.3s; height: 8px; }
.recording-wave span:nth-child(4) { animation-delay: 0.45s; height: 20px; }
.recording-wave span:nth-child(5) { animation-delay: 0.6s; height: 14px; }

/* In-Chat Voice Message Player Card */
.msg-voice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  min-width: 210px;
  max-width: 280px;
}

.msg-row.outgoing .msg-voice-card {
  background: rgba(255, 255, 255, 0.14);
}

.msg-row.incoming .msg-voice-card {
  background: rgba(255, 255, 255, 0.06);
}

.voice-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  color: #0b0e14;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.voice-play-btn:active {
  transform: scale(0.9);
}

.voice-track-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.voice-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.voice-progress-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.voice-time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

/* =========================================================
   ANIMATIONS & KEYFRAMES
   ========================================================= */
@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes popInMsg {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bounceDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@keyframes pulseAvatar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseRed {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.6; }
}

@keyframes soundWave {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* Media Queries for Mobile/iPad */
@media (max-width: 480px) {
  .app-layout {
    border-left: none;
    border-right: none;
  }
  .msg-row {
    max-width: 88%;
  }
}
