/* InstinctHub Table Styles */
.ihub-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--Nunito);
  margin-bottom: 20px;
  background-color: var(--White);
  box-shadow: var(--lightShadow);
  border-radius: 5px;
  overflow: hidden;
  display: inline-table;
}

.ihub-table th,
.ihub-table td {
  padding: 14px 16px;
  border-bottom: var(--borderDefault);
  text-align: left;
}

.ihub-table th {
  background-color: var(--OpacityBackground);
  font-weight: 600;
  color: var(--Gunmetal);
  position: relative;
}

.ihub-table tr:last-child td {
  border-bottom: none;
}

.ihub-table tbody tr {
  transition: background-color 0.2s ease;
}

.ihub-table tbody tr:hover {
  background-color: rgba(197, 192, 219, 0.1);
}

.ihub-clickable-row {
  cursor: pointer;
}

/* The row the user last opened from this table. Applied on click, and again
   when the table is restored after navigating back, so the eye lands on the
   record they were working with. */
.ihub-table tbody tr.ihub-row-visited {
  background-color: rgba(0, 131, 143, 0.08);
  box-shadow: inset 3px 0 0 var(--DarkCyan);
}

.ihub-table tbody tr.ihub-row-visited:hover {
  background-color: rgba(0, 131, 143, 0.14);
}

.ihub-table tbody tr.ihub-row-visited:focus {
  outline: 2px solid var(--DarkCyan);
  outline-offset: -2px;
}

.ihub-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ihub-sort-icon {
  margin-left: 5px;
  font-size: 12px;
  color: var(--ChineseSilver);
}

.ihub-sortable-column {
  cursor: pointer;
  user-select: none;
}

.ihub-sorted-asc .ihub-sort-icon,
.ihub-sorted-desc .ihub-sort-icon {
  color: var(--DarkCyan);
}

.ihub-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.ihub-table-controls {
  display: flex;
  gap: 16px;
  align-items: center;
}

.ihub-search-input {
  padding: 10px 15px;
  border: var(--borderDefault);
  border-radius: 4px;
  min-width: 240px;
  font-family: var(--Nunito);
  transition: border-color 0.3s ease;
}

.ihub-search-input:focus {
  outline: none;
  border-color: var(--DarkCyan);
}

.ihub-table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  flex-wrap: wrap;
  gap: 16px;
}

.ihub-pagination-info {
  color: var(--Gunmetal);
  font-size: 0.9rem;
}

.ihub-pagination-controls {
  display: flex;
  gap: 4px;
}

.ihub-pagination-button {
  padding: 8px 12px;
  background-color: var(--White);
  border: var(--borderDefault);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.ihub-pagination-button:hover:not(:disabled) {
  background-color: var(--Magnolia);
  border-color: var(--ChineseSilver);
}

.ihub-pagination-button:disabled {
  color: var(--ChineseSilver);
  cursor: not-allowed;
}

/* Current page. Selectors are deliberately more specific than the two-class
   form: consumer apps override `.ihub-pagination-button` for dark mode with
   `html.DarkMode .ihub-pagination-button` (specificity 0,2,1), which beat the
   old `.ihub-pagination-button.ihub-active` (0,2,0) and flattened the active
   page to look like every other button. `aria-current="page"` is set by both
   IHubTable and IHubTableServer and doubles as the accessibility marker. */
.ihub-pagination-controls .ihub-pagination-button.ihub-active,
.ihub-pagination-controls .ihub-pagination-button[aria-current="page"] {
  background-color: var(--DarkCyan);
  color: var(--White);
  border-color: var(--DarkCyan);
}

.ihub-pagination-controls .ihub-pagination-button.ihub-active:hover:not(:disabled),
.ihub-pagination-controls
  .ihub-pagination-button[aria-current="page"]:hover:not(:disabled) {
  background-color: var(--DarkCyan);
  border-color: var(--DarkCyan);
}

.ihub-rows-per-page {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ihub-rows-select {
  padding: 6px 8px;
  border: var(--borderDefault);
  border-radius: 4px;
  background-color: var(--White);
  font-family: var(--Nunito);
}
.ihub-rows-select,
.ihub-rows-select option {
  color: var(--Gunmetal);
}

.ihub-rows-select, .ihub-search-input {
    background-color: var(--OpacityBackground);
    color: var(--Gunmetal);
    border-color: rgba(197, 192, 219, .3);
}

/* Pager navigation: page buttons plus the "Go to page" form. */
.ihub-pagination-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.ihub-pagination-controls {
  flex-wrap: wrap;
}

/* Gap buttons jump five pages. They read as "…" until hovered or focused,
   then show the jump size so the affordance is discoverable. */
.ihub-pagination-jump {
  letter-spacing: 1px;
}

.ihub-pagination-jump-label {
  display: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

.ihub-pagination-jump:hover:not(:disabled) .ihub-pagination-jump-dots,
.ihub-pagination-jump:focus-visible .ihub-pagination-jump-dots {
  display: none;
}

.ihub-pagination-jump:hover:not(:disabled) .ihub-pagination-jump-label,
.ihub-pagination-jump:focus-visible .ihub-pagination-jump-label {
  display: inline;
}

.ihub-pagination-goto {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.ihub-pagination-goto label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--Gunmetal);
  white-space: nowrap;
}

.ihub-pagination-goto input {
  width: 64px;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 7px 8px;
  border: var(--borderDefault);
  border-radius: 4px;
  background-color: var(--OpacityBackground);
  color: var(--Gunmetal);
  font-family: var(--Nunito);
  font-size: 0.9rem;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.ihub-pagination-goto input::-webkit-outer-spin-button,
.ihub-pagination-goto input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ihub-pagination-goto input:focus {
  outline: none;
  border-color: var(--DarkCyan);
}

.ihub-pagination-goto .ihub-pagination-button {
  padding: 8px 10px;
}

.ihub-sticky-header {
  overflow: auto;
}

.ihub-sticky-header table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

.ihub-table tr:nth-child(1n) {
    background-color: var(--White);
}

.ihub-empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--LavenderGray);
  background-color: var(--White);
  border-radius: 5px;
  box-shadow: var(--lightShadow);
}

.ihub-empty-state span {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}

/* Custom scrollbar for table container */
.ihub-scroll-container {
  overflow: auto;
  border-radius: 5px;
}

.ihub-scroll-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.ihub-scroll-container::-webkit-scrollbar-track {
  background: var(--Gray);
  border-radius: 3px;
}

.ihub-scroll-container::-webkit-scrollbar-thumb {
  background: var(--ChineseSilver);
  border-radius: 3px;
}

.ihub-scroll-container::-webkit-scrollbar-thumb:hover {
  background: var(--OldLavender);
}

/* Responsive styles */
@media (max-width: 768px) {
  .ihub-table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .ihub-table-controls {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .ihub-search-input {
    width: 100%;
    min-width: unset;
  }

  .ihub-hide-on-mobile thead {
    display: none;
  }

  .ihub-hide-on-mobile tbody tr {
    display: block;
    margin-bottom: 16px;
    box-shadow: var(--lightShadow);
    border-radius: 5px;
  }

  .ihub-hide-on-mobile tbody td {
    display: flex;
    text-align: right;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(44, 51, 58, 0.1);
  }

  .ihub-hide-on-mobile tbody td:last-child {
    border-bottom: none;
  }

  .ihub-hide-on-mobile tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: auto;
    text-align: left;
  }

  .ihub-table-pagination {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .ihub-pagination-nav {
    order: 1;
    justify-content: center;
  }

  .ihub-pagination-controls {
    justify-content: center;
  }

  .ihub-pagination-info {
    order: 2;
  }

  .ihub-rows-per-page {
    order: 3;
    margin-top: 8px;
  }
}

/* Dark mode support */
/* @media (prefers-color-scheme: dark) {
  .ihub-table th {
    background-color: var(--OpacityBackground);
    color: var(--Gunmetal);
  }

  .ihub-table {
    background-color: rgba(44, 51, 58, 0.95);
    color: var(--White);
  }

  .ihub-table tbody tr:hover {
    background-color: rgba(44, 51, 58, 0.5);
  }

  .ihub-pagination-button {
    background-color: var(--Gunmetal);
    color: var(--White);
    border-color: rgba(197, 192, 219, 0.3);
  }

  .ihub-pagination-button:hover:not(:disabled) {
    background-color: var(--DarkSlateGray);
  }

  .ihub-rows-select {
    background-color: var(--Gunmetal);
    color: var(--White);
    border-color: rgba(197, 192, 219, 0.3);
  }

  .ihub-search-input {
    border-color: rgba(197, 192, 219, 0.3);
  }

  .ihub-empty-state {
    background-color: var(--White);
    color: var(--LavenderGray);
  }
} */

/* Status Badge Styles */
.ihub-status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  min-width: 80px;
}

.ihub-status-active {
  background-color: rgba(0, 197, 162, 0.15);
  color: var(--CaribbeanGreen);
}

.ihub-status-inactive {
  background-color: rgba(197, 192, 219, 0.15);
  color: var(--OldLavender);
}

.ihub-status-pending {
  background-color: rgba(251, 235, 91, 0.15);
  color: #d4b400; /* Darker shade of Corn */
}

.ihub-status-rejected {
  background-color: rgba(234, 95, 94, 0.15);
  color: var(--Danger);
}

.ihub-status-approved {
  background-color: rgba(75, 225, 51, 0.15);
  color: var(--LimeGreen);
}

/* User link styling */
.ihub-user-link {
  color: var(--DarkCyan);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}

.ihub-user-link:hover {
  color: var(--ViridianGreen);
  text-decoration: underline;
}

/* Mobile responsive adjustments for status badges */
@media (max-width: 768px) {
  .ihub-status-badge {
    width: 100%;
    min-width: unset;
    text-align: center;
  }
}

/* Tooltip for table cells with truncated content */
.ihub-cell-tooltip {
  position: relative;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ihub-cell-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 999;
  background-color: var(--Gunmetal);
  color: var(--White);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: normal;
  max-width: 250px;
  box-shadow: var(--shadow);
  margin-top: 5px;
}

/* Table row selection styles */
.ihub-table tr.ihub-selected-row {
  background-color: rgba(0, 131, 143, 0.1);
}

.ihub-table tr.ihub-selected-row:hover {
  background-color: rgba(0, 131, 143, 0.15);
}

/* Checkbox cell styling */
.ihub-checkbox-cell {
  width: 40px;
  text-align: center;
}

.ihub-checkbox-header {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Filter dropdown styles */
.ihub-column-filter {
  position: relative;
  display: inline-block;
}

.ihub-filter-button {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--ChineseSilver);
  padding: 0;
  margin-left: 8px;
}

.ihub-filter-button:hover {
  color: var(--DarkCyan);
}

.ihub-filter-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--White);
  border: var(--borderDefault);
  border-radius: 4px;
  padding: 12px;
  min-width: 200px;
  box-shadow: var(--shadow);
  z-index: 100;
  margin-top: 5px;
}

.ihub-filter-dropdown label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.ihub-filter-input {
  width: 100%;
  padding: 8px 12px;
  border: var(--borderDefault);
  border-radius: 4px;
  margin-bottom: 12px;
}

.ihub-filter-actions {
  display: flex;
  justify-content: space-between;
}

.ihub-filter-actions button {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* Table row hover actions */
.ihub-row-actions {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ihub-table tr:hover .ihub-row-actions {
  opacity: 1;
}

/* Table cell with icon */
.ihub-cell-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ihub-cell-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Export buttons styling */
.ihub-export-buttons {
  display: flex;
  gap: 8px;
}

.ihub-export-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--White);
  border: var(--borderDefault);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ihub-export-button:hover {
  background-color: var(--Magnolia);
}

.ihub-export-csv {
  color: var(--DarkCyan);
}

.ihub-export-excel {
  color: #217346; /* Excel green */
}

.ihub-export-pdf {
  color: #f40f02; /* PDF red */
}

/* Table context menu */
.ihub-context-menu {
  position: fixed;
  z-index: 1000;
  background-color: var(--White);
  border: var(--borderDefault);
  border-radius: 4px;
  box-shadow: var(--shadow);
  min-width: 160px;
}

.ihub-context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ihub-context-menu-item:hover {
  background-color: var(--Magnolia);
}

.ihub-context-menu-separator {
  height: 1px;
  background-color: var(--ChineseSilver);
  margin: 4px 0;
}

/* Expanded row details */
.ihub-expanded-row {
  background-color: var(--Magnolia);
  border-top: 1px solid var(--ChineseSilver);
}

.ihub-row-details {
  padding: 16px;
}

.ihub-row-detail-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.ihub-row-detail-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.ihub-detail-item {
  margin-bottom: 8px;
}

.ihub-detail-label {
  font-size: 0.8rem;
  color: var(--ChineseSilver);
  margin-bottom: 4px;
}

.ihub-detail-value {
  font-weight: 500;
}

/* Additional styles for IHubTableServer component */

/* Loading indicator styles */
.ihub-loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 131, 143, 0.2);
  border-radius: 50%;
  border-top-color: var(--DarkCyan);
  animation: ihub-spin 1s ease-in-out infinite;
}

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

.ihub-table-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* bottom: 0; */
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  border-radius: 5px;
  height: 100vh;
}

.ihub-search-loading-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.ihub-loading-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--DarkCyan);
  animation: ihub-pulse 1.5s ease-in-out infinite;
}

@keyframes ihub-pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
}

/* Error state styles */
.ihub-error-state {
  padding: 40px 0;
  text-align: center;
  color: var(--Danger);
  background-color: rgba(234, 95, 94, 0.05);
  border-radius: 5px;
  box-shadow: var(--lightShadow);
}

.ihub-error-state p {
  margin-bottom: 20px;
  font-weight: 500;
}

/* Refresh button styles */
.ihub-refresh-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: var(--White);
  border: var(--borderDefault);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--DarkCyan);
}

.ihub-refresh-button:hover:not(:disabled) {
  background-color: var(--Magnolia);
}

.ihub-refresh-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ihub-refresh-button svg {
  animation: none;
}

.ihub-refresh-button:disabled svg {
  animation: ihub-spin 1.5s linear infinite;
}

/* Search input wrapper */
.ihub-search-input-wrapper {
  position: relative;
  width: 100%;
}

/* Responsive adjustments for server table */
@media (max-width: 768px) {
  .ihub-table-server-controls {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .ihub-refresh-button,
  .ihub-export-button {
    width: 100%;
    justify-content: center;
  }
}

/* Dark mode support for server table */

.DarkMode .ihub-table-loading-overlay {
  background-color: rgba(44, 51, 58, 0.7);
}

.DarkMode .ihub-loading-spinner {
  border-color: rgba(197, 192, 219, 0.2);
  border-top-color: var(--DarkCyan);
}

.DarkMode .ihub-error-state {
  background-color: rgba(234, 95, 94, 0.1);
  color: var(--Danger);
}
