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

:root {
  /* Apple Slate Dark Palette */
  --bg-dark: #0a0b12;
  --bg-card: rgba(30, 30, 38, 0.45) !important;
  --bg-card-hover: rgba(45, 45, 58, 0.65) !important;
  --bg-sidebar: rgba(14, 16, 24, 0.45) !important;
  --bg-chat: #0e101a !important;
  --bg-input: rgba(32, 32, 42, 0.6) !important;
  --bg-search-sticky: rgba(7, 8, 14, 0.75);

  /* Apple Accent Colors */
  --accent-primary: #0a84ff;         /* Apple SF Blue */
  --accent-primary-hover: #0066cc;
  --accent-primary-glow: rgba(10, 132, 255, 0.25);

  --accent-purple: #bf5af2;          /* Apple Purple */
  --accent-purple-glow: rgba(191, 90, 242, 0.25);

  --accent-blue: #0a84ff;
  --accent-danger: #ff453a;          /* Apple Red */
  --accent-success: #30d158;         /* Apple Green */

  --text-main: #ffffff;
  --text-muted: #a2a2a8;             /* Apple System Gray */
  --text-dim: #73737a;               /* Apple System Gray 2 */

  --border-color: rgba(255, 255, 255, 0.08) !important;
  --border-glow: rgba(10, 132, 255, 0.15);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --font-sans: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-fast: 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-normal: 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);

  /* Font size variables */
  --base-font-size: 14px;
  --message-font-size: 14.5px;
  --sidebar-title-font-size: 14px;
  --sidebar-snippet-font-size: 12px;
}

body.font-size-small {
  --message-font-size: 12.5px;
  --sidebar-title-font-size: 12.5px;
  --sidebar-snippet-font-size: 11px;
  --base-font-size: 12.5px;
}
body.font-size-normal {
  --message-font-size: 14.5px;
  --sidebar-title-font-size: 14px;
  --sidebar-snippet-font-size: 12px;
  --base-font-size: 14px;
}
body.font-size-large {
  --message-font-size: 16.5px;
  --sidebar-title-font-size: 16px;
  --sidebar-snippet-font-size: 13.5px;
  --base-font-size: 16px;
}
body.font-size-xlarge {
  --message-font-size: 18.5px;
  --sidebar-title-font-size: 18px;
  --sidebar-snippet-font-size: 15px;
  --base-font-size: 18px;
}


/* Prevent native iOS text selection and link previews on long-press for interactive elements */
.message-bubble,
.unified-chat-item,
.sidebar-bottom-nav,
.nav-tab-btn,
.context-emoji,
.context-action-item,
.user-avatar,
.reactions-row,
.message-readers-row,
.sidebar-header,
.current-user-profile {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.drawer-title,
.settings-header-title,
.btn,
.tab-label,
.admin-tab-btn,
.unified-tab-btn {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

html, body {
  overflow: hidden !important;
  max-width: 100% !important;
}

body {
  background-color: var(--bg-dark) !important;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(10, 132, 255, 0.35) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(191, 90, 242, 0.30) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(48, 209, 88, 0.08) 0%, transparent 60%) !important;
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  display: flex;
  margin: 0;
}

/* CUSTOM SCROLLBARS (macOS Minimalist style) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* AUTHENTICATION SCREEN */
.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, #111115 0%, #000000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card) !important;
  backdrop-filter: blur(35px);
  -webkit-backdrop-filter: blur(35px);
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  animation: appleSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.auth-header {
  text-align: center;
  margin-bottom: 25px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.auth-logo svg {
  width: 40px;
  height: 40px;
  color: var(--accent-primary);
  filter: drop-shadow(0 0 12px var(--accent-primary-glow));
}

.auth-logo img {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  filter: drop-shadow(0 0 12px var(--accent-primary-glow));
}

.auth-logo h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  background: linear-gradient(180deg, #ffffff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: -0.1px;
}

.input-wrapper input, .form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.input-wrapper input:focus, .form-control:focus {
  border-color: var(--accent-primary) !important;
  background: rgba(45, 45, 48, 0.95) !important;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.3) !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  width: 100%;
  user-select: none;
}

.btn-primary {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px var(--accent-primary-glow) !important;
}

.btn-primary:hover {
  background: var(--accent-primary-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-primary-glow) !important;
}

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

.btn-google {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.btn-google:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-0.5px);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0;
  color: var(--text-dim);
  font-size: 11px;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-divider::before { margin-right: 10px; }
.auth-divider::after { margin-left: 10px; }

.auth-link {
  color: var(--accent-primary);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
}

.auth-link:hover {
  color: #64afff;
}

/* User Selection Grid on Login */
.user-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px;
}

.user-select-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-select-card:hover {
  background: rgba(10, 132, 255, 0.1);
  border-color: var(--accent-primary);
  transform: scale(1.02);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent-purple) 0%, var(--accent-blue) 100%) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
  transition: transform var(--transition-fast) ease;
  overflow: hidden;
  flex-shrink: 0;
}

.user-avatar:hover .avatar-hover-overlay {
  opacity: 1 !important;
}

.user-select-card:hover .user-avatar {
  transform: rotate(10deg) scale(1.05);
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN APPLICATION LAYOUT */
#mainApp {
  display: flex;
  margin: 16px !important;
  height: calc(100vh - 32px) !important;
  height: calc(100dvh - 32px) !important;
  width: calc(100% - 32px) !important;
  border-radius: 20px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4) !important;
  background: rgba(14, 16, 24, 0.3) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  position: relative;
  overflow: hidden;
}

@media (max-width: 768px) {
  #mainApp {
    margin: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 100% !important;
    border-radius: 0 !important;
    border: none !important;
  }
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  width: 300px;
  background: var(--bg-sidebar) !important;
  backdrop-filter: blur(30px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 999;
}

.sidebar-header {
  height: 68px !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-brand svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
  filter: drop-shadow(0 0 4px var(--accent-primary-glow));
}

.app-brand img {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  filter: drop-shadow(0 0 4px var(--accent-primary-glow));
}

.app-brand h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(180deg, var(--text-main) 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.current-user-profile {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
}

.toggle-widgets-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.toggle-widgets-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.current-user-avatar {
  position: relative;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #1c1c1e;
}

.status-dot.online { background: var(--accent-success); }
.status-dot.offline { background: var(--text-dim); }

.nav-section {
  padding: 12px 10px 4px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0 10px 6px;
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-normal);
  margin-bottom: 2px;
}

.nav-item:hover, .nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(10, 132, 255, 0.12) !important;
  color: var(--accent-primary) !important;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CHAT MAIN AREA */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  position: relative;
  overflow: hidden;
}

.chat-header {
  height: 68px !important;
  padding: 0 20px !important;
  box-sizing: border-box !important;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center !important;
  justify-content: space-between !important;
  background: rgba(10, 10, 12, 0.6) !important;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-title h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

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

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast) !important;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: rgba(10, 132, 255, 0.15) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  transform: scale(1.08);
}

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

.icon-btn:disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  transform: none !important;
  pointer-events: none !important;
}

/* Channel Call Banner */
/* Channel Call Banner */
.group-call-banner {
  background: rgba(16, 22, 35, 0.7);
  border-bottom: 1px solid rgba(16, 185, 129, 0.2);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideDown 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

/* Pulse Indicator styles */
.call-pulse-indicator {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(16, 185, 129, 0.12);
  border-radius: 50%;
}

.call-pulse-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseDot 1.6s infinite;
}

@keyframes pulseDot {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Join Button Style */
.btn-join-call {
  background: #10b981 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 20px !important;
  padding: 6px 16px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
  transition: all 0.2s ease !important;
  cursor: pointer;
}

.btn-join-call:hover {
  background: #059669 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

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

/* Pinned Message Banner Styles */
.pinned-message-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(28, 28, 30, 0.7) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
  position: relative;
  gap: 12px;
  transition: all var(--transition-normal);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.pinned-message-content-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.pinned-message-icon {
  color: var(--accent-primary);
  flex-shrink: 0;
  animation: pinPulse 2s infinite ease-in-out;
}

@keyframes pinPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 4px var(--accent-primary-glow)); }
  100% { transform: scale(1); }
}

.pinned-message-text-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pinned-message-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-primary);
  margin-bottom: 2px;
}

.pinned-message-excerpt {
  font-size: 13px;
  color: var(--text-main);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.pinned-message-unpin-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  outline: none;
}

.pinned-message-unpin-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent-danger);
  transform: scale(1.1);
}

/* Pulse Highlight for Pinned Message in Feed */
@keyframes pulseHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.4);
    background-color: rgba(10, 132, 255, 0.15);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(10, 132, 255, 0);
    background-color: rgba(10, 132, 255, 0.3);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(10, 132, 255, 0);
    background-color: transparent;
  }
}

.message-item.highlight-pinned {
  animation: pulseHighlight 2s ease-out 2;
  border-radius: 8px;
}

/* MESSAGES FEED (Apple Translucent Dark design) */
.messages-feed {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background-color: transparent !important;
  overflow-anchor: auto !important;
  scroll-behavior: auto !important;
  position: relative !important;
}

/* History Loader & Shimmer */
.history-loader-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 12px 0 16px 0;
  animation: historyLoaderFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.history-loader-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

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

.history-loader-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--accent-primary, #0a84ff);
  display: inline-block;
  animation: historyDotPulse 1.2s infinite ease-in-out both;
}

.history-loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.history-loader-dots span:nth-child(2) { animation-delay: -0.16s; }
.history-loader-dots span:nth-child(3) { animation-delay: 0s; }

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

.history-loader-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted, rgba(255, 255, 255, 0.7));
  letter-spacing: 0.2px;
}

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

.chat-day-section {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.message-item {
  display: flex;
  align-items: flex-start !important;
  gap: 8px;
  max-width: 70%;
}

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

.message-item.new-message-animation {
  animation: appleMessageFade 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.message-item.self {
  align-self: flex-end;
  flex-direction: row;
}

.message-item.self .user-avatar {
  display: none !important;
}

.message-bubble {
  background: rgba(30, 30, 38, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 8px 12px !important;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s !important;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.message-bubble:hover {
  transform: translateY(-0.5px);
  background: rgba(45, 45, 55, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.message-item.self .message-bubble {
  background: rgba(10, 132, 255, 0.15) !important;
  border: 1px solid rgba(10, 132, 255, 0.25) !important;
  border-radius: 18px !important;
  border-bottom-right-radius: 4px !important;
  border-bottom-left-radius: 18px !important;
  color: var(--text-main) !important;
  box-shadow: 0 6px 20px rgba(10, 132, 255, 0.1) !important;
}

.message-item.self .message-bubble:hover {
  background: rgba(10, 132, 255, 0.22) !important;
  border-color: rgba(10, 132, 255, 0.35) !important;
  box-shadow: 0 8px 24px rgba(10, 132, 255, 0.15) !important;
}

.message-author {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 3px;
  display: block;
}

.message-item.self .message-author {
  display: none;
}

/* Inline Time & Status */
.message-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  align-self: flex-end;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
}

.message-item.self .message-meta-row {
  color: rgba(255, 255, 255, 0.65);
}

.message-time {
  font-size: 9px;
  font-weight: 400;
}

.message-status-check {
  font-weight: bold;
  display: inline-block;
  margin-left: 4px;
}

.message-status-check.read {
  color: #34b7f1 !important; /* WhatsApp Blue checkmarks */
}

.message-status-check.sent {
  color: rgba(255,255,255,0.4) !important;
}

.light-theme .message-status-check.sent {
  color: rgba(0,0,0,0.3) !important;
}

.message-text {
  font-size: var(--message-font-size, 14.5px);
  line-height: 1.55;
  color: #ffffff;
  word-break: break-word;
}

.chat-message-link {
  color: var(--accent-primary);
  text-decoration: underline;
  word-break: break-all;
}

.message-item.self .chat-message-link {
  color: #ffffff !important;
}

.message-image-thumb {
  width: 100%;
  max-width: 320px;
  max-height: 380px;
  border-radius: 12px;
  margin-top: 4px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  object-fit: contain;
  display: block;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255,255,255,0.06);
}

.message-image-thumb:hover {
  transform: scale(1.02);
  filter: brightness(1.08);
}

.reactions-row {
  display: flex;
  gap: 3px !important;
  margin-top: 0 !important;
  flex-wrap: wrap;
}

.reaction-pill {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  border-radius: 6px !important;
  padding: 0 4px !important;
  font-size: 10px !important;
  line-height: 14px !important;
  height: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.reaction-pill:hover {
  background: rgba(10, 132, 255, 0.2) !important;
  border-color: var(--accent-primary) !important;
  transform: scale(1.1) translateY(-0.5px);
}

.reaction-pill:active {
  transform: scale(0.92);
}

.reaction-pill.pop-anim {
  animation: reactionPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes reactionPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.message-readers-row {
  margin-top: 0 !important;
  gap: 1px !important;
}

.micro-reader-avatar {
  width: 12px !important;
  height: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.micro-reader-more {
  font-size: 8px !important;
  padding: 1px 4px !important;
}

.message-actions-bar {
  display: flex;
  opacity: 0.5;
  gap: 6px;
  margin-top: 6px;
  transition: opacity var(--transition-fast) ease;
}

.message-bubble:hover .message-actions-bar {
  opacity: 1;
}

.action-mini-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: all 0.15s;
}

.action-mini-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-0.5px);
}

/* CHAT INPUT AREA (Transparent baseline wrapper - aligns with sidebar nav) */
.chat-input-area {
  padding: 6px 20px !important;
  background: transparent !important;
  border-top: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  min-height: 56px !important;
  height: auto !important;
  box-sizing: border-box !important;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

/* Unified Floating Glass Input Pill */
.chat-input-container {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  min-height: 44px !important;
  height: auto !important;
  background: rgba(30, 32, 45, 0.75) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 22px !important;
  padding: 4px 12px !important;
  box-sizing: border-box !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35) !important;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease !important;
}

.chat-input-container:focus-within {
  border-color: var(--accent-primary) !important;
  background: rgba(30, 32, 45, 0.9) !important;
  box-shadow: 0 10px 35px rgba(10, 132, 255, 0.2) !important;
}

.attachment-btn-circle {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50%;
  background: transparent !important;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.attachment-btn-circle:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-main);
  transform: scale(1.05);
}

.chat-input-box {
  flex: 1;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: none !important;
  transition: none !important;
  position: relative;
  min-width: 0 !important;
}

.chat-input-box:focus-within {
  border-color: transparent !important;
  background: transparent !important;
  transform: none !important;
  box-shadow: none !important;
}

.chat-input-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-size: 14px;
  resize: none;
  min-height: 26px;
  max-height: 160px;
  padding: 6px 0;
  line-height: 1.4;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  word-break: break-all !important;
  overflow-wrap: break-word !important;
}

.input-emoji-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: all 0.2s;
}

.input-emoji-btn:hover {
  opacity: 0.95;
  transform: scale(1.1);
}

.input-action-wrapper {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast) !important;
}

.action-circle-btn.mic-active {
  background: transparent;
  color: var(--text-muted);
}

.action-circle-btn.mic-active:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  transform: scale(1.05);
}

.action-circle-btn.send-active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-primary-glow);
}

.action-circle-btn.send-active:hover {
  background: var(--accent-primary-hover);
  transform: scale(1.08);
}

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

/* Emoji Picker Popup */
.emoji-picker-popup {
  position: absolute;
  bottom: 66px;
  right: 20px;
  background: rgba(30, 30, 32, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  z-index: 1000;
  max-width: 240px;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  animation: pickerFadeIn 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 20, 30, 0.75); /* Dark transparent blue matching Tevah theme */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.modal-content {
  background: rgba(28, 28, 30, 0.8) !important;
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-lg);
  padding: 30px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.1);
  max-height: 90vh;
  overflow-y: auto;
  animation: appleModalOpen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

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

/* VIDEO CALL OVERLAY & GRID */
.call-modal-content {
  max-width: 860px;
  width: 95%;
  background: #000000;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.video-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), 1fr);
  grid-template-rows: repeat(var(--rows, 1), 1fr);
  gap: 16px !important;
  padding: 84px 24px 96px 24px !important; /* Extra padding top & bottom for floating header & toolbar */
  background: #111214 !important;
  overflow: hidden;
  align-content: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  position: relative !important;
}

.video-box {
  background: #1e1f22 !important;
  border-radius: 12px !important;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  aspect-ratio: 16 / 9 !important;
  margin: auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

@media (max-width: 768px) {
  .video-box {
    aspect-ratio: 16 / 9 !important; /* Keep uniform landscape layout */
  }
}

.video-box video {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.video-label {
  position: absolute;
  bottom: 12px !important;
  left: 12px !important;
  background: rgba(30, 31, 34, 0.75) !important;
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  padding: 6px 12px !important;
  border-radius: 20px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 10;
}

.call-controls {
  position: absolute !important;
  bottom: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: rgba(23, 24, 26, 0.85) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 40px !important;
  padding: 10px 24px !important;
  z-index: 1000 !important;
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6) !important;
  width: auto !important;
  border-top: none !important;
}

.call-btn {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50% !important;
  border: none !important;
  background: rgba(255, 255, 255, 0.08); /* Removed !important to allow status-driven color shifts */
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.call-btn.muted {
  background: var(--accent-danger) !important;
}

.call-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

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

.call-btn.end-call {
  background: var(--accent-danger);
}

.call-btn.end-call:hover {
  background: #e53e3e;
}

.call-btn.speaker-on {
  background: var(--accent-primary) !important;
  color: #fff !important;
}

.call-btn.earpiece-on {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.call-btn.bluetooth-on {
  background: #007aff !important;
  color: #fff !important;
}

.docked-call-btn.speaker-on {
  background: var(--accent-primary) !important;
  color: #fff !important;
}

.docked-call-btn.earpiece-on {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.docked-call-btn.bluetooth-on {
  background: #007aff !important;
  color: #fff !important;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 12, 0.72) !important;
  backdrop-filter: blur(30px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(140%) !important;
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

.lightbox-img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  transition: max-width 0.2s ease, max-height 0.2s ease, opacity 0.2s ease;
  cursor: zoom-in;
}

.lightbox-img.zoomed {
  max-width: none !important;
  max-height: none !important;
  cursor: zoom-out !important;
}

.lightbox-btn {
  position: absolute;
  top: max(24px, calc(env(safe-area-inset-top, 0px) + 16px));
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10010;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  padding: 0;
  margin: 0;
  outline: none;
  text-decoration: none;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
  color: #fff;
}

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

.lightbox-close {
  right: max(20px, calc(env(safe-area-inset-right, 0px) + 18px));
}

.lightbox-download {
  right: max(76px, calc(env(safe-area-inset-right, 0px) + 74px));
}

.mobile-menu-btn {
  display: none;
}

#chatHeaderMoreBtn {
  display: none !important;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }

  .sidebar {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    position: absolute !important;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(0);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 1;
    box-shadow: none !important;
  }

  .chat-container {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    position: absolute !important;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 2;
    background: #0d0e15 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .light-theme .chat-container {
    background: #f5f6fa !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #mainApp.show-chat .sidebar {
    display: flex !important;
    transform: translateX(-20%);
  }

  #mainApp.show-chat .chat-container {
    display: flex !important;
    transform: translateX(0);
  }

  .chat-header {
    padding: env(safe-area-inset-top) 12px 0 12px;
    height: calc(68px + env(safe-area-inset-top)) !important;
  }

  #openMediaGalleryBtn,
  #toggleLocalSearchBtn,
  #startVideoCallBtn,
  #dmToggleFriendBtn,
  #channelSettingsBtn {
    display: none !important;
  }

  #chatHeaderMoreBtn {
    display: flex !important;
  }

  #declarationsModal.modal-overlay,
  #channelSettingsModal.modal-overlay,
  #userProfileModal.modal-overlay,
  #adminPanelModal.modal-overlay,
  #mediaGalleryModal.modal-overlay,
  #reportContentModal.modal-overlay,
  #adminReplyModal.modal-overlay,
  #legalViewerModal.modal-overlay {
    padding: 0 !important;
  }

  .mobile-full-screen-modal {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    padding: calc(env(safe-area-inset-top) + 16px) 20px 20px 20px !important;
    overflow-y: auto !important;
  }

  #galleryContentArea {
    max-height: calc(100vh - 160px) !important;
  }

  .admin-table-wrapper,
  #adminPendingSection > div,
  #adminGroupsSection > div {
    max-height: calc(100vh - 200px) !important;
    overflow-x: auto !important;
  }

  .messages-feed {
    padding: 12px;
  }

  .message-item {
    max-width: 95%;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 10px !important;
    padding: 12px !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 auto !important;
  }


  .call-modal-content {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
}

/* Bottom Tab Navigation Bar */
.sidebar-bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(18, 18, 18, 0.95);
  padding-top: 8px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  min-height: 56px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.nav-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: 25%;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-size: 10px;
}

.nav-tab-btn:hover {
  color: var(--text-main);
}

.nav-tab-btn:hover svg {
  transform: translateY(-2px) scale(1.05);
}

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

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

.tab-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--accent-danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

/* Unified Chat Scrollable Items */
.unified-chat-item {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 4px 10px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  border: 1px solid transparent !important;
}

.unified-chat-item:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  transform: translateY(-1px);
}

.unified-chat-item.active {
  background: rgba(10, 132, 255, 0.16) !important;
  border-color: rgba(10, 132, 255, 0.3) !important;
  box-shadow: 0 8px 20px rgba(10, 132, 255, 0.15) !important;
}

.unified-chat-item:active {
  transform: translateY(0px) scale(0.99);
}

.chat-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1e1e24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent-primary);
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.chat-item-title {
  font-weight: 600;
  font-size: var(--sidebar-title-font-size, 14px);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

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

.chat-item-snippet {
  font-size: var(--sidebar-snippet-font-size, 12px);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Lightbox Carousel Navigation Overlay Buttons */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 30px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10010;
  user-select: none;
}

.lightbox-nav-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-50%) scale(1.05);
}

.lightbox-nav-btn.prev {
  left: 20px;
  padding-right: 2px;
}

.lightbox-nav-btn.next {
  right: 20px;
  padding-left: 2px;
}

/* Profile / Settings Form components */
.profile-settings-group {
  margin-bottom: 14px;
}

.profile-settings-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.profile-settings-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  transition: border-color 0.2s;
}

.profile-settings-input:focus {
  border-color: var(--accent-primary);
  outline: none;
}

select.profile-settings-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238e8e93' stroke-width='2.5' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px !important;
  cursor: pointer;
}

select.profile-settings-input option {
  background: #1c2533;
  color: #fff;
}

.light-theme select.profile-settings-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236b6b72' stroke-width='2.5' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
}

.light-theme select.profile-settings-input option {
  background: #ffffff;
  color: #000000;
}

/* Start DM Row contact list styling */
.contact-list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-list-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-0.5px);
}

.contact-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-primary);
  border: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.contact-name {
  font-size: 13.5px;
  color: var(--text-main);
}

/* Apple Settings & Channel Info Styling */
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 15px;
}
.settings-header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}
.settings-header-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}
.settings-menu-item:hover {
  background: rgba(255,255,255,0.03);
}

/* Apple Info Modal Styles */
.telegram-info-modal {
  background: rgba(30, 30, 38, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  border-radius: 24px !important;
  color: #fff;
  padding: 24px !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
}
.telegram-avatar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.telegram-avatar-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  position: relative;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  flex-shrink: 0;
  overflow: visible;
}
.telegram-avatar-camera {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #007aff;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 2px solid rgba(30, 30, 38, 0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.telegram-card {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  border-radius: 16px !important;
  padding: 8px 16px !important;
  margin-bottom: 16px !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}
.telegram-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 2px;
}
.telegram-card-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.04);
}
.telegram-card-row:last-child {
  margin-bottom: 0;
}
.telegram-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.telegram-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.telegram-row-label {
  font-size: 14px;
  font-weight: 500;
}
.telegram-row-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.telegram-collapse-panel {
  display: none;
  background: rgba(0,0,0,0.3);
  border-radius: 10px;
  padding: 12px;
  margin-top: 8px;
  border: 1px solid rgba(255,255,255,0.05);
  max-height: 450px;
  overflow-y: auto;
}

/* ==========================================================================
   NEW CHAT DROPDOWN & SETTINGS INLINE STYLES OVERRIDES
   ========================================================================== */

.new-chat-dropdown-container {
  position: relative;
  display: inline-block;
}

.new-chat-dropdown-menu {
  position: absolute;
  top: 38px;
  right: 0;
  background: rgba(28, 28, 30, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: var(--radius-sm);
  padding: 6px 0;
  width: max-content;
  min-width: 160px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 1005;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  animation: dropdownFadeIn 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

.new-chat-dropdown-menu button {
  background: transparent !important;
  border: none !important;
  color: var(--text-main) !important;
  padding: 10px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.new-chat-dropdown-menu button:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Overriding hardcoded settings backgrounds in JS */
.settings-search-input {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: var(--text-main) !important;
}

.settings-profile-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
  transition: all var(--transition-fast);
}

.settings-profile-card:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

.settings-menu-list {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2) !important;
}

.settings-menu-item {
  background: transparent !important;
  transition: background var(--transition-fast) !important;
}

.settings-menu-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Admin Panel Table & Modal Styling */
.modal-content table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 13px !important;
  margin-top: 10px !important;
}

.modal-content th {
  padding: 10px 8px !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08) !important;
  text-align: left !important;
}

.modal-content td {
  padding: 12px 8px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: var(--text-main) !important;
  vertical-align: middle !important;
}

.modal-content tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}

.modal-content tr:hover td {
  background: rgba(255, 255, 255, 0.02) !important;
}

#rawDatabaseLog {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--accent-success) !important;
  font-family: monospace;
}

/* Call Log Dedicated Message Bubbles - Compact & Translucent */
.call-log-message-bubble {
  min-width: unset !important;
  max-width: 260px !important;
  border-radius: 16px !important;
  padding: 8px 12px !important;
  background: rgba(30, 32, 45, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.message-item.self .call-log-message-bubble {
  background: rgba(30, 32, 45, 0.45) !important;
}

.message-item:not(.self) .call-log-message-bubble {
  background: rgba(30, 32, 45, 0.45) !important;
}

.call-log-message-bubble .call-log-title,
.call-log-message-bubble div[id^="msg_call_dir_"] {
  color: var(--text-main) !important;
}

.call-log-message-bubble .call-log-meta,
.call-log-message-bubble div[id^="msg_call_meta_"] {
  color: var(--text-muted) !important;
}

.message-item.self .call-log-message-bubble .call-log-title,
.message-item.self .call-log-message-bubble div[id^="msg_call_dir_"] {
  color: #ffffff !important;
}

.message-item.self .call-log-message-bubble .call-log-meta,
.message-item.self .call-log-message-bubble div[id^="msg_call_meta_"] {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* ==========================================================================
   LIGHT MODE OVERRIDES
   ========================================================================== */

.light-theme {
  --bg-dark: #f5f6fa;
  --bg-card: rgba(255, 255, 255, 0.7) !important;
  --bg-card-hover: rgba(0, 0, 0, 0.04) !important;
  --bg-sidebar: rgba(255, 255, 255, 0.45) !important;
  --bg-chat: #ffffff !important;
  --bg-input: rgba(255, 255, 255, 0.8) !important;
  --bg-search-sticky: rgba(245, 246, 250, 0.75);

  --border-color: rgba(0, 0, 0, 0.08) !important;
  
  --text-main: #1c1c1e !important;
  --text-muted: #636366 !important;
  --text-dim: #8e8e93 !important;

  --accent-primary: #007aff !important;
  --accent-primary-hover: #0056b3 !important;
  --accent-primary-glow: rgba(0, 122, 255, 0.12) !important;
}

/* Premium Pastel Glowing Mesh Background for Light Theme */
body.light-theme {
  background-color: #f5f6fa !important;
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(0, 122, 255, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(255, 105, 180, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 20% 80%, rgba(52, 199, 89, 0.06) 0%, transparent 40%) !important;
}

/* macOS-style Light Glass Application Window */
.light-theme #mainApp {
  background: rgba(255, 255, 255, 0.45) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 35px 70px rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
}

/* Sidebar Light Glass */
.light-theme .sidebar {
  background: rgba(255, 255, 255, 0.45) !important;
  backdrop-filter: blur(20px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(140%) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.light-theme .sidebar-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.light-theme .current-user-profile {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  background: rgba(255, 255, 255, 0.25) !important;
}

.light-theme .sidebar-bottom-nav {
  background: rgba(255, 255, 255, 0.8) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.light-theme .chat-item-avatar {
  background: rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  color: #007aff !important;
}

/* Search Bar Light Theme */
.light-theme .search-bar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.light-theme .search-wrapper input {
  background: rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  color: #1c1c1e !important;
}

.light-theme .search-wrapper input:focus {
  background: #ffffff !important;
  border-color: #007aff !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15) !important;
}

/* Chat List Items */
.light-theme .unified-chat-item {
  border: 1px solid transparent !important;
}

.light-theme .unified-chat-item:hover {
  background: rgba(0, 0, 0, 0.03) !important;
  border-color: rgba(0, 0, 0, 0.04) !important;
}

.light-theme .unified-chat-item.active {
  background: rgba(0, 122, 255, 0.12) !important;
  border-color: rgba(0, 122, 255, 0.25) !important;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.08) !important;
}

.light-theme .chat-item-title {
  color: #1c1c1e !important;
}

.light-theme .chat-item-snippet {
  color: #636366 !important;
}

.light-theme .chat-item-time {
  color: #8e8e93 !important;
}

/* Chat Main Container & Headers (Desktop Glass vs Mobile Opaque) */
@media (min-width: 769px) {
  .light-theme .chat-container {
    background: rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(30px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(30px) saturate(160%) !important;
  }

  .light-theme .chat-header {
    background: rgba(255, 255, 255, 0.6) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  }

  .light-theme .chat-input-area {
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    background: rgba(255, 255, 255, 0.5) !important;
  }
}

@media (max-width: 768px) {
  .chat-container,
  #mainApp.show-chat .chat-container {
    background: #0d0e15 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .light-theme .chat-container,
  .light-theme #mainApp.show-chat .chat-container {
    background: #f5f6fa !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .light-theme .chat-header {
    background: #ffffff !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .light-theme .chat-input-area {
    background: #ffffff !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #mainApp.show-chat .sidebar {
    pointer-events: none !important;
  }
}

.light-theme .chat-input-container {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
}

.light-theme .chat-input-container:focus-within {
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.12) !important;
  border-color: #007aff !important;
}

.light-theme .chat-input-box textarea {
  color: #1c1c1e !important;
}

.light-theme .icon-btn {
  background: rgba(0, 0, 0, 0.04) !important;
  border: 1px solid rgba(0, 0, 0, 0.04) !important;
  color: #1c1c1e !important;
}

.light-theme .icon-btn:hover {
  background: rgba(0, 122, 255, 0.1) !important;
  color: #007aff !important;
}

/* Message Bubbles iMessage-style */
.light-theme .message-bubble {
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.light-theme .message-bubble:hover {
  background: #ffffff !important;
}

.light-theme .message-text {
  color: #1c1c1e !important;
}

.light-theme .message-item.self .message-bubble {
  background: linear-gradient(135deg, #007aff, #0056b3) !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.2) !important;
}

.light-theme .message-item.self .message-bubble:hover {
  background: linear-gradient(135deg, #1485ff, #0062cc) !important;
}

.light-theme .message-item.self .message-text {
  color: #ffffff !important;
}

.light-theme .message-author {
  color: #007aff !important;
}

.light-theme .message-meta-row {
  color: rgba(0, 0, 0, 0.45);
}

.light-theme .message-item.self .message-meta-row {
  color: rgba(255, 255, 255, 0.85);
}

.light-theme .message-status-check {
  color: #007aff !important;
}

.light-theme .message-item.self .message-status-check {
  color: #ffffff !important;
}

.light-theme .message-status-check.read {
  color: #30d158 !important;
}

.light-theme .message-item.self .message-status-check.read {
  color: #ffffff !important;
}

/* Call Logs in Light Mode */
.light-theme .call-log-message-bubble,
.light-theme .message-item:not(.self) .call-log-message-bubble {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  border-radius: 16px !important;
}

.light-theme .message-item:not(.self) .call-log-message-bubble:hover {
  background: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08) !important;
}

.light-theme .message-item:not(.self) .call-log-message-bubble .call-log-title,
.light-theme .message-item:not(.self) .call-log-message-bubble div[id^="msg_call_dir_"] {
  color: #1c1c1e !important;
}

.light-theme .message-item:not(.self) .call-log-message-bubble .call-log-meta,
.light-theme .message-item:not(.self) .call-log-message-bubble div[id^="msg_call_meta_"] {
  color: #636366 !important;
}

.light-theme .message-item:not(.self) .call-log-message-bubble .call-log-duration:not([style*="color"]) {
  color: #636366 !important;
}

.light-theme .message-item.self .call-log-message-bubble {
  background: linear-gradient(135deg, #007aff, #0056b3) !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.22) !important;
  border-radius: 16px !important;
}

.light-theme .message-item.self .call-log-message-bubble:hover {
  background: linear-gradient(135deg, #1485ff, #0062cc) !important;
}

.light-theme .message-item.self .call-log-message-bubble .call-log-title,
.light-theme .message-item.self .call-log-message-bubble div[id^="msg_call_dir_"] {
  color: #ffffff !important;
}

.light-theme .message-item.self .call-log-message-bubble .call-log-meta,
.light-theme .message-item.self .call-log-message-bubble div[id^="msg_call_meta_"],
.light-theme .message-item.self .call-log-message-bubble .call-log-duration {
  color: rgba(255, 255, 255, 0.85) !important;
}

.light-theme .message-item.self .call-log-message-bubble .call-log-icon {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
}

.light-theme .message-item.self .call-log-message-bubble svg {
  color: #ffffff !important;
}

/* Custom Message Cards (Calendar & Verse) */
.light-theme .message-card {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04) !important;
}

.light-theme .calendar-message-card {
  border-left: 3px solid #007aff !important;
}

.light-theme .verse-message-card {
  border-left: 3px solid #a855f7 !important;
}

/* Settings Profiles & Cards */
.light-theme .settings-profile-card,
.light-theme .settings-menu-list {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03) !important;
}

.light-theme .settings-profile-card:hover,
.light-theme .settings-menu-item:hover {
  background: rgba(0, 0, 0, 0.02) !important;
}

.light-theme .settings-search-input {
  background: rgba(0, 0, 0, 0.04) !important;
  color: #1c1c1e !important;
}

/* Dropdowns & Popovers */
.light-theme .new-chat-dropdown-menu {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08) !important;
}

.light-theme .new-chat-dropdown-menu button {
  color: #1c1c1e !important;
}

.light-theme .new-chat-dropdown-menu button:hover {
  background: rgba(0, 0, 0, 0.03) !important;
}

/* Modals */
.light-theme .modal-content {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15) !important;
  color: #1c1c1e !important;
}

.light-theme .modal-content h3,
.light-theme .modal-content h4 {
  color: #1c1c1e !important;
}

.light-theme .modal-content th {
  border-bottom: 2px solid rgba(0, 0, 0, 0.08) !important;
  color: #636366 !important;
}

.light-theme .modal-content td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  color: #1c1c1e !important;
}

.light-theme .modal-content tr:hover td {
  background: rgba(0, 0, 0, 0.02) !important;
}

.light-theme #rawDatabaseLog {
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  color: #155724 !important;
}

/* Inputs & Form Controls */
.light-theme .profile-settings-input,
.light-theme .form-control,
.light-theme .input-wrapper input {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  color: #1c1c1e !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02) !important;
}

.light-theme .profile-settings-input:focus,
.light-theme .form-control:focus,
.light-theme .input-wrapper input:focus {
  border-color: #007aff !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15) !important;
}

/* Buttons */
.light-theme .btn {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #1c1c1e !important;
}

.light-theme .btn:hover {
  background: rgba(0, 0, 0, 0.08) !important;
}

.light-theme .btn-primary {
  background: linear-gradient(135deg, #007aff, #0056b3) !important;
  color: #ffffff !important;
}

.light-theme .btn-primary:hover {
  background: linear-gradient(135deg, #1485ff, #0062cc) !important;
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2) !important;
}

.light-theme .btn-google {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  color: #1c1c1e !important;
}

.light-theme .btn-google:hover {
  background: rgba(0, 0, 0, 0.02) !important;
}

.light-theme .form-group label {
  color: #636366 !important;
}

.light-theme .auth-container {
  background: #f5f6fa !important;
}

.light-theme .auth-card {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.1) !important;
}

.light-theme .auth-logo h1 {
  background: linear-gradient(180deg, #1c1c1e 0%, #636366 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.light-theme .nav-item:hover {
  background: rgba(0, 0, 0, 0.03) !important;
  color: #1c1c1e !important;
}

/* Telegram Cards & Dialogs */
.light-theme .telegram-info-modal {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1c1c1e !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.12) !important;
}

.light-theme .telegram-avatar-circle {
  background: #ffffff !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
}

.light-theme .telegram-avatar-camera {
  border-color: #ffffff !important;
}

.light-theme .telegram-card {
  background: rgba(0, 0, 0, 0.02) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.light-theme .telegram-card-row {
  border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}

/* Admin Panel */
.light-theme #adminPanelModal {
  background: rgba(0, 0, 0, 0.25) !important;
}

.light-theme #adminPanelModal .modal-content {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
}

.light-theme .admin-tab-btn {
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  color: #636366 !important;
}

.light-theme .admin-tab-btn:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #1c1c1e !important;
}

.light-theme .admin-tab-btn.active {
  background: #007aff !important;
  color: #ffffff !important;
  border-color: #007aff !important;
}

.light-theme .admin-close-btn {
  background: rgba(0, 0, 0, 0.04) !important;
  color: #636366 !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.light-theme #adminCreateDrawer {
  background: #ffffff !important;
  border-left: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.15) !important;
}

.light-theme #adminCreateDrawer label {
  color: #636366 !important;
}

.light-theme #adminCreateDrawer input {
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
  color: #1c1c1e !important;
}

.light-theme #adminCreateDrawer input:focus {
  border-color: #007aff !important;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15) !important;
}

.light-theme .settings-menu-list {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
}

/* Call Modal Minimization (Floating PIP Window) */
#videoCallModal.minimized {
  position: fixed !important;
  inset: auto;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  width: 320px;
  height: 240px;
  min-width: 200px !important;
  min-height: 180px !important;
  max-width: 80vw !important;
  max-height: 80vh !important;
  resize: both !important;
  overflow: hidden !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 10005 !important;
  pointer-events: auto !important;
  padding: 0 !important;
  animation: none !important;
}

#videoCallModal.minimized .call-modal-content {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  background: rgba(28, 28, 30, 0.95) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#videoCallModal.minimized .video-grid {
  flex: 1 1 auto !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: auto !important;
  gap: 6px !important;
  padding: 10px !important;
  min-height: auto !important;
  max-height: none !important;
  overflow-y: auto !important;
}

#videoCallModal.minimized .video-box {
  aspect-ratio: 4 / 3 !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#videoCallModal.minimized .video-label {
  font-size: 9px !important;
  padding: 2px 5px !important;
  bottom: 4px !important;
  left: 4px !important;
}

#videoCallModal.minimized .call-controls {
  padding: 8px 12px !important;
  gap: 12px !important;
  background: rgba(18, 18, 20, 0.95) !important;
}

#videoCallModal.minimized .call-btn {
  width: 32px !important;
  height: 32px !important;
  font-size: 13px !important;
}

#minimizeCallBtn:hover {
  color: var(--accent-primary) !important;
  transform: scale(1.15);
}
#minimizeCallBtn:active {
  transform: scale(0.9);
}

/* ==========================================================================
   SAFARI NESTED BACKDROP FILTER MITIGATION
   Disables heavy background blurs when video call modals are active to prevent GPU repaint flashes.
   ========================================================================== */
body:has(#videoCallModal:not([style*="display:none"]):not([style*="display: none"])),
body:has(#incomingCallModal:not([style*="display:none"]):not([style*="display: none"])) {
  /* No backdrop-filters for background elements when calls are active */
}

body:has(#videoCallModal:not([style*="display:none"]):not([style*="display: none"])) .chat-container,
body:has(#videoCallModal:not([style*="display:none"]):not([style*="display: none"])) .sidebar,
body:has(#videoCallModal:not([style*="display:none"]):not([style*="display: none"])) .chat-header,
body:has(#incomingCallModal:not([style*="display:none"]):not([style*="display: none"])) .chat-container,
body:has(#incomingCallModal:not([style*="display:none"]):not([style*="display: none"])) .sidebar,
body:has(#incomingCallModal:not([style*="display:none"]):not([style*="display: none"])) .chat-header {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-color: #0d1117 !important;
}

#videoCallModal:not(.minimized) {
  padding: 0 !important;
  background: #111214 !important; /* Premium dark slate background */
}

#videoCallModal:not(.minimized) .call-modal-content {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  position: relative !important;
  background: #111214 !important; /* Soft slate gray */
}

#callHeader {
  position: absolute !important;
  top: 24px !important;
  left: 24px !important;
  right: 24px !important;
  background: transparent !important;
  border-bottom: none !important;
  z-index: 1000 !important;
  padding: 0 !important;
  pointer-events: none !important;
}

#callHeader > div {
  background: rgba(30, 31, 34, 0.75) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 8px 16px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: auto !important;
}

#callTimerDisplay {
  background: rgba(30, 31, 34, 0.75) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 8px 16px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: auto !important;
}

#videoCallModal, #incomingCallModal {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.85) !important;
  --text-main: #ffffff !important;
  --text-muted: rgba(255, 255, 255, 0.7) !important;
  color: #ffffff !important;
}

#videoCallModal .modal-content, #incomingCallModal .modal-content {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: #121620 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
}

/* Permanent dark theme styling for Call Modals & Participants List (Option B) */
.light-theme #videoCallModal,
.light-theme #incomingCallModal,
.light-theme #callParticipantsSidebar,
#callParticipantsSidebar {
  --text-main: #ffffff !important;
  --text-muted: rgba(255, 255, 255, 0.7) !important;
  color: #ffffff !important;
}

.light-theme #callParticipantsSidebar h4,
.light-theme #callParticipantsSidebar h4 span,
#callParticipantsSidebar h4,
#callParticipantsSidebar h4 span {
  color: #ffffff !important;
}

.light-theme #callParticipantsSidebar #closeParticipantsSidebarBtn,
#callParticipantsSidebar #closeParticipantsSidebarBtn {
  color: rgba(255, 255, 255, 0.7) !important;
}

.light-theme .participant-list-item,
.participant-list-item {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

.light-theme .participant-list-item span,
.participant-list-item span {
  color: #ffffff !important;
}


/* Full-screen glassmorphic admin panel dashboard */
#adminPanelModal {
  padding: 0 !important;
  backdrop-filter: blur(20px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(140%) !important;
  background: rgba(10, 12, 22, 0.4) !important;
}

#adminPanelModal .modal-content {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) calc(env(safe-area-inset-right, 0px) + 20px) calc(env(safe-area-inset-bottom, 0px) + 20px) calc(env(safe-area-inset-left, 0px) + 20px) !important;
  background: rgba(18, 22, 33, 0.7) !important;
  backdrop-filter: blur(35px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(35px) saturate(160%) !important;
  box-shadow: none !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

#adminUsersSection > div.admin-table-wrapper,
#adminPendingSection > div {
  max-height: calc(100vh - 210px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  height: calc(100vh - 210px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
}

/* Disable heavy background blurs when custom dialog modal is active to prevent GPU repaint flashes/lag */
body:has(#customDialogModal:not([style*="display:none"]):not([style*="display: none"])) .chat-container,
body:has(#customDialogModal:not([style*="display:none"]):not([style*="display: none"])) .sidebar,
body:has(#customDialogModal:not([style*="display:none"]):not([style*="display: none"])) .chat-header {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background-color: #0d1117 !important;
}

#customDialogModal {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: rgba(0, 0, 0, 0.65) !important;
}

#customDialogModal .modal-content {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  background: #1c222e !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6) !important;
}

/* ==========================================================================
   LINK PREVIEWS STYLING (GLASSMORPHISM)
   ========================================================================== */
.link-preview-card {
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  text-decoration: none !important;
  color: inherit !important;
  text-align: left;
  overflow: hidden;
}

.link-preview-card:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.link-preview-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.link-preview-site {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  font-weight: 700;
}

.link-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.link-preview-desc {
  font-size: 11px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  margin: 0;
}

.link-preview-image {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.02);
}

.light-theme .link-preview-card {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .link-preview-card:hover {
  background: rgba(0, 0, 0, 0.05);
}

.light-theme .link-preview-title {
  color: #1c1c1e;
}

/* ==========================================================================
   REPLIES (CYTOWANIE) & EMOJI PICKER STYLING
   ========================================================================== */
.reply-preview-bar {
  display: flex;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 14px;
  align-items: stretch;
  gap: 12px;
  animation: slideUp 0.15s ease-out;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  box-sizing: border-box;
}

.reply-preview-bar.edit-mode {
  background: rgba(88, 86, 214, 0.08);
  border-color: rgba(88, 86, 214, 0.2);
}

.reply-preview-bar.link-mode {
  background: rgba(10, 132, 255, 0.08);
  border-color: rgba(10, 132, 255, 0.2);
}

.reply-preview-bar.attachment-mode {
  background: rgba(10, 132, 255, 0.08);
  border-color: rgba(10, 132, 255, 0.25);
}

.reply-preview-border {
  width: 4px;
  background: var(--accent-primary);
  border-radius: 2px;
  flex-shrink: 0;
}

.reply-preview-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.reply-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--accent-primary);
}

.reply-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1;
  transition: color 0.15s;
}

.reply-preview-close:hover {
  color: var(--accent-danger);
}

.reply-preview-snippet {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Quote inside chat bubble */
.message-reply-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--accent-primary);
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.message-reply-preview:hover {
  background: rgba(255, 255, 255, 0.1);
}

.reply-preview-author {
  font-weight: 700;
  color: var(--accent-primary);
}

.reply-preview-text {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}

.message-item.self .message-reply-preview {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: #ffffff;
}
.message-item.self .message-reply-preview:hover {
  background: rgba(255, 255, 255, 0.2);
}
.message-item.self .reply-preview-author {
  color: #ffffff;
}
.message-item.self .reply-preview-text {
  color: rgba(255, 255, 255, 0.8);
}

/* Flash message animation when scrolling to parent */
@keyframes flashMessage {
  0% { background-color: rgba(10, 132, 255, 0.4); }
  100% { background-color: transparent; }
}

.flash-highlight {
  animation: flashMessage 1s ease-out;
  border-radius: 12px;
}

/* Emoji Popover Grid */
.chat-input-box {
  position: relative;
}

.emoji-popover-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #1c1c1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  padding: 10px;
  width: 320px;
  z-index: 100;
  animation: slideUp 0.15s ease-out;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.emoji-popover-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.emoji-picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  user-select: none;
}

.emoji-picker-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.15);
}

/* Light theme overrides */
.light-theme .reply-preview-bar {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.light-theme .reply-preview-bar.edit-mode {
  background: rgba(88, 86, 214, 0.05);
  border-color: rgba(88, 86, 214, 0.15);
}

.light-theme .reply-preview-bar.link-mode {
  background: rgba(10, 132, 255, 0.05);
  border-color: rgba(10, 132, 255, 0.15);
}

.light-theme .reply-preview-bar.attachment-mode {
  background: rgba(10, 132, 255, 0.05);
  border-color: rgba(10, 132, 255, 0.18);
}

.light-theme .message-reply-preview {
  background: rgba(0, 0, 0, 0.04);
}

.light-theme .message-reply-preview:hover {
  background: rgba(0, 0, 0, 0.07);
}

.light-theme .emoji-popover-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.light-theme .emoji-picker-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.context-emoji:hover {
  transform: scale(1.3);
}
.context-emoji:active {
  transform: scale(0.9);
}
.context-action-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}
.context-action-item:active {
  background: rgba(255, 255, 255, 0.15) !important;
}

@keyframes callPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(48, 209, 88, 0.45);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 16px rgba(48, 209, 88, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(48, 209, 88, 0);
  }
}

.incoming-call-pulse {
  margin: 10px auto 24px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(48, 209, 88, 0.12);
  border: 1px solid rgba(48, 209, 88, 0.3);
  box-shadow: 0 0 20px rgba(48, 209, 88, 0.2);
  animation: callPulse 1.8s infinite;
  color: #30d158;
}

/* ==========================================================================
   ADMIN PANEL MOBILE ENHANCEMENTS (v10.40)
   - iOS Tab Picker (Select) replacing wrapped buttons
   - Compact User Cards with top-right delete action icon
   ========================================================================== */

.admin-mobile-picker {
  display: none;
  flex: 1;
  min-width: 0;
}

.admin-mobile-picker-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.admin-mobile-select {
  width: 100%;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0 34px 0 12px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.admin-mobile-select:focus {
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.09);
}

.admin-mobile-select option {
  background: #1c222e;
  color: #fff;
  padding: 8px;
}

.admin-mobile-picker-arrow {
  position: absolute;
  right: 12px;
  pointer-events: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.action-mini-btn.delete-user-btn {
  color: var(--accent-danger);
  background: rgba(255, 69, 58, 0.1);
  border: 1px solid rgba(255, 69, 58, 0.2);
  border-radius: 8px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-mini-btn.delete-user-btn:hover {
  background: rgba(255, 69, 58, 0.2);
  border-color: rgba(255, 69, 58, 0.35);
  transform: translateY(-0.5px);
}

@media (max-width: 768px) {
  .admin-desktop-tabs {
    display: none !important;
  }
  
  .admin-mobile-picker {
    display: flex !important;
  }

  .admin-tabs-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
    flex-wrap: nowrap !important;
  }

  .admin-actions-bar {
    flex-shrink: 0 !important;
  }

  #adminOpenCreateDrawerBtn {
    padding: 0 14px !important;
    height: 40px !important;
    font-size: 12.5px !important;
    white-space: nowrap !important;
  }

  /* Admin Tables Responsive Mobile Cards (v10.44) */
  #adminUsersSection table, 
  #adminUsersSection thead, 
  #adminUsersSection tbody, 
  #adminUsersSection th, 
  #adminUsersSection td, 
  #adminUsersSection tr,
  #adminPendingSection table,
  #adminPendingSection thead,
  #adminPendingSection tbody,
  #adminPendingSection th,
  #adminPendingSection td,
  #adminPendingSection tr,
  #adminGroupsSection table,
  #adminGroupsSection thead,
  #adminGroupsSection tbody,
  #adminGroupsSection th,
  #adminGroupsSection td,
  #adminGroupsSection tr,
  #adminReportsSection table,
  #adminReportsSection thead,
  #adminReportsSection tbody,
  #adminReportsSection th,
  #adminReportsSection td,
  #adminReportsSection tr {
    display: block !important;
    width: 100% !important;
  }
  
  #adminUsersSection thead,
  #adminPendingSection thead,
  #adminGroupsSection thead,
  #adminReportsSection thead {
    display: none !important;
  }
  
  /* 1. Active Users Card (Zrzut 1 fix - spacious, comfortable, non-compressed) */
  #adminUsersSection tr {
    margin-bottom: 10px !important;
    padding: 12px 14px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    position: relative !important;
  }
  
  #adminUsersSection td {
    padding: 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    text-align: left !important;
    line-height: 1.35 !important;
  }
  
  /* User Name & Avatar */
  #adminUsersSection td:nth-child(2) {
    order: 1;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
    padding-right: 48px !important; /* Space for action button at top right */
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-bottom: 2px !important;
  }
  
  /* Role */
  #adminUsersSection td:nth-child(4) {
    order: 2;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: var(--accent-primary) !important;
    margin: 0 !important;
  }
  #adminUsersSection td:nth-child(4)::before {
    content: "Rola: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* Email */
  #adminUsersSection td:nth-child(3) {
    order: 3;
    font-size: 12px !important;
    color: var(--text-muted) !important;
    word-break: break-all !important;
    margin: 0 !important;
  }
  #adminUsersSection td:nth-child(3)::before {
    content: "E-mail: ";
    color: var(--text-dim);
    font-weight: 400;
  }
  
  /* ID */
  #adminUsersSection td:nth-child(1) {
    order: 4;
    font-size: 10.5px !important;
    color: var(--text-dim) !important;
    font-family: monospace;
    opacity: 0.8;
    margin: 0 !important;
  }
  #adminUsersSection td:nth-child(1)::before {
    content: "ID: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* Actions (Delete button) - Top right, NOT spanning 100% width! */
  #adminUsersSection td:nth-child(5) {
    order: 0;
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    left: auto !important;
    width: auto !important;
    margin: 0 !important;
    border-top: none !important;
    padding: 0 !important;
    text-align: right !important;
  }

  .action-mini-btn.delete-user-btn .delete-btn-label {
    display: none !important;
  }
  .action-mini-btn.delete-user-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    background: rgba(255, 69, 58, 0.12) !important;
    border: 1px solid rgba(255, 69, 58, 0.25) !important;
    color: #ff453a !important;
  }

  /* 2. Groups Card (Zrzut 5 fix - mobile card for channels/groups) */
  #adminGroupsSection tr {
    margin-bottom: 10px !important;
    padding: 12px 14px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    position: relative !important;
  }

  #adminGroupsSection td {
    padding: 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    text-align: left !important;
    line-height: 1.35 !important;
  }

  /* Nazwa grupy */
  #adminGroupsSection td:nth-child(2) {
    order: 1;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
    padding-right: 130px !important; /* Space for action buttons */
    margin-bottom: 2px !important;
  }

  /* Akcje (Zablokuj, Usuń) at top right */
  #adminGroupsSection td:nth-child(5) {
    order: 0;
    position: absolute !important;
    top: 10px !important;
    right: 12px !important;
    left: auto !important;
    width: auto !important;
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: right !important;
  }
  #adminGroupsSection td:nth-child(5) button {
    padding: 4px 8px !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.06) !important;
  }

  /* Opis grupy */
  #adminGroupsSection td:nth-child(3) {
    order: 2;
    font-size: 12px !important;
    color: var(--text-muted) !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
  #adminGroupsSection td:nth-child(3)::before {
    content: "Opis: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* Właściciel / Twórca */
  #adminGroupsSection td:nth-child(4) {
    order: 3;
    font-size: 11.5px !important;
    color: var(--text-muted) !important;
  }
  #adminGroupsSection td:nth-child(4)::before {
    content: "Właściciel: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* ID grupy */
  #adminGroupsSection td:nth-child(1) {
    order: 4;
    font-size: 10.5px !important;
    font-family: monospace !important;
    color: var(--text-dim) !important;
    opacity: 0.8;
  }
  #adminGroupsSection td:nth-child(1)::before {
    content: "ID: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* 3. Reports Card (Zrzut 4 fix - mobile card for user reports / moderation) */
  #adminReportsSection tr {
    margin-bottom: 12px !important;
    padding: 12px 14px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  #adminReportsSection td {
    padding: 0 !important;
    margin: 0 !important;
    border-bottom: none !important;
    text-align: left !important;
    line-height: 1.35 !important;
  }

  /* Data & Status */
  #adminReportsSection td:nth-child(1) {
    order: 1;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 11.5px !important;
    color: var(--text-muted) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding-bottom: 6px !important;
  }

  /* Zgłaszający */
  #adminReportsSection td:nth-child(2) {
    order: 2;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #fff !important;
  }
  #adminReportsSection td:nth-child(2)::before {
    content: "Zgłaszający: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* Zgłoszona treść */
  #adminReportsSection td:nth-child(3) {
    order: 3;
    font-size: 12px !important;
    color: #e2e8f0 !important;
    line-height: 1.4 !important;
    background: rgba(0, 0, 0, 0.25) !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    max-width: 100% !important;
    word-break: break-word !important;
  }

  /* Powód */
  #adminReportsSection td:nth-child(4) {
    order: 4;
    font-size: 12px !important;
    color: #ff9f0a !important;
    font-weight: 500 !important;
  }
  #adminReportsSection td:nth-child(4)::before {
    content: "Powód: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  /* Akcje */
  #adminReportsSection td:nth-child(5) {
    order: 5;
    margin-top: 4px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding-top: 8px !important;
  }
  #adminReportsSection td:nth-child(5) > div {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-end !important;
  }

  /* 4. Tech Stack Section (Zrzut 6 fix - vertical stacked columns) */
  #adminTechSection div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding-bottom: 14px !important;
  }
  #adminTechSection div[style*="grid-template-columns"] > strong {
    font-size: 13.5px !important;
    color: var(--accent-primary) !important;
  }
  #adminTechSection ul {
    padding-left: 18px !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  /* 5. Pending Approvals Card */
  #adminPendingSection tr {
    margin-bottom: 10px !important;
    padding: 12px 14px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  #adminPendingSection td:nth-child(1) {
    order: 1;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #fff !important;
  }

  #adminPendingSection td:nth-child(2) {
    order: 2;
    font-size: 12px !important;
    color: var(--text-muted) !important;
  }
  #adminPendingSection td:nth-child(2)::before {
    content: "E-mail: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  #adminPendingSection td:nth-child(3) {
    order: 3;
    font-size: 11.5px !important;
    color: var(--text-muted) !important;
  }
  #adminPendingSection td:nth-child(3)::before {
    content: "Rejestracja: ";
    color: var(--text-dim);
    font-weight: 400;
  }

  #adminPendingSection td:nth-child(4) {
    order: 4;
    text-align: right !important;
    margin-top: 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding-top: 8px !important;
    display: flex !important;
    gap: 8px !important;
    justify-content: flex-end !important;
  }

  .auth-footer-links {
    flex-direction: column !important;
    align-items: center !important;
    gap: 12px !important;
    text-align: center !important;
  }
}

/* ==========================================================================
   Verse of the Day (Werset Dnia) Custom Styles
   ========================================================================== */

.verse-card {
  margin: 0 8px 6px 8px !important;
  padding: 8px 10px !important;
  background: rgba(212, 163, 89, 0.08);
  border: 1px solid rgba(212, 163, 89, 0.22);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.light-theme .verse-card {
  background: rgba(212, 163, 89, 0.12);
  border-color: rgba(212, 163, 89, 0.30);
}

.verse-card:hover {
  background: rgba(212, 163, 89, 0.12);
  border-color: rgba(212, 163, 89, 0.35);
  transform: translateY(-1px);
}


.verse-modal-content {
  max-width: 480px;
  width: 90%;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(28, 28, 30, 0.85) !important;
  backdrop-filter: blur(40px) !important;
  -webkit-backdrop-filter: blur(40px) !important;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  padding: 28px !important;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: appleSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.verse-modal-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent-primary);
  margin-bottom: 18px;
}

.verse-modal-text {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  font-style: italic;
  color: var(--text-main);
  margin-bottom: 16px;
  font-weight: 500;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.verse-modal-ref {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.verse-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.verse-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255,255,255,0.06);
  color: var(--text-main);
  border: 1px solid rgba(255,255,255,0.08);
}

.verse-action-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.15);
}

.verse-action-btn.primary {
  background: var(--accent-primary);
  color: white;
  border: none;
}

.verse-action-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-0.5px);
}

/* ==========================================================================
   Biblical Calendar (Kalendarz Biblijny) & Moon Phase Custom Styles
   ========================================================================== */

.calendar-card {
  position: relative;
  margin: 0 8px 6px 8px !important;
  padding: 8px 10px !important;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.calendar-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.light-theme .calendar-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-theme .calendar-card:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.12);
}



.sidebar-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px !important;
}

.sidebar-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-card-title svg {
  vertical-align: middle;
}

.sidebar-card-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.calendar-card-date {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
}

.calendar-card-secular {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 0;
}

.calendar-card-moon {
  display: flex;
  align-items: center;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-main);
  font-weight: 500;
}

.moon-svg-dynamic {
  width: 17px;
  height: 17px;
  margin-right: 6px;
  transform: rotate(-15deg);
  vertical-align: middle;
}

.moon-bg {
  fill: rgba(255, 255, 255, 0.08);
}

.moon-lit {
  fill: #f5f5f7;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.5));
}

.calendar-card-badges-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 6px;
}

.calendar-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  font-size: 8.5px;
  font-weight: 700;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-card-badge.holiday {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.calendar-card-badge.new-month {
  background: rgba(10, 132, 255, 0.12);
  border: 1px solid rgba(10, 132, 255, 0.2);
  color: #0a84ff;
}

.calendar-card-share-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-card-share-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  transform: scale(1.05);
}

.calendar-card-link:hover {
  opacity: 1.0 !important;
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

/* Event Pills for special biblical days & holidays */
#biblicalCalendarCardContainer .calendar-card.calendar-event-pill,
#biblicalCalendarCardContainer .calendar-event-pill,
.calendar-card.calendar-event-pill,
.calendar-event-pill {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 12px !important;
  margin: 0 8px 6px 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  box-sizing: border-box !important;
  border-radius: var(--radius-sm) !important;
  gap: 7px !important;
  line-height: 1 !important;
  cursor: default;
}

.calendar-event-pill-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
}

.calendar-event-pill-icon svg {
  width: 11px !important;
  height: 11px !important;
  display: block !important;
}

.calendar-event-pill-text {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  transform: translateY(0.5px);
}

.calendar-card.holiday-card {
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.04);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.08);
}

.calendar-card.holiday-card:hover {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.calendar-card.new-month-card {
  border: 1px solid rgba(10, 132, 255, 0.25);
  background: rgba(10, 132, 255, 0.04);
  box-shadow: 0 4px 15px rgba(10, 132, 255, 0.08);
}

.calendar-card.new-month-card:hover {
  border-color: rgba(10, 132, 255, 0.35);
  background: rgba(10, 132, 255, 0.08);
}

/* Sidebar widgets stack container */
.widgets-stack {
  display: flex;
  flex-direction: column;
}

/* Make stack container relative when scrolled (no sticky clashing with search bar) */
.widgets-stacked .widgets-stack {
  position: relative;
  z-index: 12;
}

#verseOfTheDayCardContainer {
  position: relative;
  z-index: 2;
}

#biblicalCalendarCardContainer {
  position: relative;
  z-index: 1;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), margin-bottom 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}


/* Elegant overlapping sticky styles when scrolled */
.widgets-stacked #verseOfTheDayCardContainer .verse-card {
  background: rgba(30, 26, 20, 0.96) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-color: rgba(212, 163, 89, 0.35) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.widgets-stacked #biblicalCalendarCardContainer .calendar-card {
  background: rgba(18, 22, 28, 0.96) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-color: rgba(10, 132, 255, 0.35) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.light-theme .widgets-stacked #verseOfTheDayCardContainer .verse-card {
  background: rgba(250, 246, 238, 0.96) !important;
  border-color: rgba(212, 163, 89, 0.40) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.light-theme .widgets-stacked #biblicalCalendarCardContainer .calendar-card {
  background: rgba(240, 244, 250, 0.96) !important;
  border-color: rgba(10, 132, 255, 0.40) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}


/* Default stacked position - calendar container is translated up */
.widgets-stacked #biblicalCalendarCardContainer {
  transform: translateY(-75px);
  margin-bottom: -75px;
}

/* Hover reveal animation based on parent widgets-stack hover (100% stable!) */
.widgets-stacked .widgets-stack:hover #biblicalCalendarCardContainer {
  transform: translateY(0);
  margin-bottom: 0;
}



.widgets-stacked .widgets-stack:hover #biblicalCalendarCardContainer .calendar-card {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}








@keyframes bounceDownPwa {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(10px);
  }
  60% {
    transform: translateY(5px);
  }
}

@keyframes bounceUpPwa {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Premium Admin Panel Styles */
.admin-tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.admin-tab-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.admin-tab-btn.active-users.active {
  background: rgba(0, 122, 255, 0.12) !important;
  color: var(--accent-primary) !important;
  border-color: rgba(0, 122, 255, 0.3) !important;
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.15);
}

.admin-tab-btn.active-pending.active {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
}

.admin-tab-btn.active-create.active {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

.admin-tab-btn.active-groups.active {
  background: rgba(191, 90, 242, 0.12) !important;
  color: var(--accent-purple) !important;
  border-color: rgba(191, 90, 242, 0.3) !important;
  box-shadow: 0 4px 16px rgba(191, 90, 242, 0.15);
}

.admin-tab-btn.active-system.active {
  background: rgba(148, 163, 184, 0.12) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
  box-shadow: 0 4px 16px rgba(148, 163, 184, 0.15);
}

.admin-tab-btn.active-tech.active {
  background: rgba(6, 182, 212, 0.12) !important;
  color: #06b6d4 !important;
  border-color: rgba(6, 182, 212, 0.3) !important;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
}

.admin-close-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.admin-close-btn:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ef4444;
  transform: rotate(90deg);
}

/* Custom switch toggle */
.tevah-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.tevah-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.tevah-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #a1a1aa;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

.tevah-switch input:checked + .tevah-slider {
  background-color: rgba(0, 122, 255, 0.15);
  border-color: rgba(0, 122, 255, 0.4);
}

.tevah-switch input:checked + .tevah-slider:before {
  transform: translateX(20px);
  background-color: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

/* Custom card message bubble styling */
.message-item.self .message-bubble.custom-card-message-bubble,
.message-item:not(.self) .message-bubble.custom-card-message-bubble,
.custom-card-message-bubble {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.custom-card-message-bubble .message-meta-row {
  margin-top: 4px !important;
  padding: 0 4px !important;
}

.message-item.self .message-bubble.custom-card-message-bubble .message-meta-row {
  justify-content: flex-end !important;
}

.message-item:not(.self) .message-bubble.custom-card-message-bubble .message-meta-row {
  justify-content: flex-start !important;
}

/* Dynamic Collapsible Widgets on Scroll */
#verseOfTheDayCardContainer,
#biblicalCalendarCardContainer {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 250px;
  opacity: 1;
  transform: scale(1);
  transform-origin: top center;
  overflow: hidden;
  flex-shrink: 0;
}

.toggle-widgets-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.toggle-widgets-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  transform: translateY(-0.5px);
}

.toggle-widgets-btn:active {
  transform: translateY(0.5px);
}

/* Custom styles for message search highlighting */
.search-highlight {
  background-color: rgba(255, 235, 59, 0.35) !important;
  color: inherit !important;
  border-radius: 3px;
  padding: 1px 3px;
  box-shadow: 0 0 4px rgba(255, 235, 59, 0.2);
  transition: all 0.2s ease;
}

.search-highlight-active {
  background-color: #d4a359 !important; /* Active gold accent */
  color: #000000 !important;
  font-weight: 700;
  box-shadow: 0 0 10px #d4a359, 0 0 2px #fff;
  border-radius: 4px;
  transform: scale(1.05);
  display: inline-block;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageBubbleSearchGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 163, 89, 0.85), 0 0 24px rgba(212, 163, 89, 0.45) !important;
    border-color: rgba(212, 163, 89, 0.95) !important;
  }
  35% {
    box-shadow: 0 0 0 3px rgba(212, 163, 89, 0.4), 0 0 28px rgba(212, 163, 89, 0.6) !important;
    border-color: #d4a359 !important;
  }
  100% {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
  }
}

.message-bubble.message-search-glow {
  animation: messageBubbleSearchGlow 1.8s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Local search panel transitions */
#localChatSearchPanel {
  animation: slideDownSearch 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Call recording pulse animation */
.record-pulse {
  animation: recordPulseKey 1.5s infinite;
}

@keyframes recordPulseKey {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

/* Premium Sticky Audio Player Transitions */
.sticky-audio-player {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  height: 0;
  padding: 0 16px !important;
  overflow: hidden;
  opacity: 0;
  background: rgba(10, 132, 255, 0.12) !important;
  border-bottom: 0px solid transparent;
  gap: 12px;
  z-index: 10;
  flex-shrink: 0;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              padding 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
              border-bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.sticky-audio-player.visible {
  height: 46px;
  padding: 10px 16px !important;
  opacity: 1;
  border-bottom: 1px solid rgba(10, 132, 255, 0.25);
}

/* Context Emoji Elastic Bouncing Hover Effect */
.context-emoji {
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.context-emoji:hover {
  transform: scale(1.35) translateY(-5px);
}

.context-emoji:active {
  transform: scale(1.1) translateY(-2px);
}

/* Context Actions Micro-Shift Hover Effect */
.context-action-item {
  transition: background 0.2s, padding-left 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.context-action-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  padding-left: 20px !important;
}

/* Bottom Sheet Overlay */
.bottom-sheet-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  align-items: flex-end;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Bottom Sheet Content (Solid background depending on theme!) */
.bottom-sheet-content {
  width: 100%;
  background: #1c1c1e !important; /* Opaque solid card color for dark theme */
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 12px 16px 24px 16px;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.4);
  max-height: 85%;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Bottom Sheet Item Buttons */
.mb-sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  text-align: left;
  box-sizing: border-box;
  transition: background 0.15s ease, transform 0.1s ease;
}

.mb-sheet-item:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.98);
}

/* Bottom Sheet Cancel Button */
.mb-cancel-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: rgba(255, 59, 48, 0.15);
  border: none;
  border-radius: 12px;
  padding: 14px;
  color: #ff453a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
  transition: background 0.2s;
}

.mb-cancel-btn:active {
  background: rgba(255, 59, 48, 0.25);
}

/* Theme overrides for light theme */
body.light-theme .bottom-sheet-content {
  background: #ffffff !important;
  box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.1);
}

body.light-theme .mb-sheet-item {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.02);
  color: var(--text-main);
}

body.light-theme .mb-sheet-item:active {
  background: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   TYPING INDICATOR STYLING
   ========================================================================== */
.typing-indicator-container {
  padding: 6px 14px;
  margin: 0 20px 8px 20px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  align-self: flex-start;
  max-width: fit-content;
  pointer-events: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  animation: slideUp 0.15s ease-out;
}

.light-theme .typing-indicator-container {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

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

.typing-indicator-dots .dot {
  width: 4px;
  height: 4px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing-dots-pulse 1.4s infinite both;
}

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

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

@keyframes typing-dots-pulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.25);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .typing-indicator-container {
    margin: 0 12px 6px 12px;
  }
}

/* Skeleton Loading Animation */
@keyframes skeleton-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 0.25; }
  100% { opacity: 0.6; }
}
.skeleton-pulse {
  animation: skeleton-pulse 1.4s infinite ease-in-out;
}

/* Presentation Mode Layout when someone shares screen */
.video-grid.presentation-mode {
  display: block !important; /* Block layout allows absolute positioned presentation board */
  width: 100% !important;
  height: 100% !important;
  padding: 84px 24px 96px 24px !important; /* Proper padding matching premium design */
  box-sizing: border-box !important;
  position: relative !important;
  overflow: hidden !important;
}

#participantsRow {
  position: absolute !important;
  top: 84px !important;
  bottom: 96px !important;
  left: 24px !important;
  width: 212px !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important; /* Stack vertically on desktop */
  justify-content: flex-start !important; /* Pack tightly at the top */
  gap: 8px !important; /* Compact gap */
  overflow-y: auto !important; /* Vertical scrolling */
  overflow-x: hidden !important;
  z-index: 6 !important;
}

#participantsRow::-webkit-scrollbar {
  width: 4px;
}
#participantsRow::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

#participantsRow .video-box {
  width: 100% !important;
  height: 120px !important; /* Widescreen 16:9 sidebar cards */
  flex-shrink: 0 !important;
  margin: 0 !important; /* Clear any auto margins to stack them from the top */
}

.video-grid.presentation-mode .screen-share-box {
  position: absolute !important;
  top: 84px !important;
  bottom: 96px !important;
  left: 260px !important; /* 220px sidebar width + 24px left padding + 16px gap */
  right: 24px !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  z-index: 5 !important;
  border: 2px solid var(--accent-primary) !important;
}

/* Mobile Screen Layout */
@media (max-width: 768px) {
  .video-grid.presentation-mode {
    display: flex !important;
    flex-direction: column !important;
    padding: 72px 12px 96px 12px !important;
    overflow: hidden !important;
  }

  .video-grid.presentation-mode .screen-share-box {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    height: auto !important;
    flex: 1 1 auto !important; /* Grow to fill all available top space */
    margin-bottom: 12px !important;
  }

  #participantsRow {
    display: flex !important;
    flex-direction: row !important; /* Horizontal scroll layout on mobile */
    gap: 12px !important;
    width: 100% !important;
    height: 90px !important; /* Fixed height for participant row */
    overflow-x: auto !important; /* Horizontal scroll */
    overflow-y: hidden !important;
    flex-shrink: 0 !important;
    padding-bottom: 4px !important;
  }

  #participantsRow .video-box {
    width: 120px !important; /* Small square-ish thumbnails */
    height: 75px !important;
    flex-shrink: 0 !important;
    margin: 0 !important; /* Clear auto margins on mobile too */
  }
}

/* PREMIUM INTERACTION ANIMATIONS (v7.53) */

/* 1. Open/Close Modal Transitions */
.modal-overlay {
  animation: modalOverlayFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-overlay.modal-closing {
  animation: modalOverlayFadeOut 0.24s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.modal-overlay.modal-closing .modal-content,
.modal-overlay.modal-closing .call-modal-content {
  animation: appleModalClose 0.24s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards !important;
}

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

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

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

/* 2. Chat Feed Opening (Fade & Slide-up) */
@keyframes chatFeedLoad {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.messages-feed-animate {
  animation: chatFeedLoad 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. iMessage-style Spring Animation for Sent/Received Messages */
@keyframes springMessageOpen {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(20px);
  }
  75% {
    transform: scale(1.02) translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.message-item.new-message-animation {
  animation: springMessageOpen 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  transform-origin: bottom right;
}

.message-item.new-message-animation:not(.self) {
  transform-origin: bottom left;
}

/* 4. Smooth Deletion (Fade-out & Collapse Height) */
@keyframes deleteMessageAnim {
  0% {
    opacity: 1;
    max-height: 200px;
    margin-bottom: 6px;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    transform: scale(0.8);
  }
}

.message-item.message-deleting {
  animation: deleteMessageAnim 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  overflow: hidden;
}

/* 5. Smooth Height Collapse/Expand for Group Call Joining Banner */
.group-call-banner {
  max-height: 80px;
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              padding 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              border-bottom 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.group-call-banner.banner-hidden {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-bottom-color: transparent !important;
  pointer-events: none !important;
}

/* ==========================================================================
   THOROUGH REDESIGN - PREMIUM ENHANCEMENTS & FONT SCALE UPGRADES
   ========================================================================== */

/* 1. Large Font Scale Upgrades for High Readability */
.message-text {
  font-size: var(--message-font-size, 14.5px) !important;
  line-height: 1.45 !important;
  font-weight: 400 !important;
  letter-spacing: -0.15px !important;
}

.light-theme .message-text {
  color: #1c1c1e !important;
}

.chat-title h3 {
  font-size: 21px !important;
  font-weight: 700 !important;
}

.chat-item-title {
  font-size: var(--sidebar-title-font-size, 14px) !important;
  font-weight: 600 !important;
  letter-spacing: -0.15px !important;
}

.chat-item-snippet {
  font-size: var(--sidebar-snippet-font-size, 12px) !important;
}

.snippet-svg-icon {
  width: 13px !important;
  height: 13px !important;
  display: inline-block !important;
  vertical-align: -2px !important;
  margin-right: 4px !important;
  margin-left: 2px !important;
  flex-shrink: 0 !important;
}

/* Twemoji standardized styling */
img.emoji {
  height: 1.25em !important;
  width: 1.25em !important;
  margin: 0 0.05em 0 0.1em !important;
  vertical-align: -0.2em !important;
  display: inline-block !important;
}

.sidebar-card-title {
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
}

#verseOfTheDayCardContainer div, #biblicalCalendarCardContainer div {
  font-size: 13px !important;
  line-height: 1.45 !important;
}

/* 2. Glassmorphic Empty Chat State Card (Welcome Screen) */
#messagesFeed > div:has(img[alt="Tevah Logo"]) {
  background: rgba(30, 32, 45, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 24px !important;
  padding: 40px 30px !important;
  max-width: 440px !important;
  margin: auto !important;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  transform: translateY(0);
  animation: floatCard 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.light-theme #messagesFeed > div:has(img[alt="Tevah Logo"]) {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08) !important;
}

@keyframes floatCard {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 3. Telegram-style Message Context Menu Redesign */
#messageContextMenuOverlay {
  background: rgba(10, 12, 22, 0.4) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.context-reactions-row {
  background: rgba(30, 32, 45, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
  border-radius: 20px !important;
  padding: 10px 16px !important;
}

.context-emoji {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.context-emoji:hover {
  transform: scale(1.35) translateY(-4px) !important;
}

.context-actions-list {
  background: rgba(30, 32, 45, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  backdrop-filter: blur(25px) !important;
  -webkit-backdrop-filter: blur(25px) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
  border-radius: 16px !important;
  padding: 6px !important;
}

.context-action-item {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  border-radius: 10px !important;
}

.context-action-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  transform: translateX(4px) !important;
}

.context-action-item:hover svg {
  transform: scale(1.1) !important;
}

.context-action-item:active {
  transform: scale(0.97) !important;
}

/* Light Theme overrides for Context Menu */
.light-theme #messageContextMenuOverlay {
  background: rgba(255, 255, 255, 0.3) !important;
}

.light-theme .context-reactions-row,
.light-theme .context-actions-list {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
}

.light-theme .context-action-item:hover {
  background: rgba(0, 0, 0, 0.05) !important;
}

/* 4. Elegant Floating Media Attachments (Removes double-wrapper backgrounds) */
.message-bubble:has(.audio-msg-container),
.message-bubble:has(.message-image-thumb),
.message-bubble:has(video),
.message-bubble:has(.file-attachment-bubble),
.message-bubble:has(.message-card),
.message-item.self .message-bubble:has(.audio-msg-container),
.message-item.self .message-bubble:has(.message-image-thumb),
.message-item.self .message-bubble:has(video),
.message-item.self .message-bubble:has(.file-attachment-bubble),
.message-item.self .message-bubble:has(.message-card) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Voice note player style - Compact and Premium */
.audio-msg-container {
  width: 260px !important;
  background: rgba(30, 32, 45, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 16px !important;
  padding: 10px 14px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  margin-top: 4px;
}

.light-theme .audio-msg-container {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

/* Image attachment style - Floating with border and shadow */
.message-image-thumb {
  width: 100% !important;
  max-width: 320px !important;
  max-height: 380px !important;
  object-fit: contain !important;
  background-color: rgba(0, 0, 0, 0.25) !important;
  border-radius: 16px !important;
  border: none !important;
  box-shadow: none !important;
  display: block !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.message-image-thumb:hover {
  transform: scale(1.02) !important;
}

.light-theme .message-image-thumb {
  border: none !important;
  box-shadow: none !important;
}

/* Video attachment style - Floating with border and shadow */
.message-bubble:has(video) > div:has(video) {
  max-width: 100% !important;
  border-radius: 16px !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden;
}

.light-theme .message-bubble:has(video) > div:has(video) {
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

/* File attachment bubble (PDF/Documents) style - Telegram style */
.file-attachment-bubble {
  background: rgba(30, 32, 45, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 16px !important;
  padding: 8px 12px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  cursor: pointer !important;
  min-width: 250px !important;
  max-width: 290px !important;
  box-sizing: border-box !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
}

.file-attachment-bubble:hover {
  background: rgba(45, 45, 58, 0.75) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-0.5px) !important;
}

.file-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(10, 132, 255, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.file-icon-wrapper svg {
  width: 18px;
  height: 18px;
}

.file-info-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  overflow: hidden;
  flex: 1;
}

.file-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.file-download-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.file-attachment-bubble:hover .file-download-arrow {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.file-download-arrow svg {
  width: 14px;
  height: 14px;
}

.light-theme .file-attachment-bubble {
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
}

.light-theme .file-attachment-bubble:hover {
  background: rgba(240, 240, 245, 0.95) !important;
}

.light-theme .file-icon-wrapper {
  background: rgba(0, 122, 255, 0.1);
  color: #007aff;
}

.light-theme .file-name {
  color: #1c1c1e;
}

.light-theme .file-meta {
  color: #8e8e93;
}

.light-theme .file-download-arrow {
  background: rgba(0, 0, 0, 0.03);
  color: #8e8e93;
}

.light-theme .file-attachment-bubble:hover .file-download-arrow {
  background: rgba(0, 0, 0, 0.06);
  color: #1c1c1e;
}

.message-group {
  display: flex;
  gap: 8px;
  margin: 4px 0;
  position: relative;
}

.message-group-avatar-container {
  position: sticky;
  top: 12px;
  align-self: flex-start;
  width: 36px;
  height: 36px;
  z-index: 5;
}

.message-group-contents {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  max-width: 70%;
}
.message-group-contents .message-item {
  display: block !important;
  max-width: 100% !important;
  width: 100% !important;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.message-group-contents .message-item .msg-bubble-and-meta-wrapper {
  max-width: 100% !important;
}

/* Custom Scrollbars for Modals */
#startDmUsersList::-webkit-scrollbar,
#startCallUsersList::-webkit-scrollbar,
#newChannelFriendsList::-webkit-scrollbar {
  width: 5px;
}
#startDmUsersList::-webkit-scrollbar-track,
#startCallUsersList::-webkit-scrollbar-track,
#newChannelFriendsList::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 10px;
}
#startDmUsersList::-webkit-scrollbar-thumb,
#startCallUsersList::-webkit-scrollbar-thumb,
#newChannelFriendsList::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}
#startDmUsersList::-webkit-scrollbar-thumb:hover,
#startCallUsersList::-webkit-scrollbar-thumb:hover,
#newChannelFriendsList::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Premium Admin Tables Style */
#adminUsersTableBody tr,
#adminPendingTableBody tr,
#adminGroupsTableBody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  transition: background-color 0.2s;
}

#adminUsersTableBody tr:hover,
#adminPendingTableBody tr:hover,
#adminGroupsTableBody tr:hover {
  background: rgba(255, 255, 255, 0.02) !important;
}

@media (min-width: 769px) {
  #adminUsersTableBody td,
  #adminPendingTableBody td,
  #adminGroupsTableBody td {
    padding: 12px 10px !important;
    vertical-align: middle;
  }
}

#adminPanelModal table thead tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: var(--text-muted) !important;
}

#adminPanelModal table thead th {
  padding: 10px 10px !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.8px;
}

#galleryContentArea::-webkit-scrollbar,
.admin-table-wrapper::-webkit-scrollbar,
#adminCreateUserForm::-webkit-scrollbar {
  width: 5px;
}

#galleryContentArea::-webkit-scrollbar-track,
.admin-table-wrapper::-webkit-scrollbar-track,
#adminCreateUserForm::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 10px;
}

#galleryContentArea::-webkit-scrollbar-thumb,
.admin-table-wrapper::-webkit-scrollbar-thumb,
#adminCreateUserForm::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

#galleryContentArea::-webkit-scrollbar-thumb:hover,
.admin-table-wrapper::-webkit-scrollbar-thumb:hover,
#adminCreateUserForm::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* PREMIUM RIGHT-SIDE DRAWERS (v2.12) */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  z-index: 10005;
  animation: modalOverlayFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.drawer-overlay.modal-closing {
  animation: modalOverlayFadeOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.drawer-content {
  background: rgba(28, 28, 30, 0.65) !important;
  backdrop-filter: blur(40px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(160%) !important;
  border: none !important;
  border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.45) !important;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 100vh !important;
  box-sizing: border-box;
  padding: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-radius: 24px 0 0 24px !important;
  transform: translateX(0);
  animation: drawerSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.drawer-overlay.modal-closing .drawer-content {
  animation: drawerSlideOut 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Light Theme Drawer Overrides */
.light-theme .drawer-overlay {
  background: rgba(230, 230, 235, 0.4);
}
.light-theme .drawer-content {
  background: rgba(255, 255, 255, 0.65) !important;
  border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.08) !important;
  color: var(--text-main);
}

@keyframes drawerSlideIn {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes drawerSlideOut {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

.drawer-lg {
  max-width: 780px !important;
}

@media (max-width: 768px) {
  .drawer-content {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    border-left: none !important;
    padding: calc(env(safe-area-inset-top) + 20px) 20px 20px 20px !important;
  }
}

/* Premium Drawer Form & Layout Rules */
.drawer-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 14px;
  flex-shrink: 0;
  position: sticky;
  top: -30px;
  margin-top: -30px;
  padding-top: 30px;
  margin-left: -30px;
  margin-right: -30px;
  padding-left: 30px;
  padding-right: 30px;
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
}

.telegram-info-modal .drawer-header {
  top: -24px;
  margin-top: -24px;
  padding-top: 24px;
  background: rgba(30, 30, 38, 0.95);
}

.light-theme .drawer-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.95);
}

.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.light-theme .drawer-title {
  color: var(--text-main);
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
}

.drawer-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.light-theme .drawer-close-btn {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #666;
}

.light-theme .drawer-close-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #111;
}

.drawer-label {
  font-size: 9.5px;
  color: var(--text-muted);
  display: block;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.drawer-input {
  width: 100% !important;
  height: 40px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  border-radius: 12px !important;
  padding: 0 14px !important;
  font-size: 13.5px !important;
  color: #fff !important;
  box-sizing: border-box !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.drawer-input:focus {
  border-color: var(--accent-primary) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15) !important;
}

.light-theme .drawer-input {
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid rgba(0, 0, 0, 0.06) !important;
  color: var(--text-main) !important;
}

.light-theme .drawer-input:focus {
  background: rgba(0, 0, 0, 0.05) !important;
}

.drawer-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.drawer-list::-webkit-scrollbar {
  width: 4px;
}

.drawer-list::-webkit-scrollbar-track {
  background: transparent;
}

.drawer-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.drawer-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: sticky;
  bottom: -30px;
  margin-bottom: -30px;
  padding-bottom: 30px;
  margin-left: -30px;
  margin-right: -30px;
  padding-left: 30px;
  padding-right: 30px;
  background: rgba(28, 28, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
}

.telegram-info-modal .drawer-footer {
  bottom: -24px;
  margin-bottom: -24px;
  padding-bottom: 24px;
  background: rgba(30, 30, 38, 0.95);
}

.light-theme .drawer-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.95);
}

#messagesFeed.feed-transitioning {
  opacity: 0.82;
  transition: opacity 0.12s ease-out;
  pointer-events: none;
}

.unread-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  position: relative;
  width: 100%;
}
.unread-separator::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 59, 48, 0.35);
  z-index: 1;
}
.unread-separator-text {
  background: var(--bg-main, #1e1e24);
  color: var(--accent-red, #ff3b30);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 59, 48, 0.2);
}
.light-theme .unread-separator-text {
  background: #ffffff;
}

#videoCallModal.minimized #callParticipantsSidebar {
  display: none !important;
}

/* Mobile Call View Optimizations (v9.75) */
@media (max-width: 480px) {
  /* 1. Header Cleanup */
  #callHeader {
    top: calc(env(safe-area-inset-top) + 8px) !important;
    left: 8px !important;
    right: 8px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  #callHeader > div {
    background: rgba(30, 31, 34, 0.75) !important;
    backdrop-filter: blur(12px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
    padding: 6px 12px !important;
    border-radius: 16px !important;
    gap: 8px !important;
    max-width: 55% !important;
  }

  #callTimerDisplay {
    background: rgba(30, 31, 34, 0.75) !important;
    backdrop-filter: blur(12px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
    padding: 6px 12px !important;
    border-radius: 16px !important;
    font-size: 13px !important;
  }

  #callModalTitle {
    font-size: 13px !important;
    max-width: 90px !important;
  }

  /* 2. Controls Toolbar Cleanup */
  .call-controls {
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    border-radius: 30px !important;
    max-width: calc(100% - 24px) !important;
    justify-content: center !important;
  }

  .call-btn {
    width: 42px !important;
    height: 42px !important;
  }

  .call-btn svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Hide screen share on mobile devices to save space (not supported on iOS Safari anyway) */
  #shareScreenBtn {
    display: none !important;
  }

  /* 3. Responsive Video Grid padding */
  .video-grid {
    padding: calc(env(safe-area-inset-top) + 72px) 12px calc(env(safe-area-inset-bottom) + 90px) 12px !important;
    gap: 8px !important;
  }

  /* 4. Bottom Sheet style for Participants Sidebar */
  #callParticipantsSidebar {
    position: absolute !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 75vh !important;
    max-height: 75vh !important;
    z-index: 1100 !important;
    border-left: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-top-left-radius: 24px !important;
    border-top-right-radius: 24px !important;
    background: rgba(18, 20, 24, 0.95) !important;
    backdrop-filter: blur(25px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(160%) !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6) !important;
    transition: transform 0.3s cubic-bezier(0.1, 0.76, 0.55, 0.94) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  #callParticipantsSidebar[style*="width: 0px"] {
    transform: translateY(100%) !important;
    pointer-events: none !important;
  }

  #callParticipantsSidebar:not([style*="width: 0px"]) {
    transform: translateY(0) !important;
    pointer-events: auto !important;
  }

  #callParticipantsSidebar > div:first-child {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 20px 24px 16px 24px !important;
  }
}

/* Desktop & Mobile Call Interface Segregation (v9.77) */
@media (max-width: 480px) {
  .desktop-only-controls-pill {
    display: none !important;
  }
}

@media (min-width: 481px) {
  #callHeader > div:last-child {
    display: none !important;
  }
  
  .desktop-only-controls-pill button {
    transition: all 0.2s ease !important;
  }

  .desktop-only-controls-pill button:hover {
    color: var(--accent-primary) !important;
    transform: scale(1.1) !important;
  }

  .desktop-only-controls-pill button:active {
    transform: scale(0.9) !important;
  }
}

/* Docked Call Bar (v9.81) */
.docked-call-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  cursor: pointer;
  background: rgba(28, 28, 30, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  z-index: 99;
  box-sizing: border-box;
}

.docked-call-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.docked-call-timer {
  font-family: monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-primary);
}

.docked-call-status {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.docked-call-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.docked-call-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.docked-call-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.docked-call-btn.end-call {
  background: #ff453a !important;
  border: none !important;
  color: #fff !important;
}

.docked-call-btn.end-call:hover {
  background: #ff3b30 !important;
}

/* Responsive Docked Call Bar and Safe Area padding */
@media (max-width: 768px) {
  .chat-input-area {
    padding: 6px 20px 18px 20px !important;
  }
  .sidebar-bottom-nav {
    padding-bottom: 18px !important;
    min-height: 68px !important;
  }
  .docked-call-bar {
    padding: 0 10px;
    height: 56px !important;
  }
  .docked-call-btn {
    width: 44px !important;
    height: 44px !important;
  }
  .docked-call-btn svg {
    width: 18px !important;
    height: 18px !important;
  }
  .docked-call-status {
    display: none; /* Hide text label on mobile to save space */
  }
  #dockedMaximizeBtn {
    display: none !important;
  }
  .desktop-only {
    display: none !important;
  }

  /* 1. Header Cleanup - Zjednoczenie w jeden pasek */
  #callHeader {
    top: calc(env(safe-area-inset-top) + 8px) !important;
    left: 10px !important;
    right: 10px !important;
    height: 54px !important;
    background: rgba(30, 31, 34, 0.75) !important;
    backdrop-filter: blur(12px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
    border-radius: 27px !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 0 16px !important;
    position: absolute !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    box-sizing: border-box !important;
    width: auto !important;
  }

  #callHeader > div {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    gap: 12px !important;
    max-width: none !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
  }

  #callModalTitle {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
    max-width: 110px !important;
  }

  /* Kapsuła stopera z akcentem */
  #callTimerDisplay {
    background: rgba(10, 132, 255, 0.12) !important;
    border: 1px solid rgba(10, 132, 255, 0.3) !important;
    color: #0a84ff !important;
    padding: 6px 12px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 28px !important;
    box-sizing: border-box !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  #callHeader button {
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: rgba(255, 255, 255, 0.7) !important;
  }

  #callHeader button svg {
    width: 18px !important;
    height: 18px !important;
  }
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* ==========================================================================
   NATIVE PLATFORM (CAPACITOR / iOS / ANDROID) SAFE AREA OPTIMIZATIONS
   Strictly scoped to .platform-native to ensure PWA layout remains 100% untouched
   ========================================================================== */
.platform-native .sidebar-header,
body.platform-native .sidebar-header,
html.platform-native .sidebar-header {
  height: calc(68px + env(safe-area-inset-top, 0px)) !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-bottom: 0 !important;
  padding-left: calc(20px + env(safe-area-inset-left, 0px)) !important;
  padding-right: calc(20px + env(safe-area-inset-right, 0px)) !important;
  box-sizing: border-box !important;
}

.platform-native .chat-header,
body.platform-native .chat-header,
html.platform-native .chat-header {
  height: calc(68px + env(safe-area-inset-top, 0px)) !important;
  padding-top: env(safe-area-inset-top, 0px) !important;
  padding-bottom: 0 !important;
  padding-left: calc(16px + env(safe-area-inset-left, 0px)) !important;
  padding-right: calc(16px + env(safe-area-inset-right, 0px)) !important;
  box-sizing: border-box !important;
}

.platform-native #connectionStatusBanner,
body.platform-native #connectionStatusBanner,
html.platform-native #connectionStatusBanner {
  top: calc(12px + env(safe-area-inset-top, 0px)) !important;
}

.platform-native .auth-container,
body.platform-native .auth-container,
html.platform-native .auth-container {
  padding-top: calc(20px + env(safe-area-inset-top, 0px)) !important;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
}

.platform-native #adminPanelModal .modal-content,
body.platform-native #adminPanelModal .modal-content,
html.platform-native #adminPanelModal .modal-content {
  padding-top: calc(env(safe-area-inset-top, 0px) + 24px) !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px) !important;
  padding-left: calc(env(safe-area-inset-left, 0px) + 20px) !important;
  padding-right: calc(env(safe-area-inset-right, 0px) + 20px) !important;
  box-sizing: border-box !important;
}

.platform-native #adminUsersSection > div.admin-table-wrapper,
.platform-native #adminPendingSection > div {
  max-height: calc(100vh - 230px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  height: calc(100vh - 230px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
}

/* macOS Drag Region for window title bar movement */
.sidebar-header,
.chat-header {
  -webkit-app-region: drag;
}

button, input, select, textarea, a, .icon-btn, .clickable, .new-chat-dropdown-container, .sidebar-header-right, #newChatMenuBtn, #chatHeaderMoreBtn {
  -webkit-app-region: no-drag;
}

/* Chat Drag & Drop Overlay */
.chat-drag-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  box-sizing: border-box;
  pointer-events: none;
  animation: fadeIn 0.15s ease-out;
}

.light-theme .chat-drag-overlay {
  background: rgba(240, 243, 248, 0.88);
}

.chat-drag-box {
  border: 2px dashed var(--accent-primary, #0a84ff);
  background: rgba(10, 132, 255, 0.08);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary, #0a84ff);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.light-theme .chat-drag-box {
  background: rgba(10, 132, 255, 0.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}


