/**
 * Conservative Responsive Tables CSS
 * Adds horizontal scrolling to tables without breaking existing layouts
 */

/* ========================================
   LIGHTWEIGHT WRAPPER APPROACH
   ======================================== */

/* Only apply horizontal scroll on mobile */
@media (max-width: 991px) {
  /* Target common table containers and add horizontal scroll */
  .card-body,
  .content,
  .main-content,
  .page-content,
  .container-fluid,
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Ensure tables maintain minimum width for readability */
  .card-body table,
  .content table,
  .main-content table,
  .page-content table,
  .container-fluid table,
  .table-container table {
    min-width: 800px; /* Adjust based on your table content */
  }
}

/* ========================================
   BETTER SCROLLBAR STYLING
   ======================================== */

.card-body::-webkit-scrollbar,
.content::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.page-content::-webkit-scrollbar,
.container-fluid::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  height: 8px;
}

.card-body::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track,
.page-content::-webkit-scrollbar-track,
.container-fluid::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track {
  background: #f8f9fa;
  border-radius: 4px;
}

.card-body::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.page-content::-webkit-scrollbar-thumb,
.container-fluid::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 4px;
  border: 1px solid #ced4da;
}

.card-body::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover,
.page-content::-webkit-scrollbar-thumb:hover,
.container-fluid::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: #adb5bd;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Opt-out class for tables that shouldn't be responsive */
.table-no-responsive {
  overflow: visible !important;
}

/* Force horizontal scroll for specific tables */
.table-force-scroll {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}