.table-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-view[hidden] {
  display: none !important;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

.table-toolbar__left,
.table-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.table-toolbar__right {
  margin-left: auto;
}

.table-count {
  font-weight: 600;
  color: var(--text-secondary, #64748b);
}

.table-action {
  border: none;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-dark, #4f46e5);
  border-radius: 0.6rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.table-action:hover,
.table-action:focus {
  background: rgba(99, 102, 241, 0.25);
  transform: translateY(-1px);
  outline: none;
}

.table-wrapper {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 45px -40px rgba(15, 23, 42, 0.6);
}

.table-scroller {
  overflow: auto;
}

.gallery-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.95rem;
}

.gallery-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  font-weight: 700;
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  white-space: nowrap;
}

.gallery-table tbody td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  vertical-align: middle;
}

.gallery-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.06);
}

.gallery-table tbody tr.is-selected {
  background: rgba(99, 102, 241, 0.12);
}

.gallery-table td:first-child,
.gallery-table th:first-child {
  position: sticky;
  left: 0;
  background: rgba(248, 250, 252, 0.95);
  z-index: 3;
}

.gallery-table th.is-sortable {
  cursor: pointer;
}

.gallery-table th.is-sortable::after {
  content: '⇅';
  font-size: 0.75rem;
  margin-left: 0.5rem;
  opacity: 0.4;
}

.gallery-table th.is-sorted-asc::after {
  content: '↑';
  opacity: 1;
}

.gallery-table th.is-sorted-desc::after {
  content: '↓';
  opacity: 1;
}

.gallery-table th.is-dragging {
  opacity: 0.5;
}

.gallery-table th.is-drag-over {
  outline: 2px dashed var(--primary-color, #6366f1);
}

.table-thumb {
  width: 70px;
  height: 70px;
  border-radius: 0.65rem;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.12);
}

.table-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.table-editable {
  display: inline-block;
  min-width: 120px;
  padding: 0.25rem 0.35rem;
  border-radius: 0.5rem;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.table-editable[contenteditable='true'] {
  cursor: text;
}

.table-editable[contenteditable='true']:focus {
  outline: none;
  background: rgba(99, 102, 241, 0.12);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.column-visibility {
  position: relative;
}

.column-visibility__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 220px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  box-shadow: 0 18px 40px -30px rgba(15, 23, 42, 0.6);
  padding: 0.6rem;
  display: grid;
  gap: 0.35rem;
  z-index: 10;
}

.column-visibility__item {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  cursor: pointer;
}

.bulk-actions {
  position: relative;
}

.bulk-actions__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.75rem;
  box-shadow: 0 18px 40px -30px rgba(15, 23, 42, 0.6);
  padding: 0.4rem;
  display: grid;
  gap: 0.35rem;
  z-index: 11;
}

.bulk-actions__menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.bulk-actions__menu button:hover,
.bulk-actions__menu button:focus {
  outline: none;
  background: rgba(99, 102, 241, 0.12);
}

.bulk-actions__menu hr {
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  margin: 0.2rem 0;
}

.table-dialog {
  border: none;
  border-radius: 1rem;
  padding: 0;
  max-width: 520px;
  width: min(520px, 95vw);
  background: #ffffff;
  box-shadow: 0 42px 85px -45px rgba(15, 23, 42, 0.75);
}

.table-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.table-dialog__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.table-dialog__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.table-dialog__close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
}

.table-dialog__body {
  display: grid;
  gap: 1rem;
  padding: 0 1.25rem;
}

.table-dialog__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.table-dialog__field label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary, #64748b);
}

.table-dialog__field input,
.table-dialog__field textarea {
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.table-dialog__field input:focus,
.table-dialog__field textarea:focus {
  outline: none;
  border-color: var(--primary-color, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.table-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0 1.25rem 1.25rem;
}

.table-action--subtle {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary, #64748b);
}

.table-empty-state {
  margin: 0;
  padding: 1.5rem;
  text-align: center;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary, #64748b);
  font-weight: 600;
}

.status {
  font-weight: 600;
  text-transform: capitalize;
}

.status--visible {
  color: var(--admin-success, #10b981);
}

.status--hidden {
  color: var(--admin-danger, #ef4444);
}

.status--pending {
  color: var(--admin-warning, #f59e0b);
}

.view-toggle {
  display: inline-flex;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  padding: 0.25rem;
  gap: 0.25rem;
}

.view-toggle__button {
  border: none;
  background: transparent;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-secondary, #64748b);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.view-toggle__button.is-active {
  background: var(--primary-color, #6366f1);
  color: #fff;
  box-shadow: 0 10px 25px -20px rgba(99, 102, 241, 0.7);
}

.view-toggle__button:focus {
  outline: none;
  transform: translateY(-1px);
}

@media (max-width: 1024px) {
  .table-thumb {
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 860px) {
  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-toolbar__right {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .table-wrapper {
    overflow-x: auto;
  }

  .gallery-table {
    min-width: 720px;
  }
}

@media (max-width: 560px) {
  .table-view {
    gap: 0.75rem;
  }
  .table-toolbar {
    gap: 0.75rem;
  }
  .view-toggle__button {
    padding-inline: 0.8rem;
  }
}

