/* Enhanced Tabulator Theme */
/* Main table container with rounded corners and global background */
.tabulator {
  background: #fdf8f2; /* Match global light background */
  border: 1px solid #d1a373;
  border-radius: 6px; /* Rounded corners */
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.dark .tabulator {
  background: #1a1410; /* Match global dark background */
  border-color: #54472d;
}

/* Header styling */
.tabulator .tabulator-header {
  background: rgba(209, 163, 115, 0.1);
  border-bottom: 1px solid #d1a373;
  font-weight: 700;
}

.dark .tabulator .tabulator-header {
  background: rgba(84, 71, 45, 0.2);
  border-bottom-color: #54472d;
}

/* Header cells */
.tabulator .tabulator-header .tabulator-col {
  border-right: 1px solid rgba(209, 163, 115, 0.3);
  padding: 4px 4px;
  font-size: 14px;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  box-sizing: border-box;
  padding: 2px;
  position: relative;
}

.dark .tabulator .tabulator-header .tabulator-col {
  border-right-color: rgba(84, 71, 45, 0.4);
}

/* Remove border from last header cell */
.tabulator .tabulator-header .tabulator-col:last-child {
  border-right: none;
}

/* Header filter inputs */
.tabulator .tabulator-header .tabulator-header-filter input {
  background: rgba(255, 255, 255, 0.95); /* Lighter background for better text visibility */
  border: 1px solid #d1a373;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  color: #333; /* Ensure good text contrast */
}

.dark .tabulator .tabulator-header .tabulator-header-filter input {
  background: rgba(158, 155, 152, 0.401); /* Even lighter background for dark mode */
  border-color: #54472d;
  color: #492f0d; /* Very light text color for excellent visibility */
  font-weight: 700;
}

/* Table body rows with improved alternating colors */
.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row {
  border-bottom: 1px solid rgba(209, 163, 115, 0.2);
  background: transparent; /* Use global background */
  transition: background-color 0.2s ease;
}

.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row:nth-child(even) {
  background: rgba(209, 163, 115, 0.08); /* Subtle alternating color */
}

.dark .tabulator .tabulator-tableHolder .tabulator-table .tabulator-row {
  border-bottom-color: rgba(84, 71, 45, 0.3);
  background: transparent; /* Use global background */
}

.dark .tabulator .tabulator-tableHolder .tabulator-table .tabulator-row:nth-child(even) {
  background: rgba(84, 71, 45, 0.15); /* Subtle alternating color for dark */
}

/* Row hover effect with theme colors */
.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row:hover {
  background: rgba(209, 163, 115, 0.2) !important; /* Warmer hover color */
}

.dark .tabulator .tabulator-tableHolder .tabulator-table .tabulator-row:hover {
  background: rgba(84, 71, 45, 0.4) !important; /* Warmer hover color for dark */
}

/* Cell styling */
.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row .tabulator-cell {
  border-right: 1px solid rgba(209, 163, 115, 0.15);
  padding: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.dark .tabulator .tabulator-tableHolder .tabulator-table .tabulator-row .tabulator-cell {
  border-right-color: rgba(84, 71, 45, 0.2);
}

/* Remove border from last cell */
.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row .tabulator-cell:last-child {
  border-right: none;
}

/* Custom scrollbars matching theme */
.tabulator .tabulator-tableHolder::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tabulator .tabulator-tableHolder::-webkit-scrollbar-track {
  background: rgba(209, 163, 115, 0.1);
  border-radius: 6px;
}

.tabulator .tabulator-tableHolder::-webkit-scrollbar-thumb {
  background: rgba(209, 163, 115, 0.5); /* Theme color for scrollbar */
  border-radius: 6px;
  transition: background 0.2s ease;
}

.tabulator .tabulator-tableHolder::-webkit-scrollbar-thumb:hover {
  background: rgba(209, 163, 115, 0.7); /* Darker on hover */
}

.dark .tabulator .tabulator-tableHolder::-webkit-scrollbar-track {
  background: rgba(84, 71, 45, 0.2);
}

.dark .tabulator .tabulator-tableHolder::-webkit-scrollbar-thumb {
  background: rgba(84, 71, 45, 0.6); /* Theme color for dark scrollbar */
}

.dark .tabulator .tabulator-tableHolder::-webkit-scrollbar-thumb:hover {
  background: rgba(84, 71, 45, 0.8); /* Darker on hover for dark */
}

/* Properties column styling */
.tabulator .tabulator-tableHolder .tabulator-table .tabulator-row .tabulator-cell div {
  margin: 1px 0;
  padding: 2px 6px;
  background: rgba(209, 163, 115, 0.15);
  border-radius: 4px;
  font-size: 12px;
}

.dark .tabulator .tabulator-tableHolder .tabulator-table .tabulator-row .tabulator-cell div {
  background: rgba(84, 71, 45, 0.25);
}

/* Firefox fix for Tabulator page size selector */
.tabulator .tabulator-footer .tabulator-page-size {
  border: 1px solid #d1a373;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.8);
  display: inline-block;
  margin: 0 5px;
  padding: 4px 12px;
}

.dark .tabulator .tabulator-footer .tabulator-page-size {
  border-color: #54472d;
  background: rgba(42, 32, 22, 0.8);
  color: #d4af8c;
}

/* Custom styles for smooth infinite scrolling */
#inventory-table .tabulator-tableholder {
  scroll-behavior: smooth;
  overflow-y: auto !important;
}

#inventory-table .tabulator-table {
  background: transparent;
}

/* Improve scrollbar appearance - specific to inventory table */
#inventory-table .tabulator-tableholder::-webkit-scrollbar {
  width: 8px;
}

#inventory-table .tabulator-tableholder::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}

#inventory-table .tabulator-tableholder::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
}

#inventory-table .tabulator-tableholder::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.5);
}

/* Add subtle animation for row rendering */
#inventory-table .tabulator-row {
  transition: opacity 0.1s ease-in-out;
}

/* Hover effects for character links in the table */
.tabulator-cell a {
  color: #374151;
  text-decoration: none;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  font-weight: 500;
}

.tabulator-cell a:hover {
  color: #111827;
  text-decoration: underline;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Dark mode support for links */
.dark .tabulator-cell a {
  color: #063171;
}

.dark .tabulator-cell a:hover {
  color: #0e4379;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.1);
}

/* Make character cells look more clickable */
.tabulator-cell[tabulator-field="character"] {
  cursor: pointer;
}

.tabulator-cell[tabulator-field="character"]:hover {
  background-color: rgba(156, 163, 175, 0.1);
}

.dark .tabulator-cell[tabulator-field="character"]:hover {
  background-color: rgba(209, 213, 219, 0.1);
}
