/* ══════════════════════════════════════════════════════
   CHATZY — WHATSAPP-STYLE CSS
   Author: Chatzy Team
   Theme: WhatsApp Green + Modern Polish
══════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg-primary: #111b21;
  --bg-secondary: #202c33;
  --bg-tertiary: #2a3942;
  --bg-chat: #0b141a;
  --bg-input: #2a3942;
  --bg-bubble-out: #005c4b;
  --bg-bubble-in: #202c33;
  --bg-modal: #233138;

  --green-primary: #00a884;
  --green-light: #00cf9d;
  --green-dark: #008f72;

  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #54656f;
  --text-bubble-out: #e9edef;
  --text-bubble-in: #e9edef;
  --text-timestamp: #8696a0;

  --border-color: #2a3942;
  --divider-color: #2a3942;
  --hover-bg: #202c33;
  --active-bg: #2a3942;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --sidebar-width: 380px;
  --header-height: 60px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

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

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

input, textarea {
  font-family: var(--font);
  outline: none;
  border: none;
  background: none;
  color: var(--text-primary);
}

img {
  object-fit: cover;
  display: block;
}

.hidden {
  display: none !important;
}

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

/* ══════════════════════════════════════════════════════
   LOADING SCREEN
══════════════════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  z-index: 9999;
}

.loading-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-icon {
  width: 80px;
  height: 80px;
  background: var(--green-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(0,168,132,0.4);
  animation: pulse 2s ease-in-out infinite;
}

.loading-icon .material-icons-round {
  font-size: 40px;
  color: #fff;
}

.loading-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.loading-logo p {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--green-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 40px rgba(0,168,132,0.4); transform: scale(1); }
  50% { box-shadow: 0 0 60px rgba(0,168,132,0.6); transform: scale(1.05); }
}

/* ══════════════════════════════════════════════════════
   AUTH SCREEN
══════════════════════════════════════════════════════ */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 100;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: var(--green-primary);
  top: -100px;
  right: -100px;
  animation: blobFloat 8s ease-in-out infinite;
}

.blob-2 {
  width: 300px;
  height: 300px;
  background: #0056b3;
  bottom: -80px;
  left: -80px;
  animation: blobFloat 10s ease-in-out infinite reverse;
}

.blob-3 {
  width: 200px;
  height: 200px;
  background: var(--green-primary);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: blobFloat 6s ease-in-out infinite;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 15px) scale(0.95); }
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.05);
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.auth-logo-icon {
  width: 72px;
  height: 72px;
  background: var(--green-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 32px rgba(0,168,132,0.4);
}

.auth-logo-icon .material-icons-round {
  font-size: 36px;
  color: #fff;
}

.auth-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.auth-logo p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 28px 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--divider-color);
}

.auth-divider span {
  position: relative;
  background: var(--bg-secondary);
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: #fff;
  color: #3c4043;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.google-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

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

.google-icon {
  width: 20px;
  height: 20px;
}

.auth-terms {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════
   MAIN APP LAYOUT
══════════════════════════════════════════════════════ */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--bg-chat);
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  transition: transform var(--transition-slow);
}

/* Sidebar Header */
.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.current-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  cursor: pointer;
}

.current-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.current-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

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

.current-user-uid {
  font-size: 11px;
  color: var(--green-primary);
  font-weight: 500;
  font-family: 'Courier New', monospace;
}

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

/* Icon Buttons */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  flex-shrink: 0;
}

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

.icon-btn .material-icons-round {
  font-size: 20px;
}

/* Search Bar */
.search-bar {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  margin: 8px 12px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.search-icon {
  font-size: 18px !important;
  color: var(--text-muted);
}

.search-bar input {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
}

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

/* Chat List */
.chat-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.empty-chats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-chats .material-icons-round {
  font-size: 48px;
  opacity: 0.4;
}

.empty-chats p {
  font-size: 15px;
  font-weight: 500;
}

.empty-chats small {
  font-size: 13px;
  opacity: 0.7;
}

/* Chat List Item */
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  animation: fadeInItem 0.2s ease;
}

@keyframes fadeInItem {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.chat-item.active {
  background: var(--active-bg);
}

.chat-item-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  position: relative;
}

.chat-item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-item-avatar .avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--green-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

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

.chat-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chat-item-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  margin-right: 8px;
}

.chat-item-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-item-time.unread {
  color: var(--green-primary);
}

.chat-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-item-preview {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  margin-right: 8px;
}

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

/* ══════════════════════════════════════════════════════
   CHAT AREA
══════════════════════════════════════════════════════ */
.chat-area {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
  overflow: hidden;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-chat);
  border-bottom: 4px solid var(--green-primary);
}

.welcome-content {
  text-align: center;
  padding: 40px;
  max-width: 400px;
}

.welcome-icon {
  width: 100px;
  height: 100px;
  background: var(--bg-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.welcome-icon .material-icons-round {
  font-size: 48px;
  color: var(--text-muted);
}

.welcome-content h2 {
  font-size: 24px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.welcome-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}

.welcome-uid-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.welcome-uid-card .material-icons-round {
  color: var(--green-primary);
  font-size: 22px;
}

.welcome-uid-card div {
  flex: 1;
}

.welcome-uid-card small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.welcome-uid-card strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--green-primary);
  letter-spacing: 1px;
}

.copy-uid-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
  flex-shrink: 0;
}

.copy-uid-btn:hover {
  background: var(--hover-bg);
  color: var(--green-primary);
}

.copy-uid-btn .material-icons-round {
  font-size: 18px;
}

/* Chat View */
.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--transition);
}

.chat-header:hover {
  background: var(--active-bg);
}

.back-btn {
  display: none;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  position: relative;
}

.chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.online-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: var(--green-primary);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

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

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

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

.partner-status.online {
  color: var(--green-primary);
}

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

/* Messages Container */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-anchor: none;
  background-color: var(--bg-chat);
  background-image:
    radial-gradient(circle at 25% 25%, rgba(0,168,132,0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(0,86,179,0.03) 0%, transparent 50%);
  padding: 8px 16px 12px;
  /* No display:flex here — let messages-list handle layout */
}

/* Date Separator */
.date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0 8px;
}

.date-separator span {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Messages */
.message {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  animation: msgIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.message.sent {
  align-self: flex-end;
  align-items: flex-end;
}

.message.received {
  align-self: flex-start;
  align-items: flex-start;
}

.message-bubble {
  padding: 8px 12px 6px;
  border-radius: var(--radius-md);
  position: relative;
  word-break: break-word;
  line-height: 1.45;
  min-width: 80px;
}

.message.sent .message-bubble {
  background: var(--bg-bubble-out);
  border-bottom-right-radius: 4px;
  color: var(--text-bubble-out);
}

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

/* First/middle/last in a group */
.message.sent + .message.sent .message-bubble {
  border-top-right-radius: 4px;
}
.message.received + .message.received .message-bubble {
  border-top-left-radius: 4px;
}

.message-text {
  font-size: 14.5px;
  display: block;
  white-space: pre-wrap;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  margin-top: 3px;
}

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

.message-status {
  font-size: 14px !important;
  color: rgba(255,255,255,0.55);
}

.message-status.read {
  color: #53bdeb;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-bubble-in);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  margin: 4px 0;
  animation: msgIn 0.2s ease;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Message Input Area */
.message-input-area {
  padding: 8px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.message-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-xl);
  padding: 6px 8px;
  min-height: 46px;
}

.message-input-box {
  flex: 1;
  min-width: 0;
}

.message-input-box textarea {
  display: block;
  width: 100%;
  resize: none;
  font-size: 14.5px;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  padding: 3px 0;
  color: var(--text-primary);
}

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

.send-btn {
  width: 46px;
  height: 46px;
  background: var(--green-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0,168,132,0.4);
}

.send-btn:hover {
  background: var(--green-light);
  transform: scale(1.05);
}

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

.send-btn .material-icons-round {
  font-size: 22px;
}

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

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

.modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-modal);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

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

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-hint {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.modal-input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  transition: border-color var(--transition);
}

.modal-input-group:focus-within {
  border-color: var(--green-primary);
}

.modal-input-group .material-icons-round {
  color: var(--text-muted);
  font-size: 20px;
}

.modal-input-group input {
  flex: 1;
  font-size: 15px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.modal-input-group input::placeholder {
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.modal-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: var(--green-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
}

.modal-search-btn:hover {
  background: var(--green-light);
}

.modal-search-btn .material-icons-round {
  font-size: 18px;
}

/* Search Result */
.search-result {
  animation: fadeInUp 0.2s ease;
}

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

.user-result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.user-result-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.user-result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-result-avatar .avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--green-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

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

.user-result-info h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.user-result-info small {
  font-size: 12px;
  color: var(--green-primary);
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

.start-chat-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--green-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  flex-shrink: 0;
}

.start-chat-btn:hover {
  background: var(--green-light);
}

.no-user-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: var(--text-muted);
}

.no-user-found .material-icons-round {
  font-size: 36px;
  opacity: 0.5;
}

.no-user-found p {
  font-size: 14px;
}

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast .material-icons-round {
  font-size: 18px;
}

.toast.success .material-icons-round { color: var(--green-primary); }
.toast.error .material-icons-round { color: #f44336; }
.toast.info .material-icons-round { color: #2196f3; }

/* ══════════════════════════════════════════════════════
   MESSAGES LIST
══════════════════════════════════════════════════════ */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* No min-height / justify-content — allow natural scroll */
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100vw;
  }

  .app {
    position: relative;
  }

  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 10;
    transform: translateX(0);
  }

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

  .chat-area {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 5;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
  }

  .chat-area.visible-mobile {
    transform: translateX(0);
  }

  .back-btn {
    display: flex !important;
  }

  .message {
    max-width: 88%;
  }

  .messages-container {
    padding: 12px 10px;
  }

  .auth-card {
    padding: 36px 24px;
    border-radius: var(--radius-lg);
  }

  .welcome-screen {
    display: none;
  }

  .chat-header {
    padding: 0 10px;
  }

  .message-input-area {
    padding: 8px 10px;
  }
}

/* ══════════════════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════════════════ */
.loading-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.loading-search-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--green-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.messages-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.messages-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  padding: 40px;
  color: var(--text-muted);
}

.messages-empty .material-icons-round {
  font-size: 48px;
  opacity: 0.3;
}

.messages-empty p {
  font-size: 14px;
  text-align: center;
  opacity: 0.7;
}

/* scroll-to-bottom button */
.scroll-down-btn {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: var(--transition);
  z-index: 5;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.scroll-down-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════
   EMOJI PICKER
══════════════════════════════════════════════════════ */
.emoji-picker {
  position: absolute;
  bottom: 70px;
  left: 12px;
  width: 320px;
  height: 380px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.emoji-picker-header {
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.emoji-categories {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.emoji-categories::-webkit-scrollbar { height: 2px; }

.emoji-cat-btn {
  width: 34px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  background: none;
  border: none;
  line-height: 1;
}

.emoji-cat-btn:hover,
.emoji-cat-btn.active {
  background: var(--bg-tertiary);
}

.emoji-search {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font);
}

.emoji-search::placeholder { color: var(--text-muted); }

.emoji-search:focus {
  border-color: var(--green-primary);
  outline: none;
}

.emoji-grid {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  align-content: start;
}

.emoji-item {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  line-height: 1;
  border: none;
  background: none;
}

.emoji-item:hover {
  background: var(--bg-tertiary);
  transform: scale(1.2);
}

.emoji-section-label {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 2px 2px;
}

@media (max-width: 768px) {
  .emoji-picker {
    width: calc(100vw - 24px);
    left: 8px;
    bottom: 68px;
    height: 300px;
  }
  .emoji-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* ══════════════════════════════════════════════════════
   ATTACH MENU
══════════════════════════════════════════════════════ */
.attach-menu {
  position: absolute;
  bottom: 70px;
  right: 68px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 100;
  animation: modalIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 130px;
}

.attach-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
}

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

.attach-option-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attach-option-icon .material-icons-round {
  font-size: 20px;
  color: #fff;
}

/* ══════════════════════════════════════════════════════
   IMAGE PREVIEW MODAL
══════════════════════════════════════════════════════ */
.img-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.img-preview-box {
  width: 100%;
  height: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.img-preview-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--bg-secondary);
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.img-preview-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  background: #000;
}

.img-preview-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
}

.img-preview-caption {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.img-preview-caption input {
  flex: 1;
  background: var(--bg-input);
  border-radius: var(--radius-xl);
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border: none;
  outline: none;
  font-family: var(--font);
}

.img-preview-caption input::placeholder { color: var(--text-muted); }

.upload-progress {
  padding: 10px 20px;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.upload-progress-bar {
  width: 0%;
  height: 3px;
  background: var(--green-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

#upload-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

/* ══════════════════════════════════════════════════════
   IMAGE MESSAGES
══════════════════════════════════════════════════════ */
.msg-image-wrap {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 260px;
}

.msg-image-wrap img {
  width: 100%;
  max-width: 260px;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-md);
  display: block;
  transition: filter 0.2s ease;
}

.msg-image-wrap:hover img { filter: brightness(0.85); }

.msg-image-wrap .img-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.msg-image-wrap:hover .img-overlay { opacity: 1; }

.msg-image-wrap .img-overlay .material-icons-round {
  font-size: 36px;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.msg-caption {
  font-size: 13.5px;
  margin-top: 4px;
  display: block;
  white-space: pre-wrap;
}

.img-loading-bubble {
  width: 200px;
  height: 150px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ══════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.95);
  cursor: zoom-out;
}

.lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 95vw;
  max-height: 95vh;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.1) !important;
  color: #fff !important;
  width: 42px !important;
  height: 42px !important;
}

.lightbox-close:hover { background: rgba(255,255,255,0.2) !important; }

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

#lightbox-download {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  color: #fff;
  transition: background var(--transition);
}

#lightbox-download:hover { background: rgba(255,255,255,0.2); }

#lightbox-download .material-icons-round { font-size: 22px; }

/* ══════════════════════════════════════════════════════
   CHATZY v2 — NEW FEATURES CSS
   Profile · Voice · Delete · Message Info · Settings
══════════════════════════════════════════════════════ */

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8edf2;
  --bg-chat: #efeae2;
  --bg-input: #f0f2f5;
  --bg-bubble-out: #d9fdd3;
  --bg-bubble-in: #ffffff;
  --bg-modal: #ffffff;

  --text-primary: #111b21;
  --text-secondary: #667781;
  --text-muted: #8696a0;
  --text-bubble-out: #111b21;
  --text-bubble-in: #111b21;
  --text-timestamp: #667781;

  --border-color: #e2e8ed;
  --divider-color: #e2e8ed;
  --hover-bg: #f5f6f6;
  --active-bg: #e8edf2;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* ── SIDE PANELS (Profile & Settings) ── */
.side-panel {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.side-panel.panel-open {
  transform: translateX(0);
}

.side-panel.hidden {
  display: flex !important;
  transform: translateX(-100%);
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: var(--header-height);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.panel-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-back-btn .material-icons-round {
  color: var(--text-primary);
}

/* ── PROFILE PANEL ── */
.profile-photo-section {
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  flex-shrink: 0;
}

.profile-photo-big {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

.profile-photo-big img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-photo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--green-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 60px;
  font-weight: 700;
  color: #fff;
}

.change-photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-photo-big:hover .change-photo-overlay { opacity: 1; }

.change-photo-overlay .material-icons-round { font-size: 28px; }

.profile-info-section {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.profile-field {
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
}

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

.profile-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.profile-field-value {
  flex: 1;
  font-size: 16px;
  color: var(--text-primary);
}

.edit-field-btn {
  opacity: 0.5;
  transition: opacity 0.2s;
}

.edit-field-btn:hover { opacity: 1; }

.profile-field-edit {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.profile-field-edit input,
.profile-field-edit textarea {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--green-primary);
  padding: 4px 0;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font);
  resize: none;
}

.profile-field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* ── SETTINGS PANEL ── */
.settings-body {
  flex: 1;
  overflow-y: auto;
}

.settings-section-label {
  padding: 16px 24px 6px;
  font-size: 12px;
  color: var(--green-primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-color);
}

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

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

.settings-item-icon.green { background: rgba(0,168,132,0.15); color: var(--green-primary); }
.settings-item-icon.blue  { background: rgba(59,130,246,0.15); color: #3b82f6; }
.settings-item-icon.orange{ background: rgba(249,115,22,0.15); color: #f97316; }
.settings-item-icon.purple{ background: rgba(168,85,247,0.15); color: #a855f7; }
.settings-item-icon.teal  { background: rgba(20,184,166,0.15); color: #14b8a6; }
.settings-item-icon.red   { background: rgba(241,92,109,0.15); color: #f15c6d; }

.settings-item-icon .material-icons-round { font-size: 20px; }

.settings-item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-item-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-item-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.settings-item-arrow {
  color: var(--text-muted);
  font-size: 20px !important;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider { background: var(--green-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Wallpaper Grid */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.wallpaper-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px;
  transition: all var(--transition);
  background: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.wallpaper-option:hover { background: var(--hover-bg); }
.wallpaper-option.active { border-color: var(--green-primary); color: var(--green-primary); }

.wallpaper-preview {
  width: 56px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.wp-default { background: var(--bg-chat); }
.wp-pattern1 {
  background: var(--bg-chat);
  background-image: radial-gradient(circle at 2px 2px, rgba(0,168,132,0.15) 1px, transparent 0);
  background-size: 16px 16px;
}
.wp-pattern2 {
  background: var(--bg-chat);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='3' fill='rgba(0,168,132,0.1)'/%3E%3C/svg%3E");
  background-size: 20px 20px;
}
.wp-pattern3 {
  background: var(--bg-chat);
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(0,168,132,0.08) 8px,
    rgba(0,168,132,0.08) 10px
  );
}
.wp-gradient1 { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.wp-gradient2 { background: linear-gradient(135deg, #0d1b2a 0%, #1b4332 50%, #081c15 100%); }

/* Apply wallpaper to chat background */
.messages-container[data-wallpaper="default"] { background: var(--bg-chat); }
.messages-container[data-wallpaper="pattern1"] {
  background-color: var(--bg-chat);
  background-image: radial-gradient(circle at 2px 2px, rgba(0,168,132,0.12) 1px, transparent 0);
  background-size: 20px 20px;
}
.messages-container[data-wallpaper="pattern2"] {
  background-color: var(--bg-chat);
  background-image: radial-gradient(circle, rgba(0,168,132,0.1) 2px, transparent 2px);
  background-size: 24px 24px;
}
.messages-container[data-wallpaper="pattern3"] {
  background-color: var(--bg-chat);
  background-image: repeating-linear-gradient(
    45deg, transparent, transparent 10px,
    rgba(0,168,132,0.06) 10px, rgba(0,168,132,0.06) 12px
  );
}
.messages-container[data-wallpaper="gradient1"] {
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.messages-container[data-wallpaper="gradient2"] {
  background: linear-gradient(160deg, #0d1b2a 0%, #1b4332 50%, #081c15 100%);
}

/* ── VOICE MESSAGE BUBBLE ── */
.voice-bubble {
  min-width: 200px;
  max-width: 280px;
}

.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
}

.voice-play-btn {
  width: 38px;
  height: 38px;
  background: var(--green-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, background 0.15s;
}

.voice-play-btn:hover { transform: scale(1.08); background: var(--green-light); }
.voice-play-btn .material-icons-round { font-size: 20px; color: #fff; }

.voice-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
}

.wave-bar {
  width: 3px;
  background: var(--text-secondary);
  border-radius: 3px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.voice-waveform.playing .wave-bar {
  background: var(--green-primary);
  animation: waveAnim 0.6s ease-in-out infinite alternate;
}

.voice-waveform.playing .wave-bar:nth-child(2n) { animation-delay: 0.1s; }
.voice-waveform.playing .wave-bar:nth-child(3n) { animation-delay: 0.2s; }

@keyframes waveAnim {
  from { transform: scaleY(0.5); }
  to   { transform: scaleY(1.4); }
}

.voice-dur {
  font-size: 12px;
  color: var(--text-timestamp);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── RECORDING BAR ── */
.recording-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.recording-indicator {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-xl);
  padding: 10px 16px;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: #f15c6d;
  border-radius: 50%;
  flex-shrink: 0;
  animation: recPulse 1s ease-in-out infinite;
}

@keyframes recPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.rec-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
}

.rec-waveform span {
  display: block;
  width: 3px;
  background: var(--green-primary);
  border-radius: 3px;
  animation: recWave 0.8s ease-in-out infinite alternate;
}

.rec-waveform span:nth-child(1) { height: 8px; animation-delay: 0s; }
.rec-waveform span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.rec-waveform span:nth-child(3) { height: 22px; animation-delay: 0.2s; }
.rec-waveform span:nth-child(4) { height: 14px; animation-delay: 0.3s; }
.rec-waveform span:nth-child(5) { height: 20px; animation-delay: 0.4s; }
.rec-waveform span:nth-child(6) { height: 10px; animation-delay: 0.5s; }
.rec-waveform span:nth-child(7) { height: 18px; animation-delay: 0.6s; }
.rec-waveform span:nth-child(8) { height: 12px; animation-delay: 0.7s; }
.rec-waveform span:nth-child(9) { height: 22px; animation-delay: 0.8s; }
.rec-waveform span:nth-child(10) { height: 8px; animation-delay: 0.9s; }

@keyframes recWave {
  from { transform: scaleY(0.4); opacity: 0.5; }
  to   { transform: scaleY(1); opacity: 1; }
}

.rec-timer {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── DELETED MESSAGE ── */
.deleted-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.65;
  font-style: italic;
}

.deleted-text {
  font-size: 13.5px;
  color: var(--text-secondary) !important;
}

/* ── CONTEXT MENU ── */
.context-menu {
  position: fixed;
  z-index: 9999;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.05);
  padding: 6px;
  min-width: 180px;
  border: 1px solid var(--border-color);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.context-menu.ctx-show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  width: 100%;
  text-align: left;
}

.ctx-item:hover { background: var(--hover-bg); }
.ctx-item.danger { color: #f15c6d; }
.ctx-item.danger:hover { background: rgba(241,92,109,0.1); }
.ctx-item .material-icons-round { font-size: 18px; }

/* ── MESSAGE INFO MODAL ── */
.msg-info-modal-box {
  max-width: 340px;
  width: 90%;
}

.msg-info-preview-wrap {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin: 12px 16px;
}

.msg-info-rows {
  padding: 8px 0;
}

.msg-info-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.msg-info-row .material-icons-round { font-size: 22px; }

.msg-info-row > div p {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.msg-info-row > div small {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── CONTACT INFO MODAL ── */
.contact-modal {
  padding: 0;
  overflow: hidden;
  max-width: 360px;
  width: 90%;
  position: relative;
}

.contact-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  background: rgba(0,0,0,0.4) !important;
  color: #fff !important;
}

.contact-modal-photo {
  width: 100%;
  height: 220px;
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-modal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contact-avatar-placeholder {
  width: 100px;
  height: 100px;
  background: var(--green-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 700;
  color: #fff;
}

.contact-modal-body {
  padding: 16px 20px 20px;
}

.contact-modal-body h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.contact-modal-uid {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.contact-modal-about,
.contact-modal-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
}

.contact-modal-about .material-icons-round,
.contact-modal-status .material-icons-round {
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
}

.contact-modal-status .material-icons-round {
  font-size: 12px;
  margin-top: 3px;
}

.contact-modal-about p,
.contact-modal-status p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ── MORE OPTIONS DROPDOWN ── */
.dropdown-menu {
  position: absolute;
  top: calc(var(--header-height) + 4px);
  right: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 200;
  min-width: 180px;
  overflow: hidden;
  animation: modalIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  width: 100%;
  text-align: left;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--hover-bg); }
.dropdown-item .material-icons-round { font-size: 18px; color: var(--text-secondary); }

/* ── CLICKABLE AVATAR ── */
.clickable-avatar {
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.clickable-avatar:hover {
  opacity: 0.85;
  transform: scale(0.97);
}

/* ── CHAT HEADER CLICKABLE ── */
#chat-header-info-click { cursor: pointer; }
#chat-header-info-click:hover h3 { text-decoration: underline; text-underline-offset: 2px; }

/* ── RESPONSIVE PANELS MOBILE ── */
@media (max-width: 768px) {
  .side-panel {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 200;
  }

  .wallpaper-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .msg-info-modal-box,
  .contact-modal {
    width: 95%;
  }
}


/* ══════════════════════════════════════════════════════
   CONTACT INFO PANEL — Full Screen WhatsApp Style
══════════════════════════════════════════════════════ */
.contact-info-panel {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Header */
.cip-header {
  position: relative;
  height: 220px;
  flex-shrink: 0;
  overflow: hidden;
}

.cip-header-bg {
  position: absolute;
  inset: 0;
  background: var(--bg-secondary);
  background-size: cover;
  background-position: center;
  filter: blur(20px) brightness(0.4);
  transform: scale(1.1);
}

.cip-header-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.65) 100%);
}

.cip-header-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 0;
}

.cip-back-btn {
  color: #fff !important;
  background: rgba(255,255,255,0.12) !important;
}
.cip-back-btn:hover { background: rgba(255,255,255,0.22) !important; }

.cip-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.cip-avatar-wrap {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.cip-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--bg-primary);
  background: var(--bg-tertiary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.cip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cip-avatar .avatar-placeholder {
  width: 100%;
  height: 100%;
  background: var(--green-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

.cip-online-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--green-primary);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

/* Body */
.cip-body {
  flex: 1;
  padding-top: 52px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

/* Name card */
.cip-name-card {
  text-align: center;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.cip-name-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.cip-uid-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,168,132,0.12);
  border: 1px solid rgba(0,168,132,0.25);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 8px;
}

.cip-uid-row .material-icons-round {
  font-size: 14px;
  color: var(--green-primary);
}

.cip-uid-row span:last-child {
  font-size: 13px;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: var(--green-primary);
  letter-spacing: 1px;
}

.cip-status-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.cip-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.cip-status-dot.online { background: var(--green-primary); }

/* Action buttons */
.cip-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 4px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.cip-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: var(--transition);
  padding: 8px;
  border-radius: var(--radius-md);
}

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

.cip-action-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0,168,132,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.cip-action-btn:hover .cip-action-icon { background: rgba(0,168,132,0.2); }

.cip-action-icon .material-icons-round {
  font-size: 22px;
  color: var(--green-primary);
}

/* Sections */
.cip-section {
  background: var(--bg-secondary);
  margin: 0 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.cip-section-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
}

.cip-row-icon {
  font-size: 22px !important;
  color: var(--text-muted);
  margin-top: 2px;
  flex-shrink: 0;
}

.cip-row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.cip-row-value {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.4;
}

.cip-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.cip-see-all {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--green-primary);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

.cip-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}

.cip-media-thumb {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-tertiary);
}

.cip-media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.cip-media-thumb:hover img { transform: scale(1.05); }

.cip-no-media {
  grid-column: 1/-1;
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
