/* VINTEL MED ENTERPRSIES CSS*/

/* 1. FONT IMPORT & CSS VARIABLES */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Color Palette from New Logo */
  --primary-green: #00897B; 
  --primary-green-dark: #00695C;
  --accent-gold: #FFCA28;   
  
  /* UI Colors */
  --background-main: #F4F5F7; 
  --surface-card: #FFFFFF;    
  --border-color: #E5E7EB;     
  
  /* Text Colors */
  --text-primary: #1F2937;    
  --text-secondary: #6B7280;   
  --text-on-primary: #FFFFFF;  

  /* System Colors */
  --system-success: #16A34A;
  --system-warning: #F59E0B;
  --system-danger: #DC2626;

  /* Font & Spacing */
  --font-main: 'Inter', sans-serif;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* 2. BASE & GENERAL STYLES */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body { 
  font-family: var(--font-main); 
  background-color: var(--background-main); 
  color: var(--text-primary); 
  -webkit-font-smoothing: antialiased;
  /* Touch and scroll improvements for tablets/mobile */
  touch-action: manipulation;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

/* 3. NAVBAR DROPDOWN POSITIONING FIXES */
/* Ensure navbar has proper positioning context */
.navbar {
  position: relative !important;
  z-index: 1030 !important;
}

.navbar-nav-right {
  position: relative !important;
  z-index: 1031 !important;
}

/* Profile dropdown positioning fixes */
.nav-item.dropdown {
  position: relative !important;
}

.profile-dropdown-toggle {
  position: relative !important;
  z-index: 1032 !important;
  min-height: 44px !important;
  min-width: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0.5rem !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
  border: none !important;
  text-decoration: none !important;
}

.profile-dropdown-toggle:hover,
.profile-dropdown-toggle:focus {
  background-color: rgba(0, 137, 123, 0.1) !important;
  outline: none !important;
}

.profile-dropdown-toggle img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}

/* Profile dropdown menu positioning */
.nav-item.dropdown .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  left: auto !important;
  transform: none !important;
  margin-top: 0.5rem !important;
  min-width: 200px !important;
  max-width: 280px !important;
  z-index: 1050 !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  background: white !important;
}

/* Notification dropdown positioning fixes */
#notificationDropdown {
  position: relative !important;
  z-index: 1032 !important;
  min-height: 44px !important;
  min-width: 44px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0.5rem !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
  border: none !important;
  text-decoration: none !important;
  font-size: 1.2rem !important;
}

#notificationDropdown:hover,
#notificationDropdown:focus {
  background-color: rgba(0, 137, 123, 0.1) !important;
  outline: none !important;
}

/* Notification dropdown menu positioning */
#notificationDropdown + .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  left: auto !important;
  transform: none !important;
  margin-top: 0.5rem !important;
  width: 350px !important;
  max-width: 90vw !important;
  max-height: 400px !important;
  z-index: 1051 !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  background: white !important;
  overflow-y: auto !important;
}

/* Notification badge positioning */
#notification-badge {
  position: absolute !important;
  top: -2px !important;
  right: -2px !important;
  font-size: 0.6rem !important;
  padding: 0.2rem 0.4rem !important;
  min-width: 18px !important;
  height: 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 1033 !important;
}

/* Dropdown items styling */
.dropdown-item {
  padding: 0.75rem 1rem !important;
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  transition: all 0.2s ease !important;
  border: none !important;
  background: transparent !important;
  color: var(--text-primary) !important;
  text-decoration: none !important;
  white-space: nowrap !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: rgba(0, 137, 123, 0.1) !important;
  color: var(--text-primary) !important;
  outline: none !important;
}

.dropdown-item:active {
  background-color: rgba(0, 137, 123, 0.2) !important;
  transform: scale(0.98) !important;
}

/* Ensure dropdowns are properly positioned on all screen sizes */
@media (max-width: 1024px) {
  .nav-item.dropdown .dropdown-menu,
  #notificationDropdown + .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: auto !important;
    transform: none !important;
    margin-top: 0.5rem !important;
    z-index: 1050 !important;
  }
  
  .profile-dropdown-toggle,
  #notificationDropdown {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0.5rem !important;
  }
  
  .profile-dropdown-toggle img {
    width: 28px !important;
    height: 28px !important;
  }
}

@media (max-width: 768px) {
  /* Mobile dropdown positioning - center on screen */
  .nav-item.dropdown .dropdown-menu,
  #notificationDropdown + .dropdown-menu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 350px !important;
    max-height: 60vh !important;
    margin-top: 0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 1050 !important;
  }
  
  .profile-dropdown-toggle,
  #notificationDropdown {
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0.5rem !important;
  }
  
  .profile-dropdown-toggle img {
    width: 24px !important;
    height: 24px !important;
  }
}

@media (max-width: 480px) {
  .profile-dropdown-toggle,
  #notificationDropdown {
    min-height: 40px !important;
    min-width: 40px !important;
    padding: 0.5rem !important;
  }
  
  .profile-dropdown-toggle img {
    width: 20px !important;
    height: 20px !important;
  }
}

/* Landscape orientation fixes */
@media (orientation: landscape) and (max-height: 500px) {
  .nav-item.dropdown .dropdown-menu,
  #notificationDropdown + .dropdown-menu {
    max-height: 40vh !important;
  }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
  .profile-dropdown-toggle:active,
  #notificationDropdown:active {
    transform: scale(0.98) !important;
  }
  
  .dropdown-item:active {
    transform: scale(0.98) !important;
  }
}

/* Ensure dropdowns don't get cut off by viewport edges */
@media (max-width: 400px) {
  .nav-item.dropdown .dropdown-menu,
  #notificationDropdown + .dropdown-menu {
    width: 95vw !important;
    max-width: none !important;
  }
}

/* Fix for very small screens */
@media (max-width: 320px) {
  .navbar-nav-right {
    gap: 0.25rem !important;
  }
  
  .profile-dropdown-toggle,
  #notificationDropdown {
    min-height: 36px !important;
    min-width: 36px !important;
    padding: 0.375rem !important;
  }
  
  .profile-dropdown-toggle img {
    width: 18px !important;
    height: 18px !important;
  }
}

/* Additional dropdown positioning safeguards */
.navbar-nav-right .dropdown {
  position: relative !important;
}

.navbar-nav-right .dropdown:nth-child(1) .dropdown-menu {
  z-index: 1051 !important;
}

.navbar-nav-right .dropdown:nth-child(2) .dropdown-menu {
  z-index: 1052 !important;
}

/* Ensure dropdowns are always above other content */
.dropdown-menu.show {
  z-index: 1050 !important;
  position: absolute !important;
}

/* Prevent dropdowns from being hidden behind other elements */
.navbar-nav-right {
  position: relative !important;
  z-index: 1031 !important;
}

/* Ensure proper stacking context */
.navbar {
  position: relative !important;
  z-index: 1030 !important;
}

/* Fix for iOS Safari dropdown positioning */
@supports (-webkit-touch-callout: none) {
  .dropdown-menu {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
  
  .profile-dropdown-toggle,
  #notificationDropdown {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* Ensure dropdowns work properly on all touch devices */
@media (pointer: coarse) {
  .dropdown-toggle {
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.1);
    touch-action: manipulation;
  }
  
  .dropdown-item {
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.1);
    touch-action: manipulation;
    min-height: 44px !important;
  }
}

/* Compact and responsive tables for Check-in History */
#checkinTable,
#myCheckinTable,
#teamCheckinTable {
  table-layout: fixed;
  width: 100%;
}

#checkinTable th,
#checkinTable td,
#myCheckinTable th,
#myCheckinTable td,
#teamCheckinTable th,
#teamCheckinTable td {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  padding: 0.5rem 0.5rem; /* compact spacing */
}

/* Constrain wide columns and allow activity text to wrap */
#checkinTable td:nth-child(5) {
  white-space: normal;
  word-break: break-word;
}

/* Reasonable default widths so the table fits without zooming */
#checkinTable th:nth-child(1), #checkinTable td:nth-child(1) { width: 12%; }
#checkinTable th:nth-child(2), #checkinTable td:nth-child(2) { width: 14%; }
#checkinTable th:nth-child(3), #checkinTable td:nth-child(3) { width: 14%; }
#checkinTable th:nth-child(4), #checkinTable td:nth-child(4) { width: 12%; }
#checkinTable th:nth-child(5), #checkinTable td:nth-child(5) { width: 26%; }
#checkinTable th:nth-child(6), #checkinTable td:nth-child(6) { width: 8%; }
#checkinTable th:nth-child(7), #checkinTable td:nth-child(7) { width: 6%; }
#checkinTable th:nth-child(8), #checkinTable td:nth-child(8) { width: 8%; }

/* Thumbnail constraints */
#checkinTable td img,
#myCheckinTable td img,
#teamCheckinTable td img {
  max-width: 64px;
  height: auto;
}

/* Improve touch targets for better tablet/mobile UX */
.btn, .nav-link, .dropdown-item, .form-control, .form-select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 137, 123, 0.1);
}

/* Enhanced touch scrolling for scrollable areas */
.table-responsive, .modal-body, .chat-messages, .widget-list-body {
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

/* Improve horizontal scrolling for tables */
.table-responsive {
  touch-action: pan-x pan-y;
}

/* Enhanced Tablet/iPad Responsive Fixes */
/* ========================================== */

/* General tablet improvements */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  /* Improve overall touch interactions */
  .btn, button, [role="button"], .nav-link, .dropdown-toggle {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.2);
  }
  
  /* Better form controls */
  .form-control, .form-select, input, select, textarea {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
    touch-action: manipulation;
  }
  
  /* Enhanced modal positioning */
  .modal {
    z-index: 1060;
  }
  
  .modal-content {
    z-index: 1065;
    pointer-events: auto;
  }
  
  .modal .btn, .modal button {
    z-index: 1070;
    pointer-events: auto;
    position: relative;
  }
  
  /* Better dropdown positioning */
  .dropdown-menu {
    z-index: 1050;
    position: absolute;
    min-width: 200px;
    max-width: 280px;
  }
  
  /* Improve table responsiveness */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
  
  /* Better navigation */
  .navbar {
    padding: 0.75rem 1rem;
    min-height: 80px;
    position: relative;
    z-index: 1030;
  }
  
  .navbar-nav-main {
    gap: 1rem;
    margin-right: 1rem;
    display: flex !important; /* Ensure navbar links are always visible on tablets */
  }
  
  .navbar-nav-main .nav-link {
    padding: 0.75rem 1rem;
    min-height: 50px;
    font-size: 1rem;
  }
  
  .navbar-nav-right {
    gap: 0.75rem;
  }
}

/* iPad Portrait Mode Specific Fixes */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
  /* Compact navbar for portrait */
  .navbar {
    padding: 0.5rem 1rem;
    min-height: 70px;
  }
  
  .navbar-brand img {
    height: 45px;
    width: 40px;
  }
  
  .navbar-nav-main {
    gap: 0.75rem;
    margin-right: 0.75rem;
    display: flex !important; /* Ensure navbar links are always visible */
  }
  
  .navbar-nav-main .nav-link {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    font-size: 0.85rem;
  }
  
  /* Only hide text labels that are meant to be hidden, keep the links visible */
  .navbar-nav-main .nav-link .d-none {
    display: none !important;
  }
  
  /* Keep the main nav links visible but compact */
  .navbar-nav-main .nav-link span:not(.d-none) {
    display: inline !important;
  }
  
  .navbar-nav-right {
    gap: 0.5rem;
  }
  
  /* Hide status badges in portrait to save space */
  .status-badges {
    display: none !important;
  }
  
  /* Hide profile name in portrait */
  .profile-name {
    display: none !important;
  }
  
  .profile-dropdown-toggle {
    min-height: 44px !important;
    padding: 0.5rem 0.75rem !important;
  }
  
  .profile-dropdown-toggle img {
    width: 35px !important;
    height: 35px !important;
  }
  
  /* Ensure buttons are properly sized for touch */
  .btn {
    min-height: 44px;
    min-width: 44px;
    font-size: 14px;
    padding: 12px 16px;
  }
  
  /* Improve dropdown positioning */
  .dropdown-menu {
    min-width: 200px !important;
    max-width: 280px !important;
    z-index: 1050 !important;
  }
  
  /* Fix notification dropdown positioning */
  #notificationDropdown {
    min-width: 44px;
    min-height: 44px;
  }
  
  #notification-list {
    width: 300px !important;
    max-width: 90vw !important;
    z-index: 1051 !important;
  }
  
  /* Better modal positioning */
  .modal-dialog {
    margin: 1rem auto;
    max-width: 95vw;
  }
  
  .modal-content {
    border-radius: 1rem;
  }
  
  /* Improve form layouts */
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-control, .form-select {
    min-height: 44px;
    font-size: 16px;
  }
  
  /* Better table layouts */
  .table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
  }
  
  .table th, .table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* iPad Landscape Mode Specific Fixes */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
  /* More spacious navbar for landscape */
  .navbar {
    padding: 0.75rem 1.5rem;
    min-height: 80px;
  }
  
  .navbar-brand img {
    height: 50px;
    width: 45px;
  }
  
  .navbar-nav-main {
    gap: 1.5rem;
    margin-right: 2rem;
  }
  
  .navbar-nav-main .nav-link {
    padding: 0.75rem 1rem;
    min-height: 50px;
    font-size: 1rem;
  }
  
  .navbar-nav-right {
    gap: 1rem;
  }
  
  /* Show status badges in landscape */
  .status-badges {
    display: flex !important;
  }
  
  /* Show profile name in landscape */
  .profile-name {
    display: inline !important;
  }
  
  /* Better dropdown positioning */
  .dropdown-menu {
    min-width: 220px;
    max-width: 320px;
  }
  
  /* Enhanced modal layouts */
  .modal-dialog {
    margin: 2rem auto;
    max-width: 80vw;
  }
  
  /* Better form layouts */
  .form-row {
    display: flex;
    gap: 1rem;
  }
  
  .form-group {
    flex: 1;
    margin-bottom: 1.5rem;
  }
}

/* Enhanced Mobile Responsive Fixes */
@media (max-width: 768px) {
  .navbar {
    padding: 0.5rem;
  }
  
  .navbar-brand img {
    height: 45px;
    width: 40px;
  }
  
  .navbar-nav-main {
    display: none;
  }
  
  .navbar-nav-right {
    gap: 0.5rem;
  }
  
  .status-badges {
    display: none;
  }
  
  .navbar-nav .dropdown-toggle {
    padding: 0.5rem;
    min-width: 44px;
    justify-content: center;
  }
  
  .profile-dropdown-toggle {
    padding: 0.5rem;
    min-width: 44px;
    justify-content: center;
  }
  
  .profile-dropdown-toggle img {
    width: 28px;
    height: 28px;
  }
  
  /* Mobile dropdown positioning */
  .dropdown-menu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 350px !important;
    max-height: 60vh !important;
    margin-top: 0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 1050 !important;
  }
  
  /* Better mobile modal positioning */
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
  }
  
  .modal-content {
    border-radius: 1rem;
  }
  
  /* Mobile form improvements */
  .form-control, .form-select {
    min-height: 44px;
    font-size: 16px;
  }
  
  .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }
}

/* Enhanced Touch Interactions */
@media (hover: none) and (pointer: coarse) {
  /* Better touch feedback */
  .btn:active, .nav-link:active, .dropdown-toggle:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  .dropdown-item:active {
    background-color: rgba(0, 137, 123, 0.2) !important;
    transform: scale(0.98);
  }
  
  /* Prevent text selection on interactive elements */
  .btn, .nav-link, .dropdown-toggle, .dropdown-item {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  
  /* Better focus states for touch */
  .btn:focus, .nav-link:focus, .dropdown-toggle:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
  }
}

/* Loading Indicator Styles */
.page-loading-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loading-indicator.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

.loading-text {
  color: var(--primary-green);
  font-size: 1.1rem;
  font-weight: 500;
}

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

/* Enhanced Z-Index Management */
.navbar {
  z-index: 1030;
}

.navbar-nav .dropdown-toggle {
  z-index: 1031;
}

.dropdown-menu {
  z-index: 1050;
}

.modal-backdrop {
  z-index: 1055;
}

.modal {
  z-index: 1060;
}

.modal-content {
  z-index: 1065;
}

.modal .btn, .modal button {
  z-index: 1070;
}

/* Prevent iOS zoom on input focus */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
  }
}

/* 4. RESPONSIVE VIDEO CONTAINERS */
.video-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.video-container video {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

/* Responsive video sizing for different screen sizes */
@media (max-width: 768px) {
  .video-container video {
    max-height: 300px;
  }
}

@media (max-width: 576px) {
  .video-container video {
    max-height: 250px;
  }
}

/* Video controls styling */
.video-container video::-webkit-media-controls {
  background-color: rgba(0, 0, 0, 0.7);
}

.video-container video::-webkit-media-controls-panel {
  background-color: rgba(0, 0, 0, 0.7);
}

/* Ensure videos work properly on mobile devices */
.video-container video {
  -webkit-playsinline: true;
  -moz-playsinline: true;
  playsinline: true;
}

/* Video aspect ratio preservation */
.video-container {
  aspect-ratio: 16 / 9;
  max-height: none;
}

.video-container video {
  aspect-ratio: 16 / 9;
  max-height: none;
  height: 100%;
  object-fit: cover;
}

/* Fallback for browsers that don't support aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
  .video-container {
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
  }
  
  .video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}
h1, h2, h3, h4, h5, h6 { font-weight: 700; }
a { color: var(--primary-green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 3. LAYOUT & NAVIGATION */
.navbar {
  background-color: var(--surface-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 0.5rem 1rem;
  min-height: 70px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-right: 1rem;
}

.navbar-brand img {
  height: 50px;
  width: 45px;
  margin-right: 0.5rem;
}

.navbar-brand span { 
  font-weight: 700; 
  color: var(--text-primary); 
  display: none;
}

/* Enhanced navbar layout */
.navbar-nav-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-right: auto;
}

.navbar-nav-main .nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-weight: 500;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
}

.navbar-nav-main .nav-link:hover {
  background-color: rgba(0, 137, 123, 0.1);
}

.navbar-nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Status badges */
.status-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-badges .badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  min-height: 24px;
  display: flex;
  align-items: center;
}

/* Enhanced dropdown styling */
.navbar-nav .dropdown-toggle {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 137, 123, 0.2);
}

.navbar-nav .dropdown-toggle:hover {
  background-color: rgba(0, 137, 123, 0.1);
}

.navbar-nav .dropdown-menu {
  position: absolute;
  margin-top: 0.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  min-width: 200px;
  max-height: 70vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1050;
}

.navbar-nav .dropdown-item {
  padding: 0.75rem 1rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 137, 123, 0.2);
}

.navbar-nav .dropdown-item:hover {
  background-color: rgba(0, 137, 123, 0.1);
}

.navbar-nav .dropdown-menu-end {
  right: 0;
  left: auto;
}

.navbar-nav .nav-item.dropdown {
  position: relative;
}

/* Notification dropdown specific styling */
#notificationDropdown {
  position: relative;
  font-size: 1.2rem;
  min-width: 44px;
  justify-content: center;
}

#notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.6rem;
  padding: 0.2rem 0.4rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Profile dropdown specific styling */
.profile-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.profile-dropdown-toggle img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-dropdown-toggle .profile-name {
  display: none;
}

.page-header { 
  display: flex; 
  flex-wrap: wrap; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 2rem; 
  padding: 2rem 0; 
  gap: 1.25rem; 
}
.page-header h1 { font-size: 1.875rem; }
.page-header p { margin: 0; color: var(--text-secondary); }

/* 4. BUTTONS & FORMS */
.btn {
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.2s ease-in-out;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
}
.btn-primary { 
  background-color: var(--primary-green); 
  border-color: var(--primary-green);
  color: var(--text-on-primary);
}
.btn-primary:hover { 
  background-color: var(--primary-green-dark);
  border-color: var(--primary-green-dark);
}
.btn-secondary {
  background-color: var(--surface-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-secondary:hover {
  background-color: var(--background-main);
  border-color: #D1D5DB;
}
.form-control, .form-select {
  border-radius: 0.5rem;
  border-color: var(--border-color);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 0.25rem rgba(0, 137, 123, 0.25);
}

/* 5. CARDS & TABLES */
.card { 
  background-color: var(--surface-card); 
  border: 1px solid var(--border-color); 
  border-radius: 0.75rem; 
  box-shadow: var(--shadow-sm); 
}
.card-header { 
  padding: 1rem 1.5rem; 
  background-color: #F9FAFB; 
  border-bottom: 1px solid var(--border-color); 
}
.stat-card .card-body { text-align: center; }
.stat-card .stat-title { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.table th { color: var(--text-secondary); }

/* 6. TABS */
.nav-tabs { border-bottom: 1px solid var(--border-color); }
.nav-tabs .nav-link { color: var(--text-secondary); font-weight: 600; }
.nav-tabs .nav-link.active, .nav-tabs .nav-link:hover { color: var(--primary-green); border-color: #dee2e6 #dee2e6 var(--primary-green); }

/* --- 7. MODERN VME CHAT WIDGET --- */
.chat-widget-toggler { 
  position: fixed !important; 
  bottom: 24px !important; 
  right: 24px !important; 
  width: 56px !important; 
  height: 56px !important; 
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark)) !important; 
  color: white !important; 
  border-radius: 16px !important; 
  display: flex !important; 
  align-items: center !important; 
  justify-content: center !important; 
  cursor: pointer !important; 
  box-shadow: 0 8px 32px rgba(0, 137, 123, 0.3) !important; 
  z-index: 10050 !important; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important; 
  border: none !important; 
  backdrop-filter: blur(10px) !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.chat-widget-toggler:hover { 
  transform: translateY(-2px) scale(1.05); 
  box-shadow: 0 12px 40px rgba(0, 137, 123, 0.4);
}

.chat-widget-toggler:active {
  transform: translateY(0) scale(0.95);
}

.chat-widget-toggler.shake { 
  animation: modernShake 0.6s cubic-bezier(.36,.07,.19,.97) both; 
}

@keyframes modernShake {
  0%, 100% { transform: translateX(0) translateY(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-3px) translateY(-1px); }
  20%, 40%, 60%, 80% { transform: translateX(3px) translateY(1px); }
}

.chat-widget-container { 
  position: fixed; 
  bottom: 90px; 
  right: 24px; 
  width: 380px; 
  height: 520px; 
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px; 
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex; 
  flex-direction: column; 
  overflow: hidden; 
  transform: scale(0.8) translateY(20px); 
  opacity: 0; 
  visibility: hidden; 
  pointer-events: none; 
  transform-origin: bottom right; 
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
  z-index: 10060; 
}

.chat-widget-container.open { 
  transform: scale(1) translateY(0); 
  opacity: 1; 
  visibility: visible; 
  pointer-events: auto; 
}

/* Widget Views */
.widget-view { 
  width: 100%; 
  height: 100%; 
  display: none; 
  flex-direction: column; 
}

#widget-list-view { 
  display: flex; 
}

#widget-chat-view { 
  position: absolute !important; 
  top: 0 !important; 
  left: 100% !important; 
  transition: left 0.3s ease-in-out !important; 
  background: rgba(255, 255, 255, 0.95) !important; 
  width: 100% !important;
  height: 100% !important;
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  z-index: 10 !important;
}

/* When chat view is active, ensure it's visible and properly positioned */
#widget-chat-view[style*="display: flex"],
#widget-chat-view[style*="left: 0"] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  left: 0 !important;
  flex-direction: column !important;
}

/* Hide message form by default */
#widget-message-form {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Show message form only when chat view is active */
#widget-chat-view[style*="display: flex"] #widget-message-form,
#widget-chat-view[style*="left: 0"] #widget-message-form {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

#widget-chat-view.active { 
  left: 0; 
}

/* Removed forced visibility rules for list view; visibility is now handled by JS */

/* Force hide message form when list view is active */
#widget-list-view[style*="display: flex"] ~ #widget-message-form,
#widget-list-view[style*="visibility: visible"] ~ #widget-message-form {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  top: -9999px !important;
}

/* Chat List Items */
.chat-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.chat-list-item:hover {
  background-color: rgba(0, 137, 123, 0.05);
}

.chat-list-item.user-item {
  justify-content: space-between;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
}

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

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

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

.user-avatar-container {
  position: relative;
  margin-right: 12px;
}

.online-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
}

.online-status.online {
  background-color: #28a745;
}

.online-status.offline {
  background-color: #6c757d;
}

.user-actions {
  display: flex;
  align-items: center;
}

.btn-message {
  background: none;
  border: none;
  color: var(--primary-green);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.btn-message:hover {
  background-color: rgba(0, 137, 123, 0.1);
}

/* Loading overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  text-align: center;
  color: var(--primary-green);
}

.loading-spinner i {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* Error toast */
.error-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 300px;
}

/* Chat messages container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fa;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Message bubbles */
.chat-message {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

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

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

.message-content {
  display: flex;
  align-items: flex-end;
  max-width: 70%;
}

.message-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 8px;
  object-fit: cover;
}

.message-bubble {
  background: white !important;
  padding: 8px 12px !important;
  border-radius: 18px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
  position: relative !important;
  max-width: 100% !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  border: 1px solid #e5e7eb !important;
}

.chat-message.sent .message-bubble {
  background: var(--primary-green) !important;
  color: white !important;
  border: 1px solid var(--primary-green-dark) !important;
}

.chat-message.received .message-bubble {
  background: white !important;
  color: var(--text-primary) !important;
  border: 1px solid #e5e7eb !important;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.message-text {
  font-size: 14px !important;
  line-height: 1.4 !important;
  word-wrap: break-word !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: inherit !important;
}

.message-time {
  font-size: 11px !important;
  color: var(--text-secondary) !important;
  margin-top: 4px !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.message-status {
  font-size: 10px;
}

.chat-message.sent .message-time {
  color: rgba(255, 255, 255, 0.8);
}

.chat-message.optimistic .message-bubble {
  opacity: 0.7;
}

.chat-message.optimistic .message-time {
  opacity: 0.5;
}

/* Widget Header */
.widget-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.widget-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.widget-header .btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.widget-header .btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Navigation Tabs */
.nav-tabs {
  background: rgba(0, 137, 123, 0.05);
  border-bottom: 1px solid rgba(0, 137, 123, 0.1);
}

.nav-tabs .nav-link {
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.nav-tabs .nav-link.active {
  background: var(--primary-green);
  color: white;
  border-radius: 8px 8px 0 0;
}

.nav-tabs .nav-link:hover:not(.active) {
  color: var(--primary-green);
  background: rgba(0, 137, 123, 0.1);
}

/* Chat List Items */
.chat-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-list-item:hover {
  background: rgba(0, 137, 123, 0.05);
  transform: translateX(2px);
}

.chat-list-item:active {
  transform: translateX(0) scale(0.98);
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-right: 12px;
  object-fit: cover;
  border: 2px solid rgba(0, 137, 123, 0.1);
}

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

.chat-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

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

.unread-count {
  background: var(--primary-green);
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* Messages Container */
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: linear-gradient(to bottom, rgba(0, 137, 123, 0.02), transparent);
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 137, 123, 0.3);
  border-radius: 2px;
}

/* Chat Messages */
.chat-message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
}

.chat-message.sent {
  justify-content: flex-end;
}

.chat-message.received {
  justify-content: flex-start;
}

.message-content {
  display: flex;
  align-items: flex-end;
  max-width: 80%;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  margin-right: 8px;
  object-fit: cover;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
  word-wrap: break-word;
}

.chat-message.sent .message-bubble {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received .message-bubble {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.message-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 2px;
  opacity: 0.8;
}

.message-text {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
  text-align: right;
}

/* Message Input */
.widget-view .border-top {
  background: rgba(0, 137, 123, 0.02);
  border-top: 1px solid rgba(0, 137, 123, 0.1) !important;
  padding: 16px !important;
}

#widget-message-form {
  background: white;
  border-radius: 12px;
  padding: 8px;
  border: 1px solid rgba(0, 137, 123, 0.1);
  transition: all 0.2s ease;
}

#widget-message-form:focus-within {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(0, 137, 123, 0.1);
}

#message-input {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  resize: none;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 12px !important;
  /* Ensure text input capabilities */
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
  pointer-events: auto !important;
  touch-action: manipulation;
}

#widget-message-form .btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

#widget-message-form .btn:hover {
  color: var(--primary-green);
  transform: scale(1.1);
}

#widget-message-form .btn-primary {
  background: var(--primary-green) !important;
  color: white !important;
}

#widget-message-form .btn-primary:hover {
  background: var(--primary-green-dark) !important;
  transform: scale(1.05);
}

/* Typing Indicator */
#typing-indicator {
  font-style: italic;
  color: var(--text-secondary);
  padding: 8px 16px !important;
  background: rgba(0, 137, 123, 0.05);
}

/* Unread Badge */
#widget-unread-badge {
  background: #DC2626 !important;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}

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

/* Search Inputs */
.form-control-sm {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 137, 123, 0.2);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.form-control-sm:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 2px rgba(0, 137, 123, 0.1);
  background: white;
}

/* Enhanced User List Styles */
.user-item {
  padding: 16px !important;
  border-radius: 12px;
  margin: 8px 12px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-item:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 137, 123, 0.15);
  border-color: rgba(0, 137, 123, 0.2);
}

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

.online-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.online-status.online {
  background: #16a34a;
  animation: pulse-online 2s infinite;
}

.online-status.offline {
  background: #9ca3af;
}

@keyframes pulse-online {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.user-role {
  color: var(--primary-green);
  font-weight: 600;
  font-size: 12px;
}

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

.user-status {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
}

.user-actions {
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.user-item:hover .user-actions {
  opacity: 1;
}

.btn-message {
  background: var(--primary-green);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 137, 123, 0.3);
}

.btn-message:hover {
  background: var(--primary-green-dark);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.4);
}

/* Enhanced Message Bubbles */
.message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  max-width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-message.sent .message-bubble {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 137, 123, 0.3);
}

.chat-message.received .message-bubble {
  background: rgba(248, 250, 252, 0.9);
  color: var(--text-primary);
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(0, 137, 123, 0.1);
}

.message-text {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 2px;
  word-break: break-word;
}

.message-time {
  font-size: 11px;
  opacity: 0.8;
  text-align: right;
  margin-top: 4px;
}

/* Loading States */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 20px;
}

.loading-spinner {
  text-align: center;
  color: var(--primary-green);
}

.loading-spinner i {
  font-size: 2rem;
  margin-bottom: 8px;
}

.loading-spinner p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Error Toast */
.error-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10100;
  min-width: 300px;
}

/* Enhanced Conversation Items */
.chat-list-item:not(.user-item) {
  padding: 16px !important;
  border-radius: 12px;
  margin: 8px 12px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-list-item:not(.user-item):hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(4px);
  box-shadow: 0 6px 20px rgba(0, 137, 123, 0.12);
}

/* Tab Enhancement */
.nav-tabs .nav-link {
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  transition: all 0.3s ease;
  border-radius: 12px 12px 0 0;
  margin: 0 2px;
  position: relative;
  overflow: hidden;
}

.nav-tabs .nav-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-green);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav-tabs .nav-link.active::before {
  transform: scaleX(1);
}

.nav-tabs .nav-link.active {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(0, 137, 123, 0.3);
}

.nav-tabs .nav-link:hover:not(.active) {
  color: var(--primary-green);
  background: rgba(0, 137, 123, 0.08);
  transform: translateY(-1px);
}

/* Improved Scrollbars */
.widget-list-body::-webkit-scrollbar,
.tab-content::-webkit-scrollbar {
  width: 6px;
}

.widget-list-body::-webkit-scrollbar-track,
.tab-content::-webkit-scrollbar-track {
  background: rgba(0, 137, 123, 0.05);
  border-radius: 3px;
}

.widget-list-body::-webkit-scrollbar-thumb,
.tab-content::-webkit-scrollbar-thumb {
  background: rgba(0, 137, 123, 0.3);
  border-radius: 3px;
  transition: all 0.2s ease;
}

.widget-list-body::-webkit-scrollbar-thumb:hover,
.tab-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 137, 123, 0.5);
}

/* Optimistic Message States */
.chat-message.optimistic .message-bubble {
  opacity: 0.7;
}

.chat-message.optimistic .message-time {
  font-style: italic;
}

.message-status {
  margin-left: 4px;
}

.message-status i {
  font-size: 10px;
}

/* Enhanced Link Styling */
.message-text a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
}

.chat-message.received .message-text a {
  color: var(--primary-green);
  text-decoration-color: var(--primary-green);
}

.message-text a:hover {
  text-decoration-color: currentColor;
}

/* Emoji Support */
.emoji {
  font-style: normal;
  font-weight: normal;
}

/* Enhanced Input Focus */
#message-input:focus {
  outline: none !important;
  /* Ensure focus state allows text input */
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text !important;
}

#message-input:empty:before {
  content: attr(placeholder);
  color: var(--text-secondary);
  font-style: italic;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Message Animation */
@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message {
  animation: messageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Mobile Responsiveness for Chat Messages */
@media (max-width: 768px) {
  .user-item {
    margin: 4px 8px;
    padding: 12px !important;
  }
  
  .chat-avatar {
    width: 38px;
    height: 38px;
  }
  
  .message-avatar {
    width: 24px;
    height: 24px;
  }
  
  .user-actions {
    opacity: 1; /* Always show on mobile */
  }
  
  .btn-message {
    width: 28px;
    height: 28px;
  }
  
  .message-bubble {
    padding: 10px 12px;
  }
  
  .message-text {
    font-size: 13px;
  }
  
  .message-time {
    font-size: 10px;
  }
  
  .user-role,
  .user-area,
  .user-status {
    font-size: 11px;
  }
}
.widget-header { display: flex; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.widget-header h4 { margin: 0; font-size: 20px; font-weight: bold; flex-grow: 1; }
.widget-header .btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; padding: 0; }
.widget-list-body { flex-grow: 1; overflow-y: auto; }
.conversation-item { display: flex; align-items: center; padding: 10px 15px; cursor: pointer; transition: background-color 0.2s ease; position: relative; }
.conversation-item:hover { background-color: var(--background-main); }
.conversation-item img { width: 50px; height: 50px; border-radius: 50%; margin-right: 12px; object-fit: cover; }
.conversation-item strong { font-weight: 600; }
.conversation-item p { margin: 0; font-size: 0.9em; color: var(--text-secondary); }
.conversation-item .hide-convo-btn { background: #e4e6eb; border: none; border-radius: 50%; width: 24px; height: 24px; line-height: 24px; padding: 0; text-align: center; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); opacity: 0; transition: opacity 0.2s; font-weight: bold; color: var(--text-secondary); }
.conversation-item:hover .hide-convo-btn { opacity: 1; }
.conversation-item .text-truncate { margin-right: 25px; }
/* Chat message styles - made bigger */
.chat-messages { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 20px; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}

.chat-message { 
    display: flex; 
    align-items: flex-end; 
    max-width: 85%; 
}

.chat-profile-pic { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    margin-right: 12px; 
}

.chat-bubble { 
    padding: 12px 16px; 
    border-radius: 20px; 
    font-size: 1.1em; 
    position: relative; 
    line-height: 1.4;
}

.chat-bubble .username { 
    font-size: 0.9em; 
    font-weight: bold; 
    color: #666; 
    margin-bottom: 4px; 
    display: block; 
}

.chat-message.sent .chat-bubble .username {
  color: #f0f4f8;
}

.chat-bubble .timestamp { 
    font-size: 0.8em; 
    color: #999; 
    text-align: right; 
    margin-top: 6px; 
    display: none; 
}

.chat-bubble:hover .timestamp { 
    display: block; 
}

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

.chat-message.received .chat-bubble { 
    background-color: #E4E6EB; 
    color: #050505; 
}

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

.chat-message.sent .chat-bubble { 
    background-color: var(--primary-green); 
    color: white; 
}

.chat-message.sent .chat-bubble .timestamp { 
    color: #f0f0f0; 
}

/* Chat attachment styles */
.chat-attachment-img { 
    max-width: 220px; 
    border-radius: 10px; 
    margin-top: 8px; 
}

.chat-attachment-file { 
    display: block; 
    padding: 10px 14px; 
    background-color: #f1f1f1; 
    border-radius: 10px; 
    margin-top: 8px; 
    text-decoration: none; 
    font-size: 1em;
}

/* --- 8. ORDER DETAIL MODAL STYLES --- */
.chat-attachment-img { max-width: 150px; border-radius: 8px; margin-top: 5px; }
.chat-attachment-file { display: block; padding: 8px 12px; background-color: #f1f1f1; border-radius: 8px; margin-top: 5px; text-decoration: none; }

/* --- 9. AUTHENTICATION PAGES --- */
.login-page {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background-color: var(--background-main);
    padding: 1rem;
}
.login-wrapper {
    display: flex;
    width: 100%;
    max-width: 1000px;
    margin: 1.5rem;
    box-shadow: var(--shadow-md);
    border-radius: 1rem;
    overflow: hidden;
    background-color: var(--surface-card);
}
.login-form-container {
    flex: 1;
    padding: 2.5rem 3rem;
}
.login-image-container {
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    background-color: #F9FAFB;
}
.login-logo-img { max-width: 80%; height: auto; }
.login-brand-title { font-size: 1.5rem; color: var(--text-primary); text-align: center; }
@media (min-width: 992px) {
    .login-image-container { display: flex; }
}

/* --- 10. BOOK ORDER PAGE --- */
.book-order-form-container { max-width: 800px; margin: 2rem auto; }
.subtotal-display { text-align: right; font-size: 1.25rem; font-weight: 700; margin-top: 1.5rem; }

/* --- 11. CUSTOM SCROLLBAR STYLING --- */
body::-webkit-scrollbar,
.modal-body::-webkit-scrollbar, 
#modal_chatMessages::-webkit-scrollbar, 
.widget-list-body::-webkit-scrollbar, 
.chat-messages::-webkit-scrollbar, 
.card-body[style*="overflow-y: auto"]::-webkit-scrollbar {
    width: 8px;
}
body::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
#modal_chatMessages::-webkit-scrollbar-track,
.widget-list-body::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track,
.card-body[style*="overflow-y: auto"]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
body::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
#modal_chatMessages::-webkit-scrollbar-thumb,
.widget-list-body::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb,
.card-body[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
    background: #a0a0a0;
    border-radius: 10px;
}
body::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
#modal_chatMessages::-webkit-scrollbar-thumb:hover,
.widget-list-body::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover,
.card-body[style*="overflow-y: auto"]::-webkit-scrollbar-thumb:hover {
    background: #888;
}


/* --- Responsive improvements for tablet/mobile --- */
@media (max-width: 1024px) {
  .page-header { padding: 1rem 0; gap: .75rem; }
  .page-header h1 { font-size: 1.5rem; }
  .page-header .btn { padding: .55rem .95rem; font-size: .98rem; margin-right: .5rem; }
  
  /* Navbar responsive improvements */
  .navbar {
    padding: 0.5rem;
  }
  
  .navbar-brand img { 
    height: 45px; 
    width: 40px; 
  }
  
  .navbar-nav-main {
    gap: 0.75rem;
  }
  
  .navbar-nav-main .nav-link {
    padding: 0.5rem 0.5rem;
    font-size: 0.9rem;
  }
  
  .navbar-nav-right {
    gap: 0.5rem;
  }
}

@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: stretch; gap: .65rem; }
  .page-header .header-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  .page-header .btn { width: 100%; margin-right: 0; }
  
  /* Mobile navbar improvements */
  .navbar {
    padding: 0.5rem;
    min-height: 60px;
  }
  
  .navbar-brand img {
    height: 40px;
    width: 35px;
  }
  
  .navbar-nav-main {
    display: none;
  }
  
  .navbar-nav-right {
    gap: 0.5rem;
  }
  
  .status-badges {
    display: none;
  }
  
  .navbar-nav .dropdown-toggle {
    padding: 0.5rem;
    min-width: 44px;
    justify-content: center;
  }
  
  .profile-dropdown-toggle {
    padding: 0.5rem;
    min-width: 44px;
    justify-content: center;
  }
  
  .profile-dropdown-toggle img {
    width: 28px;
    height: 28px;
  }
  
  /* Mobile dropdown positioning */
  .navbar-nav .dropdown-menu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 350px !important;
    max-height: 60vh !important;
    margin-top: 0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3) !important;
    z-index: 1050 !important;
  }
  
  .chat-widget-container { 
    right: 12px; 
    width: 95vw; 
    height: 75vh; 
    bottom: 80px; 
    border-radius: 16px;
    left: 50%;
    transform: translateX(-50%) scale(0.8) translateY(20px);
  }
  .chat-widget-container.open {
    transform: translateX(-50%) scale(1) translateY(0);
  }
  .chat-widget-toggler { 
    right: 20px; 
    bottom: 20px; 
    width: 52px;
    height: 52px;
  }
  .widget-header h4 { font-size: 1rem; }
}

/* Prevent chat widget from blocking modals (e.g., Check-in submit button) */
.modal-open .chat-widget-toggler,
.modal-open .chat-widget-container {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

/* Ensure dropdowns are tappable and not off-screen on small devices */
.navbar .dropdown-menu { 
  max-height: 70vh; 
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  will-change: transform;
}

/* Fix positioning issues for dropdowns on touch devices */
.navbar-nav .dropdown {
  position: relative;
}

.navbar-nav .dropdown-menu {
  position: absolute;
  top: 100%;
  left: auto;
  right: 0;
  margin-top: 0;
}

/* Enhanced touch and scroll fixes for tablets and mobile */
@media (max-width: 1024px) {
  /* Improve touch targets on tablets */
  .btn, .nav-link, .dropdown-toggle, .form-control, .form-select {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.2);
    cursor: pointer;
  }
  
  /* Ensure buttons in modals are easily touchable */
  .modal .btn {
    min-height: 48px;
    min-width: 48px;
    padding: 14px 18px;
    font-size: 16px;
    margin: 4px;
    position: relative;
    z-index: 1070;
  }
  
  /* Fix modal button interactions */
  .modal-content {
    z-index: 1065;
    pointer-events: auto;
  }
  
  .modal-backdrop {
    z-index: 1055;
    pointer-events: auto;
  }
  
  /* Better dropdown handling for touch devices */
  .dropdown-menu {
    position: absolute !important;
    will-change: transform;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  
  /* Improve table scrolling on tablets */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    scroll-behavior: smooth;
  }
  
  /* Better form control sizing for touch */
  .form-control, .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
    touch-action: manipulation;
  }
  
  /* Improve modal scrolling */
  .modal-body {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overflow-y: auto;
  }
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
  .dropdown-menu {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90vw !important;
    max-width: 350px !important;
    max-height: 80vh !important;
    z-index: 1060 !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  
  .dropdown-toggle {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.1);
  }
  
  .dropdown-item {
    padding: 14px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 44px;
    touch-action: manipulation;
  }
  
  /* Fix tab navigation for touch */
  .nav-tabs .nav-link {
    min-height: 44px;
    padding: 12px 16px;
    touch-action: manipulation;
  }
  
  /* Improve button spacing for easier touch */
  .dashboard-header-btn {
    margin-bottom: 8px;
    min-height: 44px;
  }
}

.splash-screen img {
    max-width: 180px;
    animation: pulseLogo 2s ease-in-out infinite;
}

@keyframes pulseLogo {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}


/* --- PWA UPDATE NOTIFICATION --- */
.update-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-primary);
    color: var(--text-on-primary);
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    z-index: 9999;
    display: flex;
    align-items: center;
    font-weight: 600;
}

/*Online Users*/
.online-user-item {
    margin-bottom: 0.5rem;
}

.online-user-item:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease;
}

.position-relative .badge {
    width: 12px;
    height: 12px;
    padding: 0;
    border: 2px solid white;
}

@media (max-width: 768px) {
    #online-users-container {
        flex-direction: column;
    }
    
    .online-user-item {
        width: 100%;
    }
}

/* iPad-specific fixes */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  /* iPad portrait and landscape */
  
  /* Improved navbar responsiveness for iPad portrait */
  .navbar {
    padding: 0.75rem 1rem;
    min-height: 80px;
  }
  
  .navbar-brand {
    font-size: 1.2rem;
    margin-right: 1.5rem;
  }
  
  .navbar-brand img {
    height: 55px;
    width: 50px;
  }
  
  .navbar-nav-main {
    gap: 1.5rem;
    margin-right: 2rem;
  }
  
  .navbar-nav-main .nav-link {
    padding: 0.75rem 1rem;
    min-height: 50px;
    font-size: 1rem;
  }
  
  .navbar-nav-right {
    gap: 1rem;
  }
  
  /* Ensure dropdowns are always visible */
  .dropdown-menu {
    position: absolute !important;
    transform: none !important;
    top: 100% !important;
    left: auto !important;
    right: 0 !important;
    width: auto !important;
    max-width: 300px !important;
    z-index: 1070 !important;
    min-width: 250px !important;
  }
  
  /* Profile dropdown specific fixes */
  .profile-dropdown-toggle {
    min-height: 50px !important;
    padding: 0.75rem 1rem !important;
  }
  
  .profile-dropdown-toggle img {
    width: 40px !important;
    height: 40px !important;
  }
  
  .profile-name {
    display: inline !important;
    font-size: 1rem !important;
  }
  
  /* Improve button sizes for iPad */
  .btn {
    min-height: 48px;
    min-width: 48px;
    font-size: 16px;
    padding: 14px 20px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.3);
    position: relative;
  }
  
  /* Special handling for modal buttons */
  .modal .btn {
    min-height: 52px;
    min-width: 52px;
    font-size: 18px;
    padding: 16px 24px;
    z-index: 1070;
    margin: 6px 4px;
  }
  
  /* Enhanced check-in modal fixes */
  #checkinModal .modal-content {
    z-index: 1070 !important;
  }
  
  #checkinModal .btn, 
  #checkinModal button,
  #checkinModal input[type="button"],
  #checkinModal .form-control,
  #checkinModal .form-select {
    min-height: 52px;
    min-width: 52px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.3);
    position: relative;
    z-index: 1075;
  }
  
  /* Better table interaction */
  .table td, .table th {
    padding: 12px;
  }
  
  /* Improve tab navigation */
  .nav-tabs .nav-link {
    padding: 14px 20px;
    min-height: 50px;
  }
  
  /* Better form controls */
  .form-control, .form-select {
    min-height: 50px;
    font-size: 16px;
    padding: 12px 16px;
  }
  
  /* Improve search input visibility */
  input[type="text"], input[type="search"] {
    min-height: 50px;
    font-size: 16px;
  }
  
  /* Better modal interaction */
  .modal-header .btn-close {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Additional iPad portrait fixes */
  @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
    /* Specific fixes for iPad portrait orientation */
    .navbar {
      padding: 0.5rem 1rem;
      min-height: 70px;
    }
    
    .navbar-nav-main {
      gap: 1rem;
      margin-right: 1rem;
    }
    
    .navbar-nav-main .nav-link {
      padding: 0.5rem 0.75rem;
      min-height: 44px;
      font-size: 0.9rem;
    }
    
    .navbar-nav-right {
      gap: 0.75rem;
    }
    
    .status-badges {
      display: none !important; /* Hide status badges in portrait to save space */
    }
    
    .profile-name {
      display: none !important; /* Hide profile name in portrait to save space */
    }
    
    .profile-dropdown-toggle {
      min-height: 44px !important;
      padding: 0.5rem 0.75rem !important;
    }
    
    .profile-dropdown-toggle img {
      width: 35px !important;
      height: 35px !important;
    }
    
    /* Ensure buttons are properly sized for touch */
    .btn {
      min-height: 44px;
      min-width: 44px;
      font-size: 14px;
      padding: 12px 16px;
    }
    
    /* Improve dropdown positioning */
    .dropdown-menu {
      min-width: 200px !important;
      max-width: 280px !important;
    }
  }
}

/* Prevent text selection on buttons and interactive elements */
.btn, .nav-link, .dropdown-item, .nav-tabs .nav-link {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  touch-action: manipulation;
}

/* Enhanced touch responsiveness for all clickable elements */
.btn, button, [role="button"], .clickable, .form-control, .form-select {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 137, 123, 0.2);
  cursor: pointer;
  position: relative;
}

/* Ensure modal elements are above everything else */
.modal {
  z-index: 1060;
}

.modal-backdrop {
  z-index: 1055;
}

.modal-content {
  z-index: 1065;
  pointer-events: auto;
}

.modal .btn, .modal button {
  z-index: 1070;
  pointer-events: auto;
  position: relative;
}

/* Improve scrollbar visibility on touch devices */
@media (hover: none) and (pointer: coarse) {
  .table-responsive::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }
  
  .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 137, 123, 0.6);
    border-radius: 6px;
  }
  
  .table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 137, 123, 0.1);
    border-radius: 6px;
  }
  
  /* Comprehensive touch device fixes */
  .btn, button, [role="button"] {
    min-height: 48px;
    min-width: 48px;
    padding: 14px 18px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.3);
    cursor: pointer;
    position: relative;
  }
  
  /* Enhanced dropdown fixes for touch */
  .dropdown-toggle {
    min-height: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.3);
  }
  
  .dropdown-menu {
    z-index: 1070 !important;
    position: absolute !important;
  }
  
  /* Modal specific fixes for touch devices */
  .modal .btn, .modal button {
    min-height: 52px;
    min-width: 52px;
    font-size: 18px;
    padding: 16px 24px;
    z-index: 1075 !important;
    margin: 6px 4px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.4);
  }
  
  /* Special fixes for check-in modal */
  #checkinModal {
    z-index: 1060 !important;
  }
  
  #checkinModal .modal-backdrop {
    z-index: 1055 !important;
  }
  
  #checkinModal .modal-content {
    z-index: 1065 !important;
    pointer-events: auto;
  }
  
  #checkinModal .btn, 
  #checkinModal button,
  #checkinModal .form-control,
  #checkinModal .form-select,
  #checkinModal input,
  #checkinModal select {
    min-height: 52px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 137, 123, 0.4);
    z-index: 1075 !important;
    position: relative;
    pointer-events: auto;
  }
  
  /* Force proper layering for modal elements */
  #checkinModal .modal-header,
  #checkinModal .modal-body,
  #checkinModal .modal-footer {
    z-index: 1070;
    position: relative;
    pointer-events: auto;
  }
  
  /* Signature pad touch fixes */
  #signature-pad {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 1070;
  }
  
  /* Form input touch fixes */
  .form-control:focus,
  .form-select:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
  }
}

/* --- Enhanced Responsive Design for Mobile/Tablet/iPad --- */

/* Base responsive improvements */
@media (max-width: 1200px) {
  .container-fluid {
    padding: 0 1rem !important;
  }
  
  .page-header {
    padding: 1.5rem 0;
    gap: 1rem;
  }
  
  .page-header h1 {
    font-size: 1.75rem;
  }
  
  .page-header .btn {
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 1024px) {
  .page-header { 
    padding: 1rem 0; 
    gap: 0.75rem; 
  }
  
  .page-header h1 { 
    font-size: 1.5rem; 
  }
  
  .page-header .btn { 
    padding: 0.55rem 0.95rem; 
    font-size: 0.9rem; 
    margin-right: 0.5rem; 
    margin-bottom: 0.5rem;
  }
  
  .navbar-brand img { 
    height: 60px; 
    width: 52px; 
  }
  
  /* Improve card layout on tablets */
  .row .col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  /* Better tab navigation for tablets */
  .nav-tabs {
    flex-wrap: wrap;
    gap: 0.25rem;
  }
  
  .nav-tabs .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .container-fluid {
    padding: 0 0.75rem !important;
  }
  
  .page-header { 
    flex-direction: column; 
    align-items: stretch; 
    gap: 0.75rem; 
    padding: 1rem 0;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
    text-align: center;
  }
  
  .page-header p {
    text-align: center;
  }
  
  /* Improved header actions layout for mobile */
  .page-header .header-actions { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 0.5rem; 
    width: 100%;
  }
  
  .page-header .btn { 
    width: 100%; 
    margin-right: 0; 
    margin-bottom: 0.5rem;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  
  /* Single column layout for very small screens */
  @media (max-width: 480px) {
    .page-header .header-actions {
      grid-template-columns: 1fr;
    }
  }
  
  /* Improved tab navigation for mobile */
  .nav-tabs {
    flex-direction: column;
    border-bottom: none;
    gap: 0.25rem;
  }
  
  .nav-tabs .nav-link {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    text-align: left;
    background-color: var(--surface-card);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .nav-tabs .nav-link.active {
    background-color: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
  }
  
  /* Better card layout for mobile */
  .row .col-xl-3,
  .row .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }
  
  .card-body {
    padding: 1rem;
  }
  
  /* Improved table responsiveness */
  .table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
  }
  
  .table {
    font-size: 0.85rem;
  }
  
  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
  }
  
  /* Better button sizing for mobile */
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    min-height: 36px;
  }
  
  .btn {
    min-height: 44px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
  
  /* Improved form controls */
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.75rem;
  }
  
  /* Better modal handling */
  .modal-dialog {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .modal-footer {
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .modal-footer .btn {
    width: 100%;
    margin: 0;
  }
  
  /* Chat widget mobile improvements */
  .chat-widget-container { 
    right: 12px; 
    width: 95vw; 
    height: 75vh; 
    bottom: 80px; 
    border-radius: 16px;
    left: 50%;
    transform: translateX(-50%) scale(0.8) translateY(20px);
  }
  
  .chat-widget-container.open {
    transform: translateX(-50%) scale(1) translateY(0);
  }
  
  .chat-widget-toggler { 
    right: 20px; 
    bottom: 20px; 
    width: 52px;
    height: 52px;
  }
  
  .widget-header h4 { 
    font-size: 1rem; 
  }
}

/* iPad-specific improvements */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
  .page-header {
    padding: 1.5rem 0;
  }
  
  .page-header .header-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
  
  .page-header .btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    min-height: 48px;
  }
  
  /* Better tab layout for iPad */
  .nav-tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .nav-tabs .nav-link {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    min-height: 48px;
  }
  
  /* Improved card layout for iPad */
  .row .col-xl-3 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  /* Better table handling for iPad */
  .table-responsive {
    border-radius: 0.75rem;
  }
  
  .table th,
  .table td {
    padding: 1rem 0.75rem;
    font-size: 0.9rem;
  }
  
  /* Enhanced button sizing for iPad */
  .btn {
    min-height: 48px;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
  }
  
  .btn-sm {
    min-height: 40px;
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
  }
}

/* Landscape orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
  .page-header {
    padding: 0.75rem 0;
  }
  
  .page-header .header-actions {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .nav-tabs {
    flex-direction: row;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.5rem;
  }
  
  .nav-tabs .nav-link {
    white-space: nowrap;
    flex-shrink: 0;
  }
  
  .modal-dialog {
    margin: 0.5rem;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .container-fluid {
    padding: 0 0.5rem !important;
  }
  
  .page-header {
    padding: 0.75rem 0;
  }
  
  .page-header h1 {
    font-size: 1.25rem;
  }
  
  .page-header .header-actions {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .page-header .btn {
    padding: 0.875rem 0.75rem;
    font-size: 0.85rem;
    min-height: 48px;
  }
  
  /* Very small screen navbar improvements */
  .navbar {
    padding: 0.25rem 0.5rem;
    min-height: 55px;
  }
  
  .navbar-brand img {
    height: 35px;
    width: 30px;
  }
  
  .navbar-nav-right {
    gap: 0.25rem;
  }
  
  .navbar-nav .dropdown-toggle {
    padding: 0.5rem;
    min-width: 40px;
    min-height: 40px;
  }
  
  .profile-dropdown-toggle {
    padding: 0.5rem;
    min-width: 40px;
    min-height: 40px;
  }
  
  .profile-dropdown-toggle img {
    width: 24px;
    height: 24px;
  }
  
  .nav-tabs .nav-link {
    padding: 0.875rem 0.75rem;
    font-size: 0.85rem;
    min-height: 48px;
  }
  
  .table {
    font-size: 0.8rem;
  }
  
  .table th,
  .table td {
    padding: 0.5rem 0.25rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .btn-sm {
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
    min-height: 40px;
  }
}

/* High DPI displays and retina screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .btn,
  .nav-link,
  .form-control,
  .form-select {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Accessibility improvements for touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .nav-link:hover,
  .dropdown-item:hover {
    transform: none;
  }
  
  .btn:active,
  .nav-link:active,
  .dropdown-item:active {
    transform: scale(0.98);
  }
}

/* Button text responsiveness */
@media (max-width: 480px) {
  .btn-text {
    display: none;
  }
  
  .dashboard-header-btn {
    padding: 0.75rem !important;
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .dashboard-header-btn i {
    font-size: 1.1rem;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .btn-text {
    font-size: 0.8rem;
  }
  
  .dashboard-header-btn {
    padding: 0.75rem 0.5rem !important;
  }
}

/* Improved header content layout */
.header-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Better spacing for mobile */
@media (max-width: 768px) {
  .header-content {
    text-align: center;
    margin-bottom: 1rem;
  }
  
  .header-content h1 {
    margin-bottom: 0.5rem;
  }
  
  .header-content p {
    margin-bottom: 1rem;
  }
}

/* Enhanced table responsiveness for mobile */
@media (max-width: 768px) {
  .table-responsive {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
  }
  
  /* Stack table cells on very small screens */
  @media (max-width: 480px) {
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
      display: block;
    }
    
    .table-responsive thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }
    
    .table-responsive tr {
      border: 1px solid var(--border-color);
      margin-bottom: 0.5rem;
      border-radius: 0.25rem;
      background-color: var(--surface-card);
    }
    
    .table-responsive td {
      border: none;
      position: relative;
      padding: 0.75rem 0.5rem 0.75rem 50%;
      text-align: left;
      min-height: 44px;
      display: flex;
      align-items: center;
    }
    
    .table-responsive td:before {
      content: attr(data-label) ": ";
      position: absolute;
      left: 0.5rem;
      width: 45%;
      font-weight: 600;
      color: var(--text-secondary);
    }
    
    .table-responsive td:last-child {
      border-bottom: none;
    }
  }
}

/* Better card layout for mobile */
@media (max-width: 768px) {
  .card {
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
  }
  
  .card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .card-text {
    font-size: 1.5rem;
    font-weight: 700;
  }
}

/* Improved search input styling */
@media (max-width: 768px) {
  .form-control[placeholder*="Search"] {
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 16px;
    background-color: var(--surface-card);
  }
  
  .form-control[placeholder*="Search"]:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.2rem rgba(0, 137, 123, 0.25);
  }
}

/* Better badge styling for mobile */
@media (max-width: 768px) {
  .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
  }
}

/* Enhanced table scrolling improvements for check-in history */
.table-responsive {
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 0.5rem;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
  -webkit-overflow-scrolling: touch;
}

/* Make order table rows clickable */
#orderTable tbody tr {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#orderTable tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.1) !important;
}

#orderTable tbody tr:active {
  background-color: rgba(13, 110, 253, 0.2) !important;
}

/* Prevent button clicks from triggering row click */
#orderTable .view-order-btn,
#myOrderTable .view-order-btn,
#teamOrderTable .view-order-btn {
  cursor: pointer;
  position: relative;
  z-index: 10;
}

#orderTable .view-order-btn:hover,
#myOrderTable .view-order-btn:hover,
#teamOrderTable .view-order-btn:hover {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* Make all order table rows clickable */
#orderTable tbody tr,
#myOrderTable tbody tr,
#teamOrderTable tbody tr,
.admin-dashboard .table tbody tr {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#orderTable tbody tr:hover,
#myOrderTable tbody tr:hover,
#teamOrderTable tbody tr:hover,
.admin-dashboard .table tbody tr:hover {
  background-color: rgba(13, 110, 253, 0.1) !important;
}

#orderTable tbody tr:active,
#myOrderTable tbody tr:active,
#teamOrderTable tbody tr:active,
.admin-dashboard .table tbody tr:active {
  background-color: rgba(13, 110, 253, 0.2) !important;
}

/* Fix wide table columns and enable text wrapping */
.table-responsive table {
  table-layout: fixed;
  width: 100%;
  min-width: auto;
}

.table-responsive th,
.table-responsive td {
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  padding: 0.5rem 0.25rem;
  font-size: 0.8rem;
  vertical-align: top;
}

/* Set specific column widths for check-in tables */
#checkinTable th:nth-child(1), /* Submitted By */
#checkinTable td:nth-child(1) {
  width: 15%;
  max-width: 120px;
}

#checkinTable th:nth-child(2), /* Hospital */
#checkinTable td:nth-child(2) {
  width: 35%;
  max-width: 200px;
}

#checkinTable th:nth-child(3), /* Doctor */
#checkinTable td:nth-child(3) {
  width: 30%;
  max-width: 180px;
}

#checkinTable th:nth-child(4), /* Activity/Location */
#checkinTable td:nth-child(4) {
  width: 10%;
  max-width: 100px;
}

#checkinTable th:nth-child(5), /* Proof */
#checkinTable td:nth-child(5) {
  width: 5%;
  max-width: 80px;
}

#checkinTable th:nth-child(6), /* Signature */
#checkinTable td:nth-child(6) {
  width: 5%;
  max-width: 80px;
}

#checkinTable th:nth-child(7), /* Date */
#checkinTable td:nth-child(7) {
  width: 10%;
  max-width: 120px;
}

/* Apply same column widths to other check-in tables */
#myCheckinTable th,
#myCheckinTable td,
#teamCheckinTable th,
#teamCheckinTable td {
  white-space: normal !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  padding: 0.5rem 0.25rem;
  font-size: 0.8rem;
  vertical-align: top;
}

.table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Compact table design for better scrolling */
.table.table-hover {
  margin-bottom: 0;
}

.table.table-hover thead th {
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 0.5rem;
}

.table.table-hover tbody tr {
  transition: background-color 0.15s ease-in-out;
}

.table.table-hover tbody tr:hover {
  background-color: rgba(0, 137, 123, 0.05);
}

/* Mobile table improvements */
@media (max-width: 768px) {
  .table-responsive {
    max-height: 60vh;
    font-size: 0.8rem;
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
  }
  
  .table.table-hover thead th,
  .table.table-hover tbody td {
    padding: 0.4rem 0.2rem;
    font-size: 0.7rem;
  }
  
  .table.table-hover thead th {
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
  }
  
  /* Force text wrapping on mobile */
  .table-responsive th,
  .table-responsive td {
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 150px;
  }
}

/* Tablet-specific improvements */
@media (max-width: 1024px) and (min-width: 769px) {
  .table-responsive {
    max-height: 65vh;
  }
  
  .table.table-hover thead th,
  .table.table-hover tbody td {
    padding: 0.6rem 0.4rem;
  }
}
  
  .badge.bg-primary,
  .badge.bg-success,
  .badge.bg-warning,
  .badge.bg-danger,
  .badge.bg-info {
    color: white !important;
  }
}

/* Improved modal responsiveness */
@media (max-width: 768px) {
  .modal-content {
    border-radius: 0.75rem;
    margin: 0.5rem;
  }
  
  .modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .modal-title {
    font-size: 1.25rem;
  }
  
  .modal-body {
    padding: 1rem;
    max-height: 70vh;
    overflow-y: auto;
  }
  
  .modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
  }
}

/* Enhanced touch feedback */
@media (hover: none) and (pointer: coarse) {
  .btn:active,
  .nav-link:active,
  .dropdown-item:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }
  
  .card:active {
    transform: translateY(1px);
    transition: transform 0.1s ease;
  }
}

/* Better focus states for accessibility */
.btn:focus,
.nav-link:focus,
.form-control:focus,
.form-select:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 2px;
}

/* Improved loading states */
.btn:disabled,
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Better spacing for mobile navigation */
@media (max-width: 768px) {
  .nav-tabs {
    margin-bottom: 1rem;
  }
  
  .tab-content {
    margin-top: 0;
  }
  
  .tab-pane {
    padding: 0;
  }
}

/* Enhanced responsive grid system */
@media (max-width: 768px) {
  .row {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
  }
  
  .col,
  .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* Better responsive typography */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.125rem !important; }
  h4 { font-size: 1rem !important; }
  h5 { font-size: 0.875rem !important; }
  h6 { font-size: 0.8rem !important; }
  
  p { font-size: 0.9rem; }
  small { font-size: 0.8rem; }
}

/* Improved responsive spacing */
@media (max-width: 768px) {
  .mb-4 { margin-bottom: 1rem !important; }
  .mb-3 { margin-bottom: 0.75rem !important; }
  .mb-2 { margin-bottom: 0.5rem !important; }
  .mb-1 { margin-bottom: 0.25rem !important; }
  
  .mt-4 { margin-top: 1rem !important; }
  .mt-3 { margin-top: 0.75rem !important; }
  .mt-2 { margin-top: 0.5rem !important; }
  .mt-1 { margin-top: 0.25rem !important; }
  
  .p-4 { padding: 1rem !important; }
  .p-3 { padding: 0.75rem !important; }
  .p-2 { padding: 0.5rem !important; }
  .p-1 { padding: 0.25rem !important; }
}

/* Responsive navigation tabs */
.nav-tabs-responsive-wrapper {
  position: relative;
  overflow: hidden;
}

.nav-tabs-responsive-wrapper .nav-tabs {
  scrollbar-width: thin;
  scrollbar-color: #6c757d #f8f9fa;
}

.nav-tabs-responsive-wrapper .nav-tabs::-webkit-scrollbar {
  height: 6px;
}

.nav-tabs-responsive-wrapper .nav-tabs::-webkit-scrollbar-track {
  background: #f8f9fa;
  border-radius: 3px;
}

.nav-tabs-responsive-wrapper .nav-tabs::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 3px;
}

.nav-tabs-responsive-wrapper .nav-tabs::-webkit-scrollbar-thumb:hover {
  background: #495057;
}

.nav-tabs-responsive-wrapper .nav-item {
  white-space: nowrap;
  min-width: fit-content;
}

.nav-tabs-responsive-wrapper .nav-link {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6c757d;
  transition: all 0.2s ease;
}

.nav-tabs-responsive-wrapper .nav-link:hover {
  color: #495057;
  background: rgba(0, 123, 255, 0.05);
  border-bottom-color: #dee2e6;
}

.nav-tabs-responsive-wrapper .nav-link.active {
  color: #007bff;
  background: transparent;
  border-bottom-color: #007bff;
  font-weight: 500;
}

/* Mobile responsive adjustments for tabs */
@media (max-width: 768px) {
  .nav-tabs-responsive-wrapper .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .nav-tabs-responsive-wrapper .nav-item {
    margin-right: 0.25rem;
  }
}

@media (max-width: 576px) {
  .nav-tabs-responsive-wrapper .nav-link {
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
  }
  
  .nav-tabs-responsive-wrapper .nav-item {
    margin-right: 0.125rem;
  }
}

/* --- CHAT WIDGET EMOJI & GIF PICKER STYLES --- */
#emoji-picker-container,
#gif-picker-container {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  z-index: 10070;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.emoji-categories .btn {
  padding: 6px 10px;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.emoji-categories .btn-primary {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  border-color: var(--primary-green);
  color: white;
}

.emoji-categories .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#emoji-container .btn {
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.8);
}

#emoji-container .btn:hover {
  background: rgba(0, 137, 123, 0.1);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gif-item {
  transition: all 0.2s ease;
  border-radius: 8px;
  overflow: hidden;
}

.gif-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* File Preview Styles */
.file-preview-item {
  background: rgba(248, 249, 250, 0.9);
  transition: all 0.2s ease;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.file-preview-item:hover {
  background: rgba(233, 236, 239, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Message Content Styles */
.message-gif img,
.message-image img {
  transition: all 0.2s ease;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  object-fit: cover;
  display: block;
  margin: 4px 0;
}

.message-gif img:hover,
.message-image img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Message bubble improvements for better content handling */
.message-bubble {
  background: white;
  padding: 10px 12px;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
  max-width: 280px !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: hidden !important;
  width: fit-content;
  min-width: 72px;
  min-height: 32px;
  box-sizing: border-box;
}

.chat-message.sent .message-bubble {
  background: var(--primary-green);
  color: white;
  max-width: 280px;
  width: fit-content;
}

.chat-message.received .message-bubble {
  background: white;
  color: var(--text-primary);
  max-width: 280px;
  width: fit-content;
}

/* Ensure message content containers don't overflow */
.message-content {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.chat-message.sent .message-content {
  flex-direction: row-reverse;
}

/* Constrain images within message bubbles */
.message-gif,
.message-image {
  max-width: 100% !important;
  overflow: hidden !important;
  border-radius: 8px;
  box-sizing: border-box;
}

.message-gif img,
.message-image img {
  max-width: 100% !important;
  max-height: 200px !important;
  width: auto !important;
  height: auto !important;
  object-fit: cover !important;
  display: block !important;
  margin: 4px 0 !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
}

/* Responsive styles for mobile devices */
@media (max-width: 768px) {
  .chat-widget-container {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    right: 16px;
    bottom: 80px;
    max-width: none;
    max-height: none;
  }
  
  .message-bubble {
    max-width: calc(100% - 20px);
  }
  
  .message-gif img,
  .message-image img {
    max-width: 150px;
    max-height: 150px;
  }
  
  .message-file {
    max-width: 200px;
  }
}

/* CONSOLIDATED CHAT MESSAGE STYLES */
/* ================================= */

/* Messages Container */
#widget-chat-messages {
  flex: 1 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 16px !important;
  max-width: 100% !important;
  background: #f8f9fa !important;
  min-height: 200px !important;
  display: flex !important;
  flex-direction: column !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1 !important;
  height: auto !important;
  width: 100% !important;
}

#widget-chat-messages::-webkit-scrollbar {
  width: 4px;
}

#widget-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#widget-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 137, 123, 0.3);
  border-radius: 2px;
}

#widget-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 137, 123, 0.5);
}

/* Individual Message Layout */
.chat-message {
  margin-bottom: 16px;
  display: flex !important;
  align-items: flex-end;
  width: auto;
  clear: both;
  max-width: 85%;
  gap: 8px;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 1 !important;
}

.chat-message.sent {
  justify-content: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

.chat-message.received {
  justify-content: flex-start;
  flex-direction: row;
  margin-right: auto;
}

/* Message Bubble */
.message-bubble {
  background: white;
  padding: 12px 16px;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  position: relative;
  max-width: 300px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 60px;
  min-height: 40px;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.chat-message.sent .message-bubble {
  background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 137, 123, 0.3);
}

.chat-message.received .message-bubble {
  background: white !important;
  color: var(--text-primary) !important;
  border: 1px solid #e5e7eb !important;
  border-bottom-left-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Message Avatar */
.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Message Text */
.message-text {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 4px;
  word-break: break-word;
}

/* Message Sender Name */
.message-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  opacity: 0.8;
}

.chat-message.sent .message-sender {
  color: rgba(255, 255, 255, 0.9);
}

/* Message Time */
.message-time {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-message.sent .message-time {
  color: rgba(255, 255, 255, 0.8);
}

/* Message Status */
.message-status {
  font-size: 10px;
  margin-left: 4px;
}

/* Optimistic Messages */
.chat-message.optimistic .message-bubble {
  opacity: 0.7;
}

.chat-message.optimistic .message-time {
  font-style: italic;
  opacity: 0.5;
}

/* Mobile Responsiveness for Chat Messages */
@media (max-width: 768px) {
  #widget-chat-messages {
    padding: 12px;
  }
  
  .chat-message {
    margin-bottom: 12px;
    max-width: 90%;
  }
  
  .message-bubble {
    max-width: 250px;
    padding: 10px 12px;
  }
  
  .message-avatar {
    width: 24px;
    height: 24px;
  }
  
  .message-text {
    font-size: 13px;
  }
  
  .message-sender {
    font-size: 11px;
  }
  
  .message-time {
    font-size: 10px;
  }
}

@media (max-width: 480px) {
  .chat-message {
    max-width: 95%;
  }
  
  .message-bubble {
    max-width: 220px;
    padding: 8px 10px;
  }
  
  .message-text {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .chat-widget-container {
    width: calc(100vw - 16px);
    height: calc(100vh - 80px);
    right: 8px;
    bottom: 70px;
  }
  
  .message-gif img,
  .message-image img {
    max-width: 120px;
    max-height: 120px;
  }
  
  .message-file {
    max-width: 150px;
  }
}

.message-file {
  max-width: 280px;
}

.message-file .btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.message-file .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* GIF Search Input */
#gif-search {
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

#gif-search:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(0, 137, 123, 0.1);
}

#search-gif-btn {
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

#search-gif-btn:hover {
  background-color: var(--primary-green);
  border-color: var(--primary-green);
  color: white;
}

/* CRITICAL: Force image constraints within chat messages */
#widget-chat-messages .message-bubble .message-gif,
#widget-chat-messages .message-bubble .message-image {
  max-width: 250px !important;
  width: auto !important;
  height: auto !important;
  overflow: hidden !important;
  display: block !important;
  box-sizing: border-box !important;
}

#widget-chat-messages .message-bubble .message-gif img,
#widget-chat-messages .message-bubble .message-image img {
  max-width: 250px !important;
  max-height: 200px !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
  border-radius: 8px !important;
  margin: 4px 0 !important;
  box-sizing: border-box !important;
}

/* Force message bubble constraints */
#widget-chat-messages .message-bubble {
  max-width: 280px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
}

#widget-chat-messages .chat-message {
  max-width: 100% !important;
  overflow: hidden !important;
}

/* Search functionality styles */
.search-highlight {
  background-color: rgba(255, 193, 7, 0.2) !important;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.search-active {
  background-color: rgba(255, 193, 7, 0.4) !important;
  border: 2px solid var(--accent-gold) !important;
  border-radius: 8px;
  animation: searchPulse 1s ease-in-out;
}

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

#chat-search-container {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

#chat-message-search {
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

#chat-message-search:focus {
  border-color: var(--primary-green);
  box-shadow: 0 0 0 3px rgba(0, 137, 123, 0.1);
}

#search-results-info {
  font-size: 12px;
  color: var(--text-secondary);
}

#prev-result, #next-result {
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
}

#prev-result:hover, #next-result:hover {
  background-color: var(--primary-green);
  border-color: var(--primary-green);
  color: white;
}