/* WhatsApp Dashboard - Matching CJC Website Style */
:root {
  --primary-color: #5c4f8c;
  --secondary-color: #a292dd;
  --accent-color: #c4e1dd;
  --light-purple: #e8e3f7;
  --dark-purple: #4a3f70;
  --text-light: #f3f3f3;
  --text-dark: #333333;
  --bg-light: #ffffff;
  --bg-dark: #f9f9f9;
  --bg-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  --transition: all 0.3s ease;
  --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.2);
  --border-radius: 8px;
  --success-color: #25d366;
  --error-color: #ff4d4d;
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Top Navigation Bar */
.topbar {
  background: var(--bg-gradient);
  color: white;
  padding: 15px 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 0 0 auto;
}

.topbar-main-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.topbar-main-actions .search-box {
  max-width: 400px;
  margin: 0 auto;
}

.topbar-right-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.user-info {
  font-size: 0.9rem;
  opacity: 0.9;
  white-space: nowrap;
}

.topbar h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.topbar .logout {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.topbar .logout:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.topbar a:not(.logout) {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.15);
  transition: var(--transition);
}

.topbar a:not(.logout):hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
}

.dashboard-header h2 {
  color: var(--primary-color);
  font-size: 2rem;
  font-weight: 700;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 300px;
  min-width: 150px;
}

.search-box input {
  width: 100%;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  font-size: 0.9rem;
  transition: var(--transition);
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-box input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.search-box::after {
  content: '🔍';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Client List */
.client-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.client-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.client-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--bg-gradient);
  transform: scaleY(0);
  transition: var(--transition);
}

.client-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-color);
}

.client-card:hover::before {
  transform: scaleY(1);
}

.client-card.active {
  border-color: var(--primary-color);
  background: var(--light-purple);
}

.client-card.active::before {
  transform: scaleY(1);
}

/* Red border for conversations with notes */
.client-card.has-note {
  border: 2px solid #ff4444;
  border-left: 4px solid #ff4444;
}

.client-card.has-note::before {
  background: #ff4444;
  transform: scaleY(1);
}

.client-number {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.client-number::before {
  content: '📱';
  font-size: 1.5rem;
}

.client-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.9rem;
  color: #666;
}

.client-last-message {
  color: #888;
  font-size: 0.85rem;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-time {
  color: #999;
  font-size: 0.8rem;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.empty-state::before {
  content: '💬';
  font-size: 4rem;
  display: block;
  margin-bottom: 20px;
}

.empty-state h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  background: var(--bg-gradient);
  color: white;
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header .back-btn {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.2);
  transition: var(--transition);
  font-weight: 500;
}

.chat-header .back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f0f2f5;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.message {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  animation: slideIn 0.3s ease;
  position: relative;
  /* Fix for absolute positioning of actions */
  overflow: visible;
  /* Allow actions to float outside */
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.incoming {
  align-self: flex-start;
}

.message.outgoing {
  align-self: flex-end;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.incoming .message-bubble {
  background: white;
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
}

.message.outgoing .message-bubble {
  background: var(--bg-gradient);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding: 0 4px;
  gap: 8px;
}

.message-time {
  font-size: 0.7rem;
  color: #999;
}

.message.incoming .message-time {
  text-align: left;
}

.message.outgoing .message-time {
  color: rgba(0, 0, 0, 0.6);
}

.message-status-container {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* Media Message Styles */
.message-media {
  margin: 0;
  padding: 0;
}

.message-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}

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

.message-video {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  display: block;
}

.message-audio {
  width: 100%;
  max-width: 300px;
  margin: 8px 0;
}

.message-document {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s ease;
  margin: 8px 0;
}

.message.incoming .message-document {
  background: rgba(0, 0, 0, 0.05);
}

.message.outgoing .message-document {
  background: rgba(255, 255, 255, 0.2);
}

.message-document:hover {
  background: rgba(0, 0, 0, 0.1);
}

.message.outgoing .message-document:hover {
  background: rgba(255, 255, 255, 0.3);
}

.message-sticker {
  max-width: 200px;
  border-radius: 8px;
  display: block;
}

.message-caption {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  line-height: 1.4;
}

.message.outgoing .message-caption {
  border-top-color: rgba(255, 255, 255, 0.3);
}

.message-text {
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* Send Box */
.send-box {
  padding: 15px 20px;
  background: white;
  border-top: 1px solid #eee;
  display: flex;
  align-items: flex-end;
  /* Align to bottom for multi-line */
  gap: 10px;
}

.send-box textarea {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s;
  min-height: 24px;
  max-height: 150px;
  /* Limit max height */
  line-height: 1.5;
}

.send-box textarea:focus {
  border-color: var(--primary-color);
}

/* Message Actions */
/* Message Actions */
.message-actions {
  display: flex;
  gap: 5px;
  opacity: 0;
  /* Hidden by default on desktop */
  transition: opacity 0.2s;
  margin: 0 8px;
}

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

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 5px;
  color: #999;
  transition: all 0.2s;
}

.action-btn:hover {
  transform: scale(1.2);
  color: var(--primary-color);
}

.action-btn.delete:hover {
  color: var(--error-color);
}

/* Utility Classes */
.mobile-only {
  display: none !important;
}

#mobile-logout-btn,
#mobile-logout-btn-chat {
  display: none !important;
}

/* Chat Actions Desktop */
.chat-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Mobile Support */
@media (max-width: 768px) {

  /* Force mobile-only elements to show */
  .mobile-only {
    display: block !important;
    margin-top: auto;
    /* Push to bottom */
    text-align: center;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 8px;
    color: white;
    text-decoration: none;
  }

  /* Header Layout Optimization */
  .topbar-main-row {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    gap: 0 !important;
    margin-bottom: 0;
    width: 100%;
  }

  .topbar-left {
    flex: 0 0 auto;
    margin-right: 10px;
  }

  .topbar-left h1 {
    display: none;
    /* Hide title on mobile */
  }

  .topbar-left .logo-img {
    height: 32px;
    display: block;
  }

  .user-info {
    display: none;
    /* Hide user info on mobile */
  }

  .topbar-main-actions {
    flex: 1;
    min-width: 0;
    /* Allow shrinking */
    margin-right: 10px;
  }

  .search-box {
    max-width: 100%;
    width: 100%;
    margin: 0;
  }

  .search-box input {
    width: 100%;
    min-width: 0;
  }

  .topbar-right-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0;
  }

  .burger-menu-btn {
    display: block !important;
    z-index: 1002;
    position: relative;
    margin: 0;
    padding: 8px;
    line-height: 1;
    height: auto;
  }

  .desktop-only {
    display: none !important;
  }

  /* Removed duplicate .mobile-only definition */

  /* Side Drawer Style - Mobile Optimized */
  .topbar-actions,
  .chat-actions {
    display: none;
    /* Hidden by default */
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: 70vw;
    max-width: 280px;
    height: 100vh;
    background: #6b5b95 !important;
    /* Bright purple - force override */
    padding: 80px 20px 100px 20px !important;
    /* Extra bottom padding for logout */
    z-index: 999999 !important;
    /* HIGHER than overlay */
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .topbar-actions.active,
  .chat-actions.active {
    display: flex !important;
  }

  /* Overlay when menu is open - MUST be below menu */
  .menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998 !important;
    /* LOWER than menu */
    pointer-events: auto;
    /* Can click to close */
  }

  .menu-overlay.active {
    display: block;
  }

  /* Mobile-optimized buttons */
  .topbar-actions .topbar-btn,
  .chat-actions .chat-header-btn {
    display: block !important;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    margin-bottom: 10px;
    padding: 16px 15px !important;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer !important;
    position: relative;
    z-index: 2;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.3);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    min-height: 48px;
  }

  /* Logout button special styling */
  .logout-btn-mobile {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    text-align: left !important;
    margin: 20px 0 10px 0 !important;
    padding: 16px 15px !important;
    background: rgba(255, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 10px;
    font-weight: 600;
    color: white !important;
    cursor: pointer !important;
    position: relative;
    z-index: 2;
  }

  .topbar-actions .topbar-btn:active,
  .chat-actions .chat-header-btn:active,
  .logout-btn-mobile:active {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(0.98);
  }

  .message-actions {
    position: static;
    /* Flow naturally */
    transform: none;
    display: flex;
    /* Always visible on mobile */
    background: none;
    box-shadow: none;
    padding: 0;
    margin-top: 5px;
    opacity: 0.8;
  }

  .message.incoming .message-actions {
    margin-left: 4px;
    justify-content: flex-start;
  }

  .message.outgoing .message-actions {
    margin-right: 4px;
    justify-content: flex-end;
  }

  .action-btn {
    font-size: 1rem;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.5);
    /* Slight background for visibility */
  }

  .message.outgoing .action-btn {
    background: rgba(255, 255, 255, 0.2);
    /* For dark background */
    color: white;
  }

  /* Mobile Modal Fixes */
  .modal {
    max-width: 95vw !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    padding: 20px !important;
  }

  .modal-body {
    max-height: 60vh !important;
    overflow-y: auto !important;
  }

  /* Make tables and charts scrollable on mobile */
  .modal table,
  .modal .chart-container {
    overflow-x: auto;
    display: block;
    max-width: 100%;
  }
}

/* Burger Menu Button - Default Hidden */
.burger-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px;
  margin-right: 10px;
  transition: transform 0.2s;
}

.burger-menu-btn:active {
  transform: scale(0.9);
}

/* Edited indicator */
.edited-label {
  font-size: 0.7rem;
  opacity: 0.6;
  font-style: italic;
  margin-left: 5px;
}

#send-btn {
  background: var(--bg-gradient);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(92, 79, 140, 0.3);
}

#send-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(92, 79, 140, 0.4);
}

#send-btn:active:not(:disabled) {
  transform: translateY(0);
}

#send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading Spinner */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--primary-color);
}

.spinner {
  border: 3px solid var(--light-purple);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* Status Indicators */
.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 8px;
}

.status-indicator.online {
  background: var(--success-color);
}

.status-indicator.offline {
  background: #ccc;
}

/* New Chat Button */
.new-chat-btn {
  background: var(--bg-gradient);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(92, 79, 140, 0.3);
  white-space: nowrap;
}

.new-chat-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(92, 79, 140, 0.4);
}

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

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal {
  background: white;
  border-radius: var(--border-radius);
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-hover);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  color: var(--primary-color);
  font-size: 1.5rem;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--light-purple);
  color: var(--primary-color);
}

.modal-body {
  margin-bottom: 20px;
}

.modal-body label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-dark);
  font-weight: 500;
}

.modal-body input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--light-purple);
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
}

.modal-body input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(92, 79, 140, 0.1);
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.modal-btn-primary {
  background: var(--bg-gradient);
  color: white;
}

.modal-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(92, 79, 140, 0.3);
}

.modal-btn-secondary {
  background: var(--light-purple);
  color: var(--primary-color);
}

.modal-btn-secondary:hover {
  background: var(--secondary-color);
  color: white;
}

/* Activity Sidebar */
.activity-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.activity-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.activity-card h3 {
  color: var(--primary-color);
  font-size: 1.1rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.online-users,
.recent-activities,
.login-history {
  max-height: 300px;
  overflow-y: auto;
}

.online-user-item,
.activity-item,
.session-item {
  padding: 10px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.online-user-item:last-child,
.activity-item:last-child,
.session-item:last-child {
  border-bottom: none;
}

.online-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success-color);
  flex-shrink: 0;
}

.user-name {
  font-weight: 500;
  color: var(--text-dark);
  flex: 1;
}

.user-email {
  font-size: 0.85rem;
  color: #666;
}

.activity-time,
.session-time {
  font-size: 0.8rem;
  color: #999;
  white-space: nowrap;
}

.activity-type {
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--light-purple);
  color: var(--primary-color);
  font-weight: 500;
}

.activity-type.chat {
  background: #e3f2fd;
  color: #1976d2;
}

.activity-type.message {
  background: #e8f5e9;
  color: #388e3c;
}

.empty-activity {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 0.9rem;
}

/* Notification System */
.notification-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.notification {
  background: white;
  border-radius: var(--border-radius);
  padding: 15px 20px;
  box-shadow: var(--shadow-hover);
  display: flex;
  align-items: center;
  gap: 15px;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--primary-color);
}

.notification.success {
  border-left-color: var(--success-color);
}

.notification.error {
  border-left-color: var(--error-color);
}

.notification.info {
  border-left-color: var(--primary-color);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.notification-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
}

.notification-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.notification-message {
  font-size: 0.9rem;
  color: #666;
}

.notification-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.notification-close:hover {
  background: #f0f0f0;
  color: var(--text-dark);
}

/* Bulk Actions */
.client-card.selected {
  border: 3px solid var(--primary-color);
  background: var(--light-purple);
}

.bulk-actions-bar {
  background: var(--bg-gradient);
  color: white;
  padding: 15px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

/* Message Status Indicators */
.message-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  opacity: 0.8;
  font-family: monospace;
  letter-spacing: -1px;
  white-space: nowrap;
}

.message-status.sent {
  color: #999;
}

.message-status.delivered {
  color: #4CAF50;
}

.message-status.read {
  color: #2196F3;
}

.message-status.failed {
  color: var(--error-color);
}

.message-status-time {
  font-size: 0.65rem;
  opacity: 0.7;
  color: #666;
  margin-left: 4px;
  display: none;
  /* Hidden by default, shown when status.timestamp is available */
  white-space: nowrap;
}

.message-failed {
  opacity: 0.8;
}

.message-bubble.failed {
  background: #ffebee !important;
  border: 1px solid var(--error-color);
}

/* Blinking animation for new messages */
.client-card.new-message {
  animation: blink 1.5s infinite;
  border: 2px solid var(--success-color) !important;
}

@keyframes blink {

  0%,
  100% {
    background: white;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  }

  50% {
    background: #e8f5e9;
    box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.3);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.client-card.new-message::before {
  background: var(--success-color) !important;
  transform: scaleY(1) !important;
}

/* Archive button */
.archive-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  padding: 5px 10px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-dark);
  opacity: 0;
  transition: var(--transition);
}

.client-card:hover .archive-btn {
  opacity: 1;
}

.archive-btn:hover {
  background: var(--light-purple);
  color: var(--primary-color);
}

/* Topbar buttons */
.topbar-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.topbar-btn.primary-action {
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.topbar-btn.primary-action:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Dropdown Menu */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-hover);
  min-width: 200px;
  z-index: 1000;
  padding: 5px 0;
  margin-top: 5px;
}

.dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 20px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-dark);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border-radius: 0;
}

.dropdown-item:hover {
  background: var(--light-purple);
  color: var(--primary-color);
}

.dropdown-menu hr {
  margin: 5px 0;
  border: none;
  border-top: 1px solid #eee;
}

.topbar .search-box {
  max-width: 250px;
}

.topbar .search-box input {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.topbar .search-box input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.topbar .search-box input:focus {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  outline: none;
}

/* Note indicator */
.note-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent-color);
  color: var(--text-dark);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.note-indicator:hover {
  transform: scale(1.1);
  background: var(--secondary-color);
  color: white;
}

/* Required keywords badge */
.required-keyword-badge {
  display: inline-block;
  background: #ff9800;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  margin-left: 5px;
  font-weight: 500;
}

@media (max-width: 1024px) {
  .container>div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .topbar {
    padding: 10px 15px;
  }

  .topbar-left {
    margin-bottom: 10px;
  }

  .topbar h1 {
    font-size: 1.1rem;
  }

  .logo-img {
    height: 30px;
  }

  .topbar-main-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-main-actions {
    width: 100%;
    flex-wrap: wrap;
    order: 2;
  }

  .topbar-right-actions {
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }

  .search-box {
    flex: 1;
    min-width: 150px;
  }

  .user-info {
    font-size: 0.8rem;
    display: none;
    /* Hide on very small screens */
  }

  .topbar-actions {
    width: 100%;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
  }

  .topbar-actions::-webkit-scrollbar {
    height: 4px;
  }

  .topbar-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .dashboard-header>div {
    flex-direction: column;
    align-items: stretch;
  }

  .client-list {
    grid-template-columns: 1fr;
  }

  .chat-container {
    height: calc(100vh - 60px);
    border-radius: 0;
  }

  .chat-header {
    padding: 10px 15px;
    flex-wrap: wrap;
  }

  .chat-header-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  .message {
    max-width: 85%;
  }

  .send-box {
    padding: 10px;
  }

  .send-box input {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .topbar h1 {
    font-size: 0.95rem;
  }

  .topbar-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
  }

  .chat-header-btn {
    font-size: 0.7rem;
    padding: 4px 8px;
  }
}

/* Scrollbar Styling */
.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.messages::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: var(--dark-purple);
}

/* Notification Badge */
.badge {
  display: inline-block;
  background: var(--error-color);
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 0.7rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
  border: 2px solid var(--primary-color);
}

/* Chat Header Buttons */
.chat-header-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Assignment & Tag Badges */
.assignment-badge {
  display: inline-block;
  background: #e3f2fd;
  color: #1976d2;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 8px;
  vertical-align: middle;
}

.tag-badge {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 2px 4px 2px 0;
}

.tags-container {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.client-card.assigned {
  border-left: 3px solid #1976d2;
}

.bulk-checkbox {
  cursor: pointer;
  width: 18px;
  height: 18px;
}