/* Base table styles */
table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  border: 1px solid var(--border-color, var(--edifecs-gray));
  font-size: clamp(0.875rem, 2vw, 1rem);
  overflow-wrap: break-word;
}

/* Table headers */
thead {
  background-color: var(--table-header-bg, var(--edifecs-gray));
  color: var(--table-header-color, #ffffff);
  font-weight: 600;
}

thead th {
  padding: clamp(0.75rem, 2vw, 1rem);
  text-align: center;
  border: 1px solid var(--border-color, var(--edifecs-gray));
}

/* Table body */
tbody tr {
  border-bottom: 1px solid var(--border-color, var(--edifecs-gray));
}

tbody tr:nth-child(even) {
  background-color: var(--table-stripe-bg, var(--background-gray));
}

tbody tr:hover {
  background-color: var(--table-hover-bg, #f3f4f6);
}

tbody td {
  padding: clamp(0.5rem, 1.5vw, 0.75rem);
  text-align: center;
  border: 1px solid var(--border-color, var(--edifecs-gray));
}

/* Utility classes for tables */

/* Bordered table */
.table-bordered {
  border: 1px solid var(--border-color, var(--edifecs-gray));
}

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

/* Dark header variant */
.table-dark thead {
  background-color: var(--primary-color, #2d3e50);
  color: #ffffff;
}

/* Light header variant */
.table-light thead {
  background-color: #f3f4f6;
  color: var(--primary-color, #2d3e50);
  border-bottom: 2px solid var(--border-color, var(--edifecs-gray));
}

/* Striped rows */
.table-striped tbody tr:nth-child(odd) {
  background-color: #ffffff;
}

.table-striped tbody tr:nth-child(even) {
  background-color: var(--table-stripe-bg, var(--background-gray));
}

/* Hover effect */
.table-hover tbody tr:hover {
  background-color: var(--table-hover-bg, #f3f4f6);
  cursor: pointer;
}

/* Compact table */
.table-compact th,
.table-compact td {
  padding: 0.5rem;
}

/* Spacious table */
.table-spacious th,
.table-spacious td {
  padding: 1.25rem;
}

/* Text alignment utilities for tables */
.table-center th,
.table-center td {
  text-align: center;
}

.table-left th,
.table-left td {
  text-align: left;
}

.table-right th,
.table-right td {
  text-align: right;
}

/* Responsive table wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}

.table-responsive table {
  margin: 0;
  min-width: 600px;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  table {
    font-size: 0.875rem;
  }

  thead th,
  tbody td {
    padding: 0.5rem;
  }

  /* Stack table on mobile (optional) */
  .table-stack thead {
    display: none;
  }

  .table-stack tbody,
  .table-stack tr,
  .table-stack td {
    display: block;
    width: 100%;
  }

  .table-stack tr {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color, var(--edifecs-gray));
  }

  .table-stack td {
    text-align: left;
    padding-left: 50%;
    position: relative;
  }

  .table-stack td::before {
    content: attr(data-label);
    position: absolute;
    left: 0.75rem;
    font-weight: 600;
    color: var(--primary-color, #2d3e50);
  }
}
