* {
  box-sizing: border-box;
}

:root {
  --primary-color: #064ea7;
  --secondary-color: gold;
  --text-color: white;
  --success-color: #28a745;
  --danger-color: #dc3545;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: var(--text-color);
  padding: 0;
  margin: 0;
  min-height: 100vh;
}

.main-container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 80vh;
}

.main-header {
  background: var(--header-bg-color, rgba(6, 78, 167, 0.95));
  backdrop-filter: blur(15px);
  border-bottom: 2px solid var(--secondary-color);
  padding: 1rem 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-arrow-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
}

.back-arrow-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(-2px);
}

.header-logo {
  width: 48px;
  height: 48px;
  background: var(--secondary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 1.8rem;
  font-weight: 600;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  margin: 0;
}

.header-title .subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
}

.header-center {
  text-align: center;
  flex-grow: 1;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 300;
  color: #ffffff;
  margin: 0 0 0.25rem 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dashboard-subtitle {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 300;
  margin: 0;
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* Dropdown Styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dropdown-arrow {
  font-size: 12px;
  transition: transform 0.3s ease;
}

.dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--primary-color);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(15px);
  min-width: 200px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: white;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropdown-item.disabled:hover {
  background: none;
}

.dropdown-item:first-child {
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
}

.dropdown-item:last-child {
  border-bottom-left-radius: 7px;
  border-bottom-right-radius: 7px;
}

.dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 4px 0;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  min-width: 200px;
}

.header-search-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 12px;
  padding: 4px 6px;
  flex: 1;
  min-width: 120px;
}

.header-search-input:focus {
  outline: none;
}

.header-search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

.header-search-stats {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  padding: 2px 4px;
  font-size: 9px;
  color: #4caf50;
  font-family: "Courier New", monospace;
  white-space: nowrap;
  border-left: 1px solid #4caf50;
}

.header-search-clear {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: 3px;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 9px;
  transition: all 0.2s ease;
}

.header-search-clear:hover {
  background: rgba(244, 67, 54, 0.3);
}

.header-search-clear.hidden {
  display: none;
}

.content-area {
  padding: 20px 10px 5px 10px; /* Further reduced bottom padding to 5px */
  min-height: calc(100vh - 80px); /* Maximized content area height */
}

.status-bar {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 10px 15px;
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #ffffff;
}

.status-bar .status-left {
  display: flex;
  gap: 20px;
  align-items: center;
}

.status-bar .status-right {
  display: flex;
  gap: 15px;
  align-items: center;
}

.status-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 4px 8px;
  border-left: 2px solid #4caf50;
  font-family: "Courier New", monospace;
  font-size: 11px;
}

.status-item.selected {
  border-left-color: #ff9800;
  background: rgba(255, 152, 0, 0.1);
}

.status-item.hidden {
  display: none;
}

.search-filter {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  flex: 1;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: #4caf50;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.search-stats {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11px;
  color: #4caf50;
  font-family: "Courier New", monospace;
  border-left: 2px solid #4caf50;
  white-space: nowrap;
}

.search-clear {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.2s ease;
}

.search-clear:hover {
  background: rgba(244, 67, 54, 0.3);
  transform: translateY(-1px);
}

.search-clear.hidden {
  display: none;
}

h1 {
  color: #ffffff;
  margin: 0;
  font-size: 1.3rem;
  font-weight: 300;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#hub-name-display {
  color: #ffd600;
  font-weight: 500;
}

.header-panel {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.controls-panel {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.button-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.button-group h3 {
  margin: 0 0 6px 0;
  color: #ffffff;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 4px;
}

.header-btn {
  background: var(--secondary-color);
  color: var(--primary-color);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.header-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  background: #e6c200;
}

.header-btn.btn-primary {
  background: var(--secondary-color);
  color: var(--primary-color);
}

.header-btn.btn-secondary {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--secondary-color);
}

.header-btn.btn-warning {
  background: linear-gradient(135deg, var(--secondary-color), #e6ac00);
  color: var(--primary-color);
}

.header-btn.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
}

.header-btn.btn-test {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--secondary-color);
}

.header-btn.sort-selected-btn {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--secondary-color);
}

.header-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--secondary-color);
  color: var(--primary-color);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 4px rgba(76, 175, 80, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.btn-secondary {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--secondary-color);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 11px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(6, 78, 167, 0.3);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(6, 78, 167, 0.4);
  border-color: var(--secondary-color);
}

.btn-warning {
  background: linear-gradient(135deg, var(--secondary-color), #e6ac00);
  color: var(--primary-color);
  border: none;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 11px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(255, 215, 0, 0.3);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
}

.btn-warning:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  border: 1px solid rgba(220, 38, 38, 0.5);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 11px;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.3);
  min-height: 32px;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4);
  border-color: rgba(220, 38, 38, 0.7);
}

/* Column Visibility Popup */
.column-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.column-popup {
  background: var(--primary-color);
  border: 2px solid var(--secondary-color);
  border-radius: 15px;
  padding: 24px;
  width: 90%;
  max-width: 450px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: popupFadeIn 0.3s ease;
}

/* Bulk Operations Popup */
.bulk-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.bulk-popup {
  background: var(--primary-color);
  border: 2px solid var(--secondary-color);
  border-radius: 15px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: popupFadeIn 0.3s ease;
}

.bulk-operations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.bulk-operation {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  transition: background 0.2s ease;
}

.bulk-operation:hover {
  background: rgba(255, 255, 255, 0.1);
}

.bulk-operation h4 {
  color: #ffffff;
  margin: 0 0 8px 0;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bulk-input {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 8px;
}

.bulk-input:focus {
  outline: none;
  border-color: #4caf50;
  background: rgba(255, 255, 255, 0.15);
}

.bulk-btn {
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 11px;
  transition: all 0.3s ease;
  margin-top: 4px;
}

.bulk-btn.danger {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
}

.bulk-btn.primary {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
}

.bulk-btn.warning {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: white;
}

.bulk-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

/* Checkbox styling */
.row-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #4caf50;
}

.select-all-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4caf50;
}

@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.column-popup h3 {
  color: #ffffff;
  margin: 0 0 20px 0;
  font-size: 1.4rem;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 12px;
}

/* Spacing Toggle Styles */
.spacing-toggle-section {
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.spacing-toggle-label {
  display: block;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}

.spacing-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.spacing-toggle-text {
  color: #ffffff;
  font-size: 13px;
  font-weight: 400;
  transition: opacity 0.3s ease;
}

.spacing-toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.spacing-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.spacing-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: 0.3s;
  border-radius: 12px;
}

.spacing-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--secondary-color);
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .spacing-toggle-slider {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

input:checked + .spacing-toggle-slider:before {
  transform: translateX(26px);
  background-color: var(--primary-color);
}

.spacing-toggle-slider:hover {
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.column-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.column-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.column-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.column-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #4caf50;
}

.column-option label {
  color: #ffffff;
  cursor: pointer;
  font-size: 14px;
  flex: 1;
  margin: 0;
}

.popup-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  justify-content: center;
}

.popup-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.3s ease;
  min-width: 80px;
}

.popup-btn.primary {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
}

.popup-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.popup-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile responsive for column popup */
@media (max-width: 768px) {
  .column-popup {
    width: 95%;
    max-width: 350px;
    padding: 20px;
    margin: 10px;
  }

  .column-popup h3 {
    font-size: 1.2rem;
  }

  .column-option {
    padding: 10px;
  }

  .column-option label {
    font-size: 13px;
  }

  .popup-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .popup-btn {
    width: 100%;
    padding: 12px;
  }
}

.data-panel {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  max-height: calc(100vh - 160px); /* Extended grid to almost reach footer */
  overflow: auto;
  /* Ensure sticky positioning works */
  contain: layout style paint;
}

.table-container {
  min-width: 1200px;
  position: relative;
  /* Support sticky headers */
  overflow-anchor: none;
}

/* Responsive table container */
@media (max-width: 1200px) {
  .table-container {
    min-width: 100%;
  }
}

/* Tablet responsive design */
@media (max-width: 1024px) and (min-width: 769px) {
  .content-area {
    padding: 15px;
  }

  .main-header {
    padding: 12px;
  }

  .header-right {
    gap: 6px;
  }

  .header-btn {
    font-size: 11px;
    padding: 8px 12px;
  }

  table {
    font-size: 12px;
    min-width: 900px;
  }

  th,
  td {
    padding: 6px 1px;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px;
  position: relative;
}

/* Freeze the first two columns (ID and Select) */
th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  position: sticky !important;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10 !important;
}

th:first-child,
td:first-child {
  left: 0;
  border-right: 2px solid rgba(255, 255, 255, 0.4);
  width: 65px;
  min-width: 65px;
  max-width: 65px;
}

th:nth-child(2),
td:nth-child(2) {
  left: 65px; /* Adjust based on first column width */
  border-right: 3px solid rgba(76, 175, 80, 0.5);
  width: 50px;
  min-width: 50px;
  max-width: 50px;
}

th:first-child,
th:nth-child(2) {
  background: rgba(0, 0, 0, 0.95);
  z-index: 25 !important;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

th {
  position: sticky !important;
  top: 0 !important;
  background: rgba(0, 0, 0, 0.9);
  padding: 8px 2px;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: #ffffff;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
  z-index: 15 !important;
}

.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  position: relative;
}

.sortable:hover {
  background: rgba(76, 175, 80, 0.3) !important;
}

.sortable::after {
  content: " ⇅";
  font-size: 8px;
  opacity: 0.5;
}

.sortable.asc::after {
  content: " ↑";
  color: #4caf50;
  opacity: 1;
}

.sortable.desc::after {
  content: " ↓";
  color: #f44336;
  opacity: 1;
}

/* Sort Selected Button Styles */
.sort-selected-btn {
  transition: all 0.3s ease;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sort-selected-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

td {
  padding: 6px 2px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  vertical-align: middle;
}

/* Alternating row colors for better readability */
#dpTable tbody tr:nth-child(even) {
  background: rgba(
    6,
    78,
    167,
    0.25
  ) !important; /* More pronounced blue for even rows */
}

#dpTable tbody tr:nth-child(odd) {
  background: rgba(
    0,
    123,
    255,
    0.15
  ) !important; /* Different shade of blue for odd rows */
}

/* Hover effect that works with alternating colors */
#dpTable tbody tr:hover {
  background: rgba(255, 215, 0, 0.2) !important; /* Gold hover effect */
}

/* Keep header row separate */
#dpTable thead tr {
  background: rgba(0, 0, 0, 0.3) !important;
}

tr:hover {
  background: rgba(255, 255, 255, 0.1);
}

input {
  padding: 3px 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 4px;
  font-size: 11px;
  transition: all 0.2s ease;
}

input:focus {
  outline: none;
  border-color: #4caf50;
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.pin-container input {
  width: 40px;
}

.id-input {
  width: 40px;
}

input[type="datetime-local"] {
  width: 140px;
}

.message-input {
  width: 200px;
}

.qr-text-input {
  width: 100px;
}

.qr-value-input {
  width: 80px;
}

.pin-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.table-btn {
  padding: 3px 4px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin: 0;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-btn:hover {
  transform: translateY(-1px);
}

.lock {
  background: var(--primary-color) !important;
  color: var(--secondary-color) !important;
  border: 1px solid var(--secondary-color) !important;
  font-weight: bold;
}

/* Compact Mode Styles */
.compact-mode th {
  padding: 4px 1px !important;
  min-width: unset !important;
  width: auto !important;
}

.compact-mode td {
  padding: 3px 1px !important;
  min-width: unset !important;
  width: auto !important;
}

.compact-mode .table-btn {
  padding: 2px 3px !important;
  min-width: 18px !important;
  height: 18px !important;
  font-size: 9px !important;
}

.compact-mode input {
  padding: 2px 3px !important;
  font-size: 10px !important;
  min-width: 40px !important;
  width: auto !important;
}

/* Force compact column widths - override any existing width constraints */
.compact-mode th:not(:first-child):not(:nth-child(2)) {
  min-width: 60px !important;
  max-width: 120px !important;
  width: auto !important;
}

.compact-mode td:not(:first-child):not(:nth-child(2)) {
  min-width: 60px !important;
  max-width: 120px !important;
  width: auto !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Keep first two columns (ID and Select) fixed but compact */
.compact-mode th:first-child,
.compact-mode td:first-child {
  width: 45px !important;
  min-width: 45px !important;
  max-width: 45px !important;
}

.compact-mode th:nth-child(2),
.compact-mode td:nth-child(2) {
  width: 35px !important;
  min-width: 35px !important;
  max-width: 35px !important;
  left: 45px !important;
}

/* Compact Rows Styles */
.compact-rows th {
  padding: 4px 2px !important;
  font-size: 9px !important;
  line-height: 1.2 !important;
}

.compact-rows td {
  padding: 2px 2px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
}

.compact-rows .table-btn {
  padding: 1px 2px !important;
  min-width: 16px !important;
  height: 16px !important;
  font-size: 8px !important;
}

.compact-rows input {
  padding: 1px 2px !important;
  font-size: 9px !important;
  height: 16px !important;
}

/* Combined compact mode and compact rows */
.compact-mode.compact-rows th {
  padding: 2px 1px !important;
  font-size: 8px !important;
  min-width: unset !important;
  width: auto !important;
}

.compact-mode.compact-rows td {
  padding: 1px 1px !important;
  font-size: 10px !important;
  min-width: unset !important;
  width: auto !important;
}

.compact-mode.compact-rows .table-btn {
  padding: 1px 2px !important;
  min-width: 14px !important;
  height: 14px !important;
  font-size: 7px !important;
}

.compact-mode.compact-rows input {
  padding: 1px 2px !important;
  font-size: 8px !important;
  height: 14px !important;
  min-width: 30px !important;
  width: auto !important;
}

/* Ultra compact column widths */
.compact-mode.compact-rows th:not(:first-child):not(:nth-child(2)) {
  min-width: 50px !important;
  max-width: 100px !important;
}

.compact-mode.compact-rows td:not(:first-child):not(:nth-child(2)) {
  min-width: 50px !important;
  max-width: 100px !important;
}

.unlock {
  background: var(--secondary-color) !important;
  color: var(--primary-color) !important;
  border: 1px solid var(--primary-color) !important;
  font-weight: bold;
}

.delete-btn {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  border: 1px solid rgba(220, 38, 38, 0.5);
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

.delete-btn:hover {
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.4);
}

.flip-btn {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--secondary-color);
  box-shadow: 0 2px 4px rgba(6, 78, 167, 0.3);
}

.flip-btn:hover {
  box-shadow: 0 3px 8px rgba(6, 78, 167, 0.4);
}

.quick-btn {
  background: linear-gradient(135deg, var(--secondary-color), #e6ac00);
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
}

.quick-btn:hover {
  box-shadow: 0 3px 8px rgba(255, 215, 0, 0.4);
}

.engagement-btn {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--secondary-color);
  box-shadow: 0 2px 4px rgba(6, 78, 167, 0.3);
}

.engagement-btn:hover {
  box-shadow: 0 3px 8px rgba(6, 78, 167, 0.4);
}

.status-active {
  background: white;
  border: 1px solid var(--secondary-color) !important;
  color: var(--secondary-color);
}

.status-inactive {
  background: white;
  border: 1px solid #dc2626 !important;
  color: #dc2626;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .main-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    padding: 15px;
  }

  .header-left {
    align-items: center;
    justify-content: center;
  }

  .header-logo {
    width: 28px;
    height: 28px;
  }

  .header-title-section {
    text-align: center;
  }

  .header-search {
    width: 100%;
    min-width: auto;
    margin: 0 5px;
  }

  .header-search-input {
    font-size: 13px;
  }

  .header-right {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .header-btn {
    width: 100%;
    justify-content: center;
  }

  .content-area {
    padding: 10px;
  }

  h1 {
    font-size: 1.1rem;
  }

  .tenant-info {
    font-size: 9px;
  }

  /* Table mobile optimization */
  .table-container {
    min-width: auto;
    overflow-x: auto;
  }

  table {
    font-size: 11px;
    min-width: 800px; /* Reduced from 1200px */
  }

  th,
  td {
    padding: 6px 1px;
    min-width: 45px;
  }

  /* Adjust frozen column widths for mobile */
  th:first-child,
  td:first-child {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
  }

  th:nth-child(2),
  td:nth-child(2) {
    left: 50px;
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }

  input {
    font-size: 10px;
    padding: 3px 4px;
  }

  .table-btn {
    min-width: 18px;
    height: 18px;
    font-size: 9px;
    padding: 2px 3px;
  }

  .search-filter {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .search-input {
    font-size: 13px;
    padding: 8px 10px;
  }

  .search-stats,
  .search-clear {
    font-size: 10px;
    align-self: center;
  }

  /* Override hide-mobile when column is explicitly made visible */
  th.hide-mobile:not(.column-hidden),
  td.hide-mobile:not(.column-hidden) {
    display: table-cell !important;
  }
}

/* Hide some columns on mobile */
@media (max-width: 480px) {
  .hide-mobile {
    display: none;
  }

  /* Override hide-mobile when column is explicitly made visible */
  th.hide-mobile:not(.column-hidden),
  td.hide-mobile:not(.column-hidden) {
    display: table-cell !important;
  }

  .content-area {
    padding: 5px;
  }

  .header-right {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .header-btn {
    width: auto;
    flex: 1;
    min-width: 80px;
    font-size: 10px;
    padding: 6px 8px;
  }

  /* More aggressive table optimization for small screens */
  table {
    font-size: 10px;
    min-width: 600px; /* Further reduced for very small screens */
  }

  th,
  td {
    padding: 4px 2px;
    min-width: 35px;
  }

  /* Further reduce frozen column widths */
  th:first-child,
  td:first-child {
    width: 45px;
    min-width: 45px;
    max-width: 45px;
  }

  th:nth-child(2),
  td:nth-child(2) {
    left: 45px;
    width: 35px;
    min-width: 35px;
    max-width: 35px;
  }

  .table-btn {
    min-width: 18px;
    height: 18px;
    font-size: 8px;
    padding: 1px 3px;
  }
}

/* Portrait orientation specific overrides */
@media (max-width: 768px) and (orientation: portrait) {
  /* Override hide-mobile when column is explicitly made visible in portrait */
  th.hide-mobile:not(.column-hidden),
  td.hide-mobile:not(.column-hidden) {
    display: table-cell !important;
  }
}

/* Very small screens and portrait phones */
@media (max-width: 414px) {
  /* Override hide-mobile when column is explicitly made visible */
  th.hide-mobile:not(.column-hidden),
  td.hide-mobile:not(.column-hidden) {
    display: table-cell !important;
  }
}

/* Dark scrollbar styling */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.6);
  background-clip: content-box;
}

.table-container::-webkit-scrollbar {
  height: 14px;
}

.table-container::-webkit-scrollbar-thumb {
  background: rgba(76, 175, 80, 0.7);
  border-radius: 7px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(76, 175, 80, 0.9);
  background-clip: content-box;
}

/* Footer */
/* Specific styling for action columns (Display, Quick, Engagement, Delete) */
td:nth-child(14), /* Display */
td:nth-child(15), /* Quick */
td:nth-child(16), /* Engagement */
td:nth-child(17) {
  /* Delete */
  padding: 4px 1px;
  width: 30px;
  min-width: 30px;
  max-width: 30px;
}

/* Corresponding header cells for action columns */
th:nth-child(14),
th:nth-child(15),
th:nth-child(16),
th:nth-child(17) {
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  padding: 6px 1px;
}

/* Column visibility system - ensure it overrides hide-mobile */
.column-hidden {
  display: none !important;
}

/* Ensure visible columns show even if they have hide-mobile class - High specificity */
table th:not(.column-hidden),
table td:not(.column-hidden) {
  display: table-cell !important;
}

/* Ultra-specific override for mobile hide-mobile classes */
@media (max-width: 768px) {
  table th.hide-mobile:not(.column-hidden),
  table td.hide-mobile:not(.column-hidden) {
    display: table-cell !important;
  }
}

/* Portrait specific overrides with high specificity */
@media (orientation: portrait) {
  table th.hide-mobile:not(.column-hidden),
  table td.hide-mobile:not(.column-hidden) {
    display: table-cell !important;
  }
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #064ea7;
  color: white;
  padding: 1rem;
  text-align: center;
  z-index: 500;
}

.footer p {
  margin: 0;
}
