.index-table-container {
  table-layout: auto;
  padding: 1rem;
  max-width: 100%;
  overflow-x: auto;
}

.index-table-container table {
  width: 100%;
  border-collapse: collapse;
}

.index-table-container th {
  white-space: nowrap;
}
.index-table-container th a {
  text-decoration: none;
  color: var(--color-foreground);
}

.index-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.index-table-header h1 {
  margin: 0;
  font-size: 1.5rem;
}


.clickable-row {
  cursor: pointer;
  transition: 0.2s ease;
}
.clickable-row:hover {
  color: var(--color-primary-light);
}

/* Search form */
.index-table-search {
  margin-bottom: 1rem;
}

.index-table-search input {
  width: 200px;
}

.index-table-search input, select {
  background-color: var(--color-background-secondary);
  color: var(--color-foreground);
  border: 1px solid var(--color-border);
}

.index-table-search button[type="search"] {
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
}

.index-table-search button[type="submit"] {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  border: none;
  background: var(--color-primary);
  color: var(--color-white);
  cursor: pointer;
}

.index-table-search form button[type="submit"]:hover {
  background: var(--color-primary-dark);
  border-radius: 10px;
}

.index-table-search-btn .material-icons {
  font-size: 1.1rem;
  vertical-align: middle;
}

.index-table-search-btn:hover {
  background-color: var(--color-primary-dark);
  cursor: pointer;
}


/* Table wrapper */
.index-table-wrapper {
  width: 100%;
  overflow-x: auto;
  min-height: 500px;
}

.index-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.index-table th,
.index-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  word-break: normal;
}

.index-table th {
  background: var(--color-border);
  font-weight: 600;
}

.index-table .actions-col {
  text-align: right;
  white-space: nowrap;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background: var(--color-border);
  border: 1px solid var(--color-border);
  color: var(--color-foreground);
  border-radius: 4px;
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--color-background-secondary);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  min-width: 120px;
  display: none;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.dropdown-menu .dropdown-item {
  display: block;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  color: var(--color-foreground);
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: right;
  inline-size: 100%;
  box-sizing: border-box;
}

.dropdown-menu .dropdown-item:hover {
  background: var(--color-border);
}

.dropdown-menu .danger {
  color: #b91c1c;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* Adjust for smaller screens */
@media (max-width: 640px) {
  .index-table th,
  .index-table td {
    padding: 0.5rem;
  }

  .index-table {
    min-width: 400px;
  }

  .dropdown-toggle {
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
  }
}

/* Pagination */
.pagination {
  margin-top: 1rem;
  text-align: center;
}

.pagination .page {
  display: inline-block;
  margin: 0 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  transition: 0.2s ease;
}

.pagination .page:hover {
  background: var(--color-border);
}

.pagination a {
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  display: block;
  color: var(--color-primary);
}

.pagination .current {
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  background: var(--color-primary);
  color: var(--color-white);
  cursor: default;
}
.pagination .current:hover {
  background: var(--color-primary);
}

.pagination .gap {
  border: 0;
  cursor: pointer;
}

.index-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.back-link.material-icons {
  font-size: 24px;
  text-decoration: none;
  color: inherit;
  opacity: 0.7;
}

.back-link.material-icons:hover {
  opacity: 1;
}
