# src/admin/components/base/BaseTable.vue
<template>
  <div class="base-table">
    <table class="table-content">
      <thead>
        <tr>
          <slot name="header"></slot>
        </tr>
      </thead>
      <tbody>
        <slot></slot>
      </tbody>
    </table>
  </div>
</template>

<script setup>
defineProps({
  variant: {
    type: String,
    default: 'normal',
    validator: (value) => ['normal', 'compact'].includes(value)
  }
});
</script>

<style scoped>
.base-table {
  margin-block-start: 1rem;
  margin-block-end: 0;
  background-color: white;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--color-steel-blue);
}

.table-content {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Center checkbox cell */
:deep(td.text-center) {
  vertical-align: middle;
  text-align: center;
}

:deep(td.text-center input[type="checkbox"]) {
  margin: 0 auto;
  display: block;
}

:deep(th) {
  padding: 0.75rem 1.5rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--color-navy);
  background-color: var(--color-cool-gray);
  letter-spacing: 0.05em;
}

:deep(th.w-2\/5) {
  width: 40%;
}

:deep(th.w-1\/5) {
  width: 20%;
}

:deep(th.text-center) {
  text-align: center;
}

:deep(td) {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-steel-blue);
}

:deep(tr:first-child td) {
  border-top: none;
}

:deep(.table-text-primary) {
  font-size: 0.875rem;
  color: var(--color-slate);
}

:deep(.table-text-secondary) {
  font-size: 0.875rem;
  color: var(--color-navy);
}

:deep(.table-text-small) {
  font-size: 0.75rem;
  color: var(--color-navy);
}

:deep(.table-text-muted) {
  opacity: 0.75;
}

:deep(.table-link) {
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 0.75rem;  /* Make text smaller */
}

:deep(.table-link:hover) {
  color: var(--color-primary-hover);
}

:deep(.table-link svg) {
  width: 0.75rem;
  height: 0.75rem;
  margin-left: 0.25rem;
}

:deep(input[type="checkbox"].table-checkbox) {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 2px solid var(--color-steel-blue);
  cursor: pointer;
  appearance: none;
  background-color: white;
  margin: 0;
  display: inline-block;
  position: relative;
}

:deep(input[type="checkbox"].table-checkbox:checked) {
  background-color: var(--color-bright-blue);
  border-color: var(--color-bright-blue);
}

:deep(input[type="checkbox"].table-checkbox:checked::after) {
  content: '';
  width: 0.3rem;
  height: 0.6rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%) rotate(45deg);
  display: block;
}

:deep(input[type="checkbox"].table-checkbox:focus) {
  outline: 2px solid var(--color-azure);
  outline-offset: 2px;
}

:deep(.table-checkbox:focus) {
  outline: 2px solid var(--color-bright-blue);
  outline-offset: 2px;
}

:deep(.flex-col-center) {
  display: flex;
  flex-direction: column;
  min-height: 3rem;
  justify-content: center;
}
</style>