/**
 * Frontend Table Components - BEM Implementation
 * 
 * This file contains standardized table styles for all finance dashboard tables.
 * All tables use consistent formatting with compact row heights and alternating row colors.
 * 
 * BEM CLASSES: pms-table, pms-table__container, pms-table__header, pms-table__body, 
  * pms-table__row, pms-table__cell, pms-table__pagination, pms-bulk-actions, pms-checkbox, pms-data-table, pms-data-table__pagination
 * 
 * @package PMS
 * @since 1.0
 */

/* ===== CSS VARIABLES FOR CONSISTENCY ===== */
:root {
  /* Modern color palette */
  --pms-table-primary: #3b82f6;
  --pms-table-primary-hover: #2563eb;
  --pms-table-primary-light: #dbeafe;
  --pms-table-secondary: #6b7280;
  --pms-table-success: #10b981;
  --pms-table-warning: #f59e0b;
  --pms-table-error: #ef4444;

  /* Spacing and layout - Compact and consistent */
  --pms-table-cell-padding: 0.625rem 0.875rem;
  --pms-table-cell-padding-sm: 0.5rem 0.75rem;
  --pms-table-cell-padding-xs: 0.375rem 0.625rem;
  --pms-table-row-height: 2.25rem;
  --pms-table-row-height-sm: 2rem;
  --pms-table-row-height-xs: 1.75rem;

  /* Checkbox sizes - Standardized */
  --pms-checkbox-size: 20px;
  --pms-checkbox-size-sm: 18px;
  --pms-checkbox-size-lg: 22px;
  --pms-checkbox-size-mobile: 24px;

  /* Filter widths - Standardized */
  --pms-filter-width-sm: 180px;
  --pms-filter-width-md: 250px;
  --pms-filter-width-lg: 350px;
  --pms-filter-width-xl: 450px;
  --pms-filter-width-full: 100%;
  --pms-table-container-margin: 1.5rem;
  --pms-table-container-padding: 0;

  /* Borders and dividers */
  --pms-table-border-color: #e5e7eb;
  --pms-table-border-color-light: #f3f4f6;
  --pms-table-border-radius: 12px;
  --pms-table-border-radius-sm: 8px;

  /* Background colors */
  --pms-table-bg: #ffffff;
  --pms-table-header-bg: #f8fafc;
  --pms-table-header-bg-hover: #f1f5f9;
  --pms-table-row-hover-bg: #f8fafc;
  --pms-table-row-selected-bg: #eff6ff;
  --pms-table-stripe-bg: #f9fafb;

  /* Typography */
  --pms-table-header-color: #1f2937;
  --pms-table-text-color: #374151;
  --pms-table-text-muted: #6b7280;
  --pms-table-text-light: #9ca3af;
  --pms-table-font-size: 0.875rem;
  --pms-table-font-size-sm: 0.8125rem;
  --pms-table-font-weight: 500;
  --pms-table-font-weight-bold: 600;

  /* Shadows and effects */
  --pms-table-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --pms-table-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --pms-table-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);

  /* Transitions */
  --pms-table-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --pms-table-transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== TABLE BLOCK ===== */
/* Table Container */
.pms-table__container {
  background: var(--pms-table-bg);
  border-radius: var(--pms-table-border-radius);
  box-shadow: var(--pms-table-shadow);
  overflow: hidden;
  margin: var(--pms-table-container-margin) 0;
  border: 1px solid var(--pms-table-border-color-light);
  position: relative;
  transition: var(--pms-table-transition);
}

/* Responsive Table Container */
.pms-table__container--responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.pms-table__container--responsive::-webkit-scrollbar {
  height: 8px;
}

.pms-table__container--responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.pms-table__container--responsive::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.pms-table__container--responsive::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.pms-table__container:hover {
  box-shadow: var(--pms-table-shadow-hover);
}


/* ===== TABLE STYLES ===== */
.pms-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--pms-table-bg);
  font-size: var(--pms-table-font-size);
  line-height: 1.5;
}

/* Responsive Table */
.pms-table--responsive {
  min-width: 800px; /* Ensure minimum width for proper display */
}

/* Enhanced Responsive Table Container */
.pms-table__container--responsive {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #3b82f6 #f1f5f9;
  position: relative;
}

.pms-table__container--responsive::-webkit-scrollbar {
  height: 12px;
}

.pms-table__container--responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.pms-table__container--responsive::-webkit-scrollbar-thumb {
  background: #3b82f6;
  border-radius: 6px;
  border: 1px solid #2563eb;
}

.pms-table__container--responsive::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
  border-color: #1d4ed8;
}

.pms-table__container--responsive::-webkit-scrollbar-thumb:active {
  background: #1d4ed8;
}

/* Sticky Actions Column */
.pms-table__header--sticky,
.pms-table__cell--sticky {
  position: sticky !important;
  right: 0;
  z-index: 10;
  background: var(--pms-table-bg);
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
}

.pms-table__header--sticky {
  background: var(--pms-table-header-bg);
}

/* Table Actions Container */
.pms-table__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  min-width: 140px;
}

/* Table Action Buttons */
.pms-table__actions .pms-btn {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  min-width: auto;
  white-space: nowrap;
}

.pms-table__actions .pms-btn i {
  margin-right: 0.25rem;
  font-size: 0.75rem;
}

/* Table Cell Content */
.pms-table__cell-content {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pms-table__cell-content:hover {
  white-space: normal;
  word-wrap: break-word;
}

/* Wrapped Cell Content */
.pms-table__cell-content--wrapped {
  white-space: normal !important;
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
  max-height: 4.2em; /* Limit to ~3 lines */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.pms-table__cell-content--wrapped:hover {
  max-height: none;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

/* Table Header */
.pms-table__header {
  background: var(--pms-table-header-bg);
  padding: var(--pms-table-cell-padding) !important;
  text-align: left;
  font-weight: var(--pms-table-font-weight-bold);
  color: var(--pms-table-header-color);
  border-bottom: 1px solid var(--pms-table-border-color);
  font-size: var(--pms-table-font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.025em;
  position: relative;
  transition: var(--pms-table-transition);
}

/* Center checkbox in header cells */
.pms-table__header:has(input[type="checkbox"]),
.pms-table__header--checkbox {
  text-align: center;
}

.pms-table__header:hover {
  background: var(--pms-table-header-bg-hover);
}

.pms-table__header:first-child {
  border-top-left-radius: var(--pms-table-border-radius);
}

.pms-table__header:last-child {
  border-top-right-radius: var(--pms-table-border-radius);
}

/* Table Body */
.pms-table__body {
  transition: var(--pms-table-transition);
}

.pms-table__body:hover {
  background: var(--pms-table-row-hover-bg);
}

.pms-table__body:last-child .pms-table__cell {
  border-bottom: none;
}

/* Table Row */
.pms-table__row {
  min-height: var(--pms-table-row-height);
  height: auto;
  transition: var(--pms-table-transition);
  position: relative;
  border-left: 3px solid transparent;
  background: var(--pms-table-bg);
}

/* Table Row with wrapped content */
.pms-table__row:has(.pms-table__cell-content--wrapped) {
  min-height: calc(var(--pms-table-row-height) + 1rem);
}

.pms-table__row:hover {
  background: var(--pms-table-row-hover-bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  border-left-color: var(--pms-table-primary);
}

.pms-table__row:last-child .pms-table__cell {
  border-bottom: none;
}

.pms-table__row:nth-child(even) {
  background: var(--pms-table-stripe-bg);
}

.pms-table__row:nth-child(odd) {
  background: var(--pms-table-bg);
}

.pms-table__row:nth-child(even):hover {
  background: var(--pms-table-row-hover-bg);
}

.pms-table__row:nth-child(odd):hover {
  background: var(--pms-table-row-hover-bg);
}

.pms-table__row--selected {
  background: var(--pms-table-row-selected-bg) !important;
  border-left: 3px solid var(--pms-table-primary);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.pms-table__row--selected:hover {
  background: var(--pms-table-row-selected-bg) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.15);
}


/* ===== TABLE ROW SIZE VARIANTS ===== */
/* Small table rows */
.pms-table__row--sm {
  height: var(--pms-table-row-height-sm);
}

.pms-table__row--sm .pms-table__cell {
  padding: var(--pms-table-cell-padding-sm) !important;
}

/* Extra small table rows */
.pms-table__row--xs {
  height: var(--pms-table-row-height-xs);
}

.pms-table__row--xs .pms-table__cell {
  padding: var(--pms-table-cell-padding-xs) !important;
}

/* Table Cell */
.pms-table__cell {
  padding: var(--pms-table-cell-padding) !important;
  border-bottom: 1px solid var(--pms-table-border-color);
  vertical-align: middle;
  color: var(--pms-table-text-color);
  font-size: var(--pms-table-font-size);
  line-height: 1.5;
  transition: var(--pms-table-transition);
}

/* Table Cell Modifiers */
.pms-table__cell--center {
  text-align: center;
}

.pms-table__cell--right {
  text-align: right;
}

.pms-table__cell--left {
  text-align: left;
}

.pms-table__cell--muted {
  color: var(--pms-table-text-muted);
}

.pms-table__cell--light {
  color: var(--pms-table-text-light);
}

.pms-table__cell--primary {
  color: var(--pms-table-primary);
  font-weight: var(--pms-table-font-weight-bold);
}

.pms-table__cell--success {
  color: var(--pms-table-success);
}

.pms-table__cell--warning {
  color: var(--pms-table-warning);
}

.pms-table__cell--error {
  color: var(--pms-table-error);
}

.pms-table__cell button {
  margin: 0 2px;
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  border-radius: 8px;
  transition: var(--pms-table-transition);
  height: 24px;
  min-width: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pms-table__cell input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
  width: var(--pms-checkbox-size-sm);
  height: var(--pms-checkbox-size-sm);
  cursor: pointer;
  accent-color: var(--pms-table-primary);
  transition: var(--pms-table-transition);
}

.pms-table__cell input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pms-table__cell input[type="checkbox"]:focus {
  outline: 2px solid var(--pms-table-primary-light);
  outline-offset: 2px;
}

/* ===== TABLE PAGINATION ===== */
/* Table Pagination */
.pms-table__pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--pms-table-header-bg);
  border-top: 1px solid var(--pms-table-border-color);
  border-bottom-left-radius: var(--pms-table-border-radius);
  border-bottom-right-radius: var(--pms-table-border-radius);
}

/* Pagination info */
.pms-table__pagination-info {
  font-size: var(--pms-table-font-size-sm);
  color: var(--pms-table-text-muted);
  font-weight: var(--pms-table-font-weight);
}

/* Pagination controls */
.pms-table__pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Pagination button */
.pms-table__pagination-btn {
  padding: 0.625rem 1rem;
  border: 1px solid var(--pms-table-border-color);
  background: var(--pms-table-bg);
  color: var(--pms-table-text-color);
  font-size: var(--pms-table-font-size-sm);
  font-weight: var(--pms-table-font-weight);
  border-radius: var(--pms-table-border-radius-sm);
  cursor: pointer;
  transition: var(--pms-table-transition);
  min-width: 2.75rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.pms-table__pagination-btn:hover:not(:disabled) {
  background: var(--pms-table-row-hover-bg);
  border-color: var(--pms-table-primary);
  color: var(--pms-table-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pms-table__pagination-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.pms-table__pagination-btn:disabled {
  background: var(--pms-table-stripe-bg);
  color: var(--pms-table-text-light);
  cursor: not-allowed;
  border-color: var(--pms-table-border-color-light);
  transform: none;
  box-shadow: none;
}

.pms-table__pagination-btn--active {
  background: var(--pms-table-primary);
  color: #ffffff;
  border-color: var(--pms-table-primary);
  font-weight: var(--pms-table-font-weight-bold);
}

.pms-table__pagination-btn--active:hover:not(:disabled) {
  background: var(--pms-table-primary-hover);
  border-color: var(--pms-table-primary-hover);
  color: #ffffff;
}

.pms-table__pagination-btn--active:disabled {
  background: var(--pms-table-primary);
  color: #ffffff;
  border-color: var(--pms-table-primary);
}

/* Pagination ellipsis */
.pms-table__pagination-ellipsis {
  color: var(--pms-table-text-light);
  padding: 0 0.5rem;
  user-select: none;
  font-weight: var(--pms-table-font-weight-bold);
}


/* ===== BATCH TABLE STYLES ===== */
/* Fix Payment Batch Results Table */
/* Fix Payment Batch Results Table - Batch Modifier */
.pms-table--batch {
  width: 100%;
  max-height: none;
}

/* Header Specifics for Batch Table */
.pms-table--batch .pms-table__header {
  text-align: center;
  border-bottom-width: 2px;
}

/* Column Alignment Overrides */
/* Checkbox column */
.pms-table--batch .pms-table__header:first-child {
  text-align: center;
}

/* Name, RSU, Component, Category */
.pms-table--batch .pms-table__header:nth-child(2),
.pms-table--batch .pms-table__header:nth-child(3),
.pms-table--batch .pms-table__header:nth-child(4),
.pms-table--batch .pms-table__header:nth-child(5) {
  text-align: left;
}

/* Currency, Amount */
.pms-table--batch .pms-table__header:nth-child(6),
.pms-table--batch .pms-table__header:nth-child(7) {
  text-align: right;
}

/* Days, Remark */
.pms-table--batch .pms-table__header:nth-child(8),
.pms-table--batch .pms-table__header:nth-child(9) {
  text-align: center;
}

/* Body Styles */
.pms-table--batch .pms-table__body {
  height: auto;
  max-height: none;
}

/* Remove explicit row heights that might conflict with standard */
.pms-table--batch .pms-table__row {
  height: var(--pms-table-row-height-sm);
}

/* ===== ENHANCED CHECKBOX STYLES ===== */
.pms-checkbox {
  margin: 0;
  vertical-align: middle;
  cursor: pointer;
  width: var(--pms-checkbox-size);
  height: var(--pms-checkbox-size);
  accent-color: var(--pms-table-primary);
  transition: var(--pms-table-transition);
  border-radius: 4px;
  position: relative;
}

.pms-checkbox:focus {
  outline: 2px solid var(--pms-table-primary-light);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.pms-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.pms-checkbox:hover:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* Header checkbox specific styling */
.pms-table__header .pms-checkbox {
  margin: 0 auto;
  display: block;
  width: var(--pms-checkbox-size-lg);
  height: var(--pms-checkbox-size-lg);
}

/* Checkbox container for better alignment */
.pms-checkbox-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.pms-checkbox-container::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: var(--pms-table-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
  z-index: -1;
}

.pms-checkbox:checked + .pms-checkbox-container::before {
  width: 30px;
  height: 30px;
}

/* Custom checkbox styling for better visual appeal */
.pms-checkbox--custom {
  appearance: none;
  width: var(--pms-checkbox-size);
  height: var(--pms-checkbox-size);
  border: 2px solid var(--pms-table-border-color);
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: var(--pms-table-transition);
}

.pms-checkbox--custom:checked {
  background: var(--pms-table-primary);
  border-color: var(--pms-table-primary);
}

.pms-checkbox--custom:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
}

.pms-checkbox--custom:hover:not(:disabled) {
  border-color: var(--pms-table-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.pms-checkbox--custom:focus {
  outline: none;
  border-color: var(--pms-table-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== ENHANCED BULK ACTIONS ===== */
/* Note: Bulk actions styles are now standardized in bulk-actions.css */
.pms-bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 1rem;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.pms-bulk-actions::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--pms-table-primary) 0%,
    var(--pms-table-success) 50%,
    var(--pms-table-warning) 100%
  );
}

.pms-bulk-actions.hidden {
  display: none;
}

.pms-bulk-actions__info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #64748b;
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
  height: 36px;
  line-height: 1;
}

.pms-bulk-actions__count {
  background: #3b82f6;
  color: #ffffff;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
  min-width: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  line-height: 1;
}

.pms-bulk-actions__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: wrap;
  height: 36px;
}

.pms-bulk-actions__select-all {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  height: 36px;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
}

.pms-bulk-actions__select-all::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.pms-bulk-actions__select-all:hover::before {
  left: 100%;
}

.pms-bulk-actions__select-all:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.pms-bulk-actions__select-all:active {
  transform: translateY(0);
}

.pms-bulk-actions__select-all.selected {
  background: #10b981;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.pms-bulk-actions__select-all.selected:hover {
  background: #059669;
}

.pms-bulk-actions__dropdown {
  position: relative;
  min-width: 180px;
  flex-shrink: 0;
}

.pms-bulk-actions__dropdown-select {
  width: 100%;
  height: 36px;
  padding: 0.5rem 0.75rem;
  padding-right: 2rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1rem 1rem;
}

.pms-bulk-actions__dropdown-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pms-bulk-actions__dropdown-select:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

.pms-bulk-actions__apply {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  height: 36px;
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  line-height: 1;
}

.pms-bulk-actions__apply::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.pms-bulk-actions__apply:hover::before {
  left: 100%;
}

.pms-bulk-actions__apply:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.pms-bulk-actions__apply:active {
  transform: translateY(0);
}

.pms-bulk-actions__apply:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pms-bulk-actions__apply:disabled::before {
  display: none;
}

.pms-bulk-actions__checkbox {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pms-bulk-actions__checkbox:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ===== MODERN LOADING & EMPTY STATES ===== */
/* Loading state */
.pms-table__loading {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--pms-table-text-muted);
  background: var(--pms-table-bg);
  border-radius: var(--pms-table-border-radius);
  border: 1px solid var(--pms-table-border-color-light);
}

.pms-table__loading--spinner {
  color: var(--pms-table-primary);
}

.pms-table__loading-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.pms-table__loading-text {
  font-size: var(--pms-table-font-size);
  font-weight: var(--pms-table-font-weight);
  margin-top: 0.5rem;
}

/* Enhanced Empty state */
.pms-table__empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--pms-table-text-muted);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: var(--pms-table-border-radius);
  border: 2px dashed var(--pms-table-border-color);
  position: relative;
  overflow: hidden;
}

.pms-table__empty::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.03) 0%,
    transparent 70%
  );
  animation: float 6s ease-in-out infinite;
}

.pms-table__empty--large {
  padding: 5rem 2rem;
}

.pms-table__empty-icon {
  font-size: 4rem;
  color: var(--pms-table-text-light);
  margin-bottom: 1.5rem;
  opacity: 0.8;
  animation: pulse 2s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.pms-table__empty-title {
  margin-bottom: 0.75rem;
  color: var(--pms-table-text-color);
  font-weight: var(--pms-table-font-weight-bold);
  font-size: 1.25rem;
  position: relative;
  z-index: 1;
}

.pms-table__empty-description {
  margin-bottom: 2rem;
  color: var(--pms-table-text-muted);
  font-size: var(--pms-table-font-size);
  line-height: 1.6;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 1;
}

.pms-table__empty-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.pms-table__empty-button {
  padding: 0.875rem 2rem;
  background: linear-gradient(
    135deg,
    var(--pms-table-primary) 0%,
    var(--pms-table-primary-hover) 100%
  );
  color: #ffffff;
  border: none;
  border-radius: var(--pms-table-border-radius-sm);
  font-size: var(--pms-table-font-size);
  font-weight: var(--pms-table-font-weight-bold);
  cursor: pointer;
  transition: var(--pms-table-transition);
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
  position: relative;
  overflow: hidden;
}

.pms-table__empty-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.pms-table__empty-button:hover::before {
  left: 100%;
}

.pms-table__empty-button:hover {
  background: linear-gradient(
    135deg,
    var(--pms-table-primary-hover) 0%,
    #1d4ed8 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.pms-table__empty-button:active {
  transform: translateY(0);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* Error state */
.pms-table__error {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--pms-table-error);
  background: #fef2f2;
  border-radius: var(--pms-table-border-radius);
  border: 1px solid #fecaca;
}

.pms-table__error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.pms-table__error-title {
  margin-bottom: 0.5rem;
  color: var(--pms-table-error);
  font-weight: var(--pms-table-font-weight-bold);
  font-size: 1.125rem;
}

.pms-table__error-description {
  margin-bottom: 1.5rem;
  color: #991b1b;
  font-size: var(--pms-table-font-size);
}

/* ===== ENHANCED RESPONSIVE DESIGN ===== */
/* Tablet and Mobile Responsive Design */
@media (max-width: 1024px) {
  .pms-table__container--responsive {
    margin: 1rem 0.5rem;
    border-radius: var(--pms-table-border-radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .pms-table--responsive {
    min-width: 900px; /* Slightly larger for better readability */
  }

  .pms-table__cell {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem;
  }

  .pms-table__header {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  .pms-table__container {
    margin: 1rem 0.5rem;
    border-radius: var(--pms-table-border-radius-sm);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .pms-table__row {
    height: var(--pms-table-row-height-xs);
  }

  .pms-table__cell {
    padding: var(--pms-table-cell-padding-xs) !important;
    font-size: var(--pms-table-font-size-sm);
  }

  .pms-table__header {
    padding: var(--pms-table-cell-padding-xs) !important;
    font-size: 0.75rem;
  }


  .pms-table__pagination {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .pms-table__pagination-controls {
    justify-content: center;
  }

  .pms-table__empty-actions {
    flex-direction: column;
    align-items: center;
  }

  /* Enhanced bulk actions for mobile */
  .pms-bulk-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .pms-bulk-actions__info {
    justify-content: center;
    text-align: center;
  }

  .pms-bulk-actions__controls {
    margin-left: 0;
    flex-direction: column;
    gap: 0.5rem;
  }

  .pms-bulk-actions__select-all,
  .pms-bulk-actions__apply {
    width: 100%;
    justify-content: center;
  }

  .pms-bulk-actions__dropdown {
    min-width: auto;
    width: 100%;
  }

  /* Mobile table improvements */
  .pms-table__row:hover {
    transform: none;
    box-shadow: none;
  }

  .pms-table__row--selected:hover {
    transform: none;
  }

  /* Mobile checkbox improvements */
  .pms-checkbox {
    width: var(--pms-checkbox-size-mobile);
    height: var(--pms-checkbox-size-mobile);
  }

  .pms-table__header .pms-checkbox {
    width: var(--pms-checkbox-size-mobile);
    height: var(--pms-checkbox-size-mobile);
  }
}

@media (max-width: 480px) {
  .pms-table__container {
    margin: 0.5rem;
  }

  .pms-table__row {
    height: 1.75rem;
  }

  .pms-table__cell {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.75rem;
  }

  .pms-table__header {
    padding: 0.375rem 0.5rem !important;
    font-size: 0.6875rem;
  }

  .pms-table__pagination-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    min-width: 2rem;
  }
}


/* Enhanced mobile scrollbar */
@media (max-width: 768px) {
  .pms-table__container--responsive::-webkit-scrollbar {
    height: 6px;
  }

  .pms-table__container--responsive::-webkit-scrollbar-thumb {
    background: #3b82f6;
    border-radius: 3px;
  }

  .pms-table__container--responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
  }
}

