/* Table - Mobile optimized */

table {
  border-collapse: collapse;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
  width: 100%;
  /* Mobile: smaller font */
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  table {
    font-size: 1rem;
    margin-bottom: 1.4rem;
  }
}

/* Table cells - Mobile spacing */

td,
th {
  vertical-align: top;
  padding: 0.5rem; /* Less padding on mobile */
  border-bottom: 1px solid #dee2e6;
  /* Prevent text overflow on mobile */
  word-break: break-word;
  hyphens: auto;
}

@media (min-width: 768px) {
  td,
  th {
    padding: 0.75rem;
  }
}

/* Table header - Mobile sticky headers */

thead {
  background-color: #f8f9fa;
}

thead th {
  vertical-align: bottom;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
  /* Mobile: Smaller headers */
  font-size: 0.75rem;
  /* Sticky headers for better mobile scrolling */
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #f8f9fa;
}

@media (min-width: 768px) {
  thead th {
    font-size: 0.875rem;
    position: static;
  }
}

/* Table hover effect */
tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Responsive table wrapper - Enhanced for mobile */
.table-responsive,
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  /* Visual scroll indicator on mobile */
  position: relative;
}

/* Shadow indicators for horizontal scroll */
@media (max-width: 768px) {
  .table-responsive::before,
  .table-responsive::after,
  .table-wrapper::before,
  .table-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 2;
  }

  .table-responsive::before,
  .table-wrapper::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
  }

  .table-responsive::after,
  .table-wrapper::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
  }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
  /* Even smaller on very small screens */
  table {
    font-size: 0.75rem;
  }

  td, th {
    padding: 0.375rem;
  }

  /* Hide less important columns on mobile if needed */
  .hide-mobile {
    display: none;
  }
}

/* Table striped rows for better readability */
.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  thead {
    background-color: #2a2a2a;
  }

  thead th {
    background-color: #2a2a2a;
    color: #e0e0e0;
    border-color: #444;
  }

  td, th {
    border-color: #444;
  }

  tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
  }
}
