/* ------------------ Table Container ------------------ */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 0 auto 1rem auto;
  padding: 0;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* ------------------ Responsive Table ------------------ */
.responsive-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.responsive-table thead {
  background-color: #343a40;
  color: white;
}

.responsive-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .responsive-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.responsive-table td,
.responsive-table th {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #dee2e6;
  vertical-align: top;
}

.responsive-table th,
.responsive-table td {
  white-space: nowrap;
}

/* ------------------ Total Row ------------------ */
.responsive-table .total-row td {
  font-weight: bold;
  background-color: #f9f9f9;
}
[data-theme="dark"] .responsive-table .total-row td {
  background-color: #222;
  color: var(--primary-color);
}

/* ------------------ Dark Theme Table Body ------------------ */
[data-theme="dark"] .responsive-table tbody {
  color: white;
}

/* ------------------ Menu Container (Filters + Actions) ------------------ */
.menu-container {
  background: var(--card-bg, #fff);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

[data-theme="dark"] .menu-container {
  background: var(--sidebar-secondary-bg-color, #2e3134);
  color: white;
}

/* ------------------ Filter Group ------------------ */
.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.filter-select,
.filter-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 4px;
  background: var(--input-bg, #fff);
  color: var(--text-color, #333);
  min-width: 200px;
}

[data-theme="dark"] .filter-select,
[data-theme="dark"] .filter-input {
  background: #1e2327;
  border-color: #444;
  color: #e0e0e0;
}

.search-group {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.btn-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0;
  font-size: 1.2rem;
  display: none;
}

.btn-clear:hover {
  color: #dc3545;
}

.btn-clear.active {
  display: block;
}

.results-count {
  margin-left: auto;
  font-size: 0.9rem;
  color: #666;
  white-space: nowrap;
}

[data-theme="dark"] .results-count {
  color: #adb5bd;
}

/* ------------------ Responsive Tables ------------------ */
@media (max-width: 768px) {
  .menu-container {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group,
  .search-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .filter-select,
  .filter-input {
    width: 100%;
    min-width: auto;
  }

  .results-count {
    margin-left: 0;
    text-align: center;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
  }

  .responsive-table td {
    display: flex;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border: none;
  }

  .responsive-table td:before {
    content: attr(data-label);
    font-weight: bold;
    min-width: fit-content;
    flex-shrink: 0;
  }
}
