/* ========================================
   TABLE COMPONENTS
   NO orange backgrounds - white/gray only
   ======================================== */

/* Base Table */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table th,
.table td {
  padding: var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.table th {
  background: var(--bg-gray-50);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.table tbody tr:hover {
  background: var(--bg-gray-50);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Table Variants */
.table-bordered {
  border: 1px solid var(--border-light);
}

.table-bordered th,
.table-bordered td {
  border-right: 1px solid var(--border-light);
}

.table-bordered th:last-child,
.table-bordered td:last-child {
  border-right: none;
}

.table-striped tbody tr:nth-child(even) {
  background: var(--bg-gray-50);
}

.table-hover tbody tr:hover {
  background: var(--bg-gray-100);
}

.table-compact th,
.table-compact td {
  padding: var(--space-2) var(--space-3);
}

.table-large th,
.table-large td {
  padding: var(--space-6);
}

/* Table Header */
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--bg-gray-50);
  border-bottom: 1px solid var(--border-light);
}

.table-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Table Footer */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--bg-gray-50);
  border-top: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.table-pagination {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table-pagination .btn {
  padding: var(--space-1) var(--space-2);
  font-size: 0.875rem;
}

/* Table Cell Variants */
.table-cell-center {
  text-align: center;
}

.table-cell-right {
  text-align: right;
}

.table-cell-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table-cell-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Table Cell with Icon */
.table-cell-icon {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table-cell-icon .icon {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
}

/* Table Cell with Avatar */
.table-cell-avatar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table-cell-avatar img {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
}

/* Table Cell with Badge */
.table-cell-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

/* Table Cell with Actions */
.table-cell-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table-cell-actions .btn {
  padding: var(--space-1) var(--space-2);
  font-size: 0.875rem;
}

/* Table Cell with Status */
.table-cell-status {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.table-cell-status.online {
  color: var(--success);
}

.table-cell-status.offline {
  color: var(--text-muted);
}

.table-cell-status.busy {
  color: var(--warning);
}

.table-cell-status.away {
  color: var(--error);
}

.table-cell-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Table Cell with Progress */
.table-cell-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table-cell-progress .progress-bar {
  flex: 1;
  height: 0.5rem;
  background: var(--bg-gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.table-cell-progress .progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.table-cell-progress .progress-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 2rem;
  text-align: right;
}

/* Table Cell with Rating */
.table-cell-rating {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.table-cell-rating .star {
  color: var(--primary);
  font-size: 0.875rem;
}

.table-cell-rating .star.empty {
  color: var(--border-medium);
}

/* Table Cell with Date */
.table-cell-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* Table Cell with Currency */
.table-cell-currency {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Table Cell with Boolean */
.table-cell-boolean {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-cell-boolean.true {
  color: var(--success);
}

.table-cell-boolean.false {
  color: var(--error);
}

/* Table Cell with Link */
.table-cell-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.table-cell-link:hover {
  text-decoration: underline;
}

/* Table Cell with Image */
.table-cell-image {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  object-fit: cover;
}

.table-cell-image-sm {
  width: 2rem;
  height: 2rem;
}

.table-cell-image-lg {
  width: 4rem;
  height: 4rem;
}

/* Table Cell with Checkbox */
.table-cell-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-cell-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

/* Table Cell with Radio */
.table-cell-radio {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-cell-radio input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

/* Table Cell with Switch */
.table-cell-switch {
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-cell-switch .switch {
  position: relative;
  width: 3rem;
  height: 1.5rem;
  background: var(--border-medium);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.table-cell-switch .switch.active {
  background: var(--primary);
}

.table-cell-switch .switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--bg-white);
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.table-cell-switch .switch.active::after {
  transform: translateX(1.5rem);
}

/* Table Cell with Dropdown */
.table-cell-dropdown {
  position: relative;
}

.table-cell-dropdown .dropdown-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease;
}

.table-cell-dropdown .dropdown-toggle:hover {
  background: var(--bg-gray-100);
}

.table-cell-dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 150px;
  padding: var(--space-2);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.table-cell-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.table-cell-dropdown .dropdown-item {
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background-color 0.2s ease;
}

.table-cell-dropdown .dropdown-item:hover {
  background: var(--bg-gray-50);
  color: var(--text-primary);
}

/* Table Cell with Tooltip */
.table-cell-tooltip {
  position: relative;
  cursor: help;
}

.table-cell-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--text-white);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
}

.table-cell-tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Table Cell with Loading */
.table-cell-loading {
  position: relative;
  pointer-events: none;
}

.table-cell-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: var(--space-2);
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border-light);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translateY(-50%);
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Table Cell with Empty State */
.table-cell-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: var(--space-8);
}

/* Table Cell with Error */
.table-cell-error {
  color: var(--error);
  font-size: 0.75rem;
}

/* Table Cell with Success */
.table-cell-success {
  color: var(--success);
  font-size: 0.75rem;
}

/* Table Cell with Warning */
.table-cell-warning {
  color: var(--warning);
  font-size: 0.75rem;
}

/* Table Cell with Info */
.table-cell-info {
  color: var(--info);
  font-size: 0.75rem;
}

/* Responsive Table */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
  }
  
  .table {
    min-width: 600px;
  }
  
  .table th,
  .table td {
    padding: var(--space-2) var(--space-3);
  }
  
  .table-header,
  .table-footer {
    padding: var(--space-3);
  }
  
  .table-actions {
    gap: var(--space-2);
  }
  
  .table-pagination {
    gap: var(--space-1);
  }
}
