/* ==========================================================================
   Tabulator Custom Theme - Built on top of tabulator_simple
   Based on Tabulator 6.3 theming system
   ========================================================================== */

/* Base container */
.tabulator {
  border: 1px solid #e5e7eb !important;
  border-radius: 0.75rem;
  background-color: #fff !important;
  font-size: 14px;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.05);
}

/* Header */
.tabulator .tabulator-header {
  background-color: #f9fafb !important;
  border-bottom: 1px solid #e5e7eb !important;
  font-weight: 600;
}

.tabulator .tabulator-header .tabulator-col {
  background-color: transparent !important;
  border-right: none !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  padding: 12px 16px;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sort arrows */
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
  border-bottom-color: #d1d5db;
  border-top-color: #d1d5db;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow,
.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
  border-bottom-color: #3b82f6 !important;
  border-top-color: #3b82f6 !important;
}

/* Header hover */
@media (hover: hover) and (pointer: fine) {
  .tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover {
    background-color: #f3f4f6 !important;
  }
}

/* Header filters */
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter {
  margin-top: 8px;
}

.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  color: #374151;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

/* Table body */
.tabulator .tabulator-tableholder .tabulator-table {
  background-color: #fff;
  color: #374151;
}

/* Rows */
.tabulator-row {
  border-bottom: 1px solid #f3f4f6 !important;
  background-color: #fff !important;
}

.tabulator-row.tabulator-row-even {
  background-color: #fff !important;
}

.tabulator-row:last-child {
  border-bottom: none !important;
}

/* Row hover */
@media (hover: hover) and (pointer: fine) {
  .tabulator-row.tabulator-selectable:hover {
    background-color: #f9fafb !important;
  }
}

/* Cells */
.tabulator-row .tabulator-cell {
  padding: 14px 16px;
  border-right: none !important;
  color: #4b5563;
}

/* Footer / Pagination */
.tabulator .tabulator-footer {
  background-color: #fff !important;
  border-top: 1px solid #e5e7eb !important;
  padding: 12px 16px;
}

.tabulator .tabulator-footer .tabulator-footer-contents {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: nowrap !important;
  gap: 16px;
}

/* Page counter - left side */
.tabulator .tabulator-footer .tabulator-page-counter {
  font-size: 13px;
  color: #6b7280;
  font-weight: 400;
  white-space: nowrap;
  order: 1;
}

/* Paginator container - center/right area */
.tabulator .tabulator-footer .tabulator-paginator {
  display: flex !important;
  align-items: center !important;
  gap: 12px;
  margin-left: auto !important;
  order: 2;
}

/* Page size label and select */
.tabulator .tabulator-footer .tabulator-paginator label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}

.tabulator .tabulator-footer .tabulator-page-size {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background-color: #fff;
  color: #374151;
  cursor: pointer;
}

.tabulator .tabulator-footer .tabulator-page-size:focus {
  border-color: #3b82f6;
  outline: none;
}

/* Page number buttons container */
.tabulator .tabulator-footer .tabulator-pages {
  display: flex !important;
  align-items: center;
  gap: 4px;
}

/* All pagination buttons (numbers + first/prev/next/last) */
.tabulator .tabulator-footer .tabulator-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  transition: all 0.15s;
  cursor: pointer;
}

.tabulator .tabulator-footer .tabulator-page:hover:not(:disabled):not(.active) {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.tabulator .tabulator-footer .tabulator-page.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.tabulator .tabulator-footer .tabulator-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Loading state - uses .tabulator-alert */
.tabulator .tabulator-alert {
  background: rgba(255, 255, 255, 0.92) !important;
}

.tabulator .tabulator-alert .tabulator-alert-msg {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 12px !important;
  padding: 24px 32px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
  font-size: 0;
  color: transparent;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 12px !important;
}

.tabulator .tabulator-alert .tabulator-alert-msg::before {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: tabulator-spin 0.6s linear infinite;
}

.tabulator .tabulator-alert .tabulator-alert-msg::after {
  content: "Loading...";
  display: block;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

@keyframes tabulator-spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.tabulator .tabulator-alert .tabulator-alert-msg.tabulator-alert-state-error {
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  border-radius: 8px !important;
  padding: 12px 16px !important;
  font-size: 13px !important;
  color: #dc2626 !important;
}

/* Placeholder (empty state) */
.tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents {
  color: #9ca3af;
  font-size: 14px;
  font-weight: 400;
  padding: 48px 16px;
}

/* Column resize handle - visible separator between columns */
.tabulator .tabulator-header .tabulator-col {
  border-right: 1px solid #e5e7eb !important;
}

.tabulator .tabulator-header .tabulator-col:last-child {
  border-right: none !important;
}

.tabulator .tabulator-col-resize-handle {
  width: 8px !important;
  cursor: col-resize !important;
}

.tabulator .tabulator-col-resize-handle:hover {
  background: rgba(59, 130, 246, 0.2) !important;
}

/* ==========================================================================
   Action Icons - Clean minimal style
   ========================================================================== */

.table-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #9ca3af;
  transition: all 0.15s;
  position: relative;
}

.table-action-btn:hover {
  color: #6b7280;
  background-color: #f3f4f6;
}

.table-action-btn.view:hover {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
}

.table-action-btn.edit:hover {
  color: #f59e0b;
  background-color: rgba(245, 158, 11, 0.1);
}

.table-action-btn.delete:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}
