/* custom-table.css */

:root {
  /* Default variable values - can be overridden */
  --head-color: #212529;
  --head-bg-color: var(--steel-light-hex);
  --head-border-color: var(--steel-hex);
  --body-color: #212529;
  --body-bg-color: var(--clay-light-hex);
  --body-border-color: var(--steel-hex);
  --tbl-btn-color: var(--steel-hex);
  --tbl-btn-bg-color: var(--clay-light-hex);
  --tbl-button-border-color: var(--steel-hex);
  --tbl-btn-hover-color: var(--steel-hex);
  --tbl-link-color: var(--steel-hex);
}

/* Base table styles */
.main-table {
  --tbl-border-radius:0.5rem;
  width: 100%;
  margin-bottom: 1rem;
  color: var(--body-color);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--tbl-border-radius);
  /* overflow: hidden; */
  /* box-shadow: 0 0 0 1px var(--body-border-color); */
}


/* Cell styles */
.main-table th,
.main-table td {
  padding: 0.5rem;
  vertical-align: top;
  border-top: 1px solid var(--body-border-color);
}

/* Header styles */
.main-table th {
  color: var(--head-color);
  background-color: var(--head-bg-color);
  border-bottom: 2px solid var(--head-border-color);
  vertical-align: bottom;
}

/* Remove top border from first row */
.main-table thead tr:first-child th {
  border-top: none;
}

/* Striped rows - alternative row colors */
.main-table.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02);
}

.main-table tbody {
  background-color: var(--body-bg-color);
}

/* Hover effect */
.main-table.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.075);
  transition: background-color 0.15s ease-in-out;
}

.cmp-row.tbl-active {
  background-color: rgba(0, 0, 0, 0.15)!important;
}

.cmp-row.tbl-active:hover  {
  color:white;
  background-color: rgba(0, 0, 0, 0.25)!important;
}

/* Small table - reduced padding */
.main-table.table-sm th,
.main-table.table-sm td {
  padding: 2px 4px;
  font-size: 0.7rem;
}

.main-table.table-sm .tbl-btn {
  padding: 0.125rem 0.25rem;   /* smaller padding */
  font-size: 0.75rem;         /* smaller font */
  line-height: 1.25;
}

/* Border styles for different variants */
.main-table.table-bordered {
  border-collapse: separate;
  border-spacing: 0;
}

.main-table.table-bordered th,
.main-table.table-bordered td {
  border: 1px solid var(--body-border-color);
}

.main-table.table-bordered thead th {
  border-bottom-width: 2px;
}

/* Custom column color classes */
.main-table .col-primary {
  background-color: #cfe2ff;
}

.main-table .col-secondary {
  background-color: #e2e3e5;
}

.main-table .col-success {
  background-color: #d1e7dd;
}

.main-table .col-danger {
  background-color: #f8d7da;
}

.main-table .col-warning {
  background-color: #fff3cd;
}

.main-table .col-info {
  background-color: #cff4fc;
}

/* Custom column color with hover support */
.main-table.table-hover tbody tr:hover .col-primary {
  background-color: #b6d4fe;
}

.main-table.table-hover tbody tr:hover .col-secondary {
  background-color: #d3d4d5;
}

.main-table.table-hover tbody tr:hover .col-success {
  background-color: #c1e0d1;
}

.main-table.table-hover tbody tr:hover .col-danger {
  background-color: #f5c6cb;
}

.main-table.table-hover tbody tr:hover .col-warning {
  background-color: #ffeaa7;
}

.main-table.table-hover tbody tr:hover .col-info {
  background-color: #b9e4f0;
}

/* Button styles for table cells */
.main-table .tbl-btn {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  color: var(--tbl-btn-color);
  background-color: var(--tbl-btn-bg-color);
  border: 1px solid;
  transition: all 0.15s ease-in-out;
}

.main-table .tbl-btn:hover {
  color: var(--tbl-btn-bg-color);
  background-color: var(--tbl-btn-hover-color);
  /* border-color: transparent; */
}

.main-table .tbl-btn:focus {
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Small button variant */
.main-table .tbl-btn-sm {
  padding: 2px 4px;
  font-size: 0.75rem;
}

/* Link styles for table cells */
.main-table .tbl-link,
.main-table .tbl-a {
  color: var(--tbl-link-color);
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s ease-in-out;
}

.main-table .tbl-link:hover,
.main-table .tbl-a:hover {
  color: var(--steel-light-hex);
  text-decoration: underline;
}

/* Column with buttons - action column styling */
.main-table .col-actions {
  white-space: nowrap;
  text-align: center;
}

.main-table .col-actions .tbl-btn {
  margin: 0 0.125rem;
}

.main-table.tbl-rounded {
  border-radius: var(--tbl-border-radius);
  overflow: hidden;
  
}

#in-scroll .main-table.tbl-rounded {
  border-radius: 0;
  overflow: visible;
  
}

/* Optional: Different border radius sizes */
.main-table.rounded-sm {
  border-radius: 0.25rem;
  
}

.main-table.rounded-lg {
  border-radius: 1rem;
}

.main-table-header
  { 
    font-weight: 500;
    font-size: 1.2em;
    text-align: center;
  }

.table-rounded-wrapper {
      border-radius: 0.75rem;
      overflow: hidden;              /* clips scrollbar corners */
      border: 1px solid #dee2e6;
    }
 
.table-rounded-wrapper .table-scroll {
  /* overflow-x: auto; */
  overflow-y: auto;
  max-height: 400px;
}

/* Keep rounded corners visible when table has a border */
.table-rounded-wrapper .table {
  margin-bottom: 0;
}


/* Dark theme support (optional) */
@media (prefers-color-scheme: dark) {
  .main-table.dark-auto {
    --head-color: #e9ecef;
    --head-bg-color: #2d2d2d;
    --head-border-color: #404040;
    --body-color: #e9ecef;
    --body-bg-color: #1a1a1a;
    --body-border-color: #404040;
  }
}

/* Example usage class for demo */
.main-table.demo-highlight {
  --tbl-btn-bg-color: #198754;
  --tbl-btn-hover-color: #157347;
  --tbl-link-color: #0dcaf0;
}

