/**
 * Entity Table Styles - BOMAtlas
 * Modern, dark theme table with enhanced UX
 */

.entity-table-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0d1117;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Toolbar */
.entity-table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-left {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Search */
.table-search-container {
  position: relative;
}

.table-search-container .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #6e7681;
  pointer-events: none;
}

.table-search-input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #e6edf3;
  font-size: 14px;
  transition: all 0.2s ease;
}

.table-search-input:focus {
  outline: none;
  border-color: #d4a012;
  background: rgba(212, 160, 18, 0.05);
  box-shadow: 0 0 0 3px rgba(212, 160, 18, 0.1);
}

.table-search-input::placeholder {
  color: #6e7681;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #8b949e;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
  background: rgba(212, 160, 18, 0.15);
  color: #d4a012;
}

.mode-btn svg {
  flex-shrink: 0;
}

/* Entity Count */
.entity-count {
  color: #8b949e;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

/* Action Button */
.table-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(212, 160, 18, 0.1);
  border: 1px solid rgba(212, 160, 18, 0.3);
  border-radius: 8px;
  color: #d4a012;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-action-btn:hover {
  background: rgba(212, 160, 18, 0.2);
  border-color: rgba(212, 160, 18, 0.5);
  transform: translateY(-1px);
}

.table-action-btn svg {
  flex-shrink: 0;
}

/* Table Container */
.entity-table-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Table */
.entity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.entity-table th {
  position: sticky;
  top: 0;
  background: #161b22;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #8b949e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  z-index: 10;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.entity-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.entity-table th.sortable:hover {
  color: #e6edf3;
}

.entity-table th.active {
  color: #d4a012;
}

.entity-table th .sort-icon {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.4;
  font-size: 10px;
}

.entity-table th.sortable .sort-icon::after {
  content: '↕';
}

.entity-table th.active.asc .sort-icon::after {
  content: '↑';
  opacity: 1;
}

.entity-table th.active.desc .sort-icon::after {
  content: '↓';
  opacity: 1;
}

/* Table Rows */
.entity-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.entity-table tbody tr.odd {
  background: rgba(255, 255, 255, 0.02);
}

.entity-table tbody tr:hover {
  background: rgba(212, 160, 18, 0.06);
}

.entity-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* Company Column */
.company-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.company-name {
  font-weight: 500;
  color: #e6edf3;
  line-height: 1.4;
}

.company-uei {
  font-size: 11px;
  color: #6e7681;
  font-family: ui-monospace, monospace;
}

/* Location */
.location-text {
  color: #8b949e;
}

/* Type Badge */
.type-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: rgba(255, 255, 255, 0.08);
  color: #8b949e;
}

.type-badge.badge-sba {
  background: rgba(46, 160, 67, 0.15);
  color: #3fb950;
}

.type-badge.badge-small {
  background: rgba(56, 139, 253, 0.15);
  color: #58a6ff;
}

.type-badge.badge-mfg {
  background: rgba(163, 113, 247, 0.15);
  color: #bc8cff;
}

.type-badge.badge-diversity {
  background: rgba(255, 123, 114, 0.15);
  color: #ff7b72;
}

/* Website Link */
.website-link {
  color: #58a6ff;
  text-decoration: none;
  font-size: 12px;
  transition: color 0.15s;
}

.website-link:hover {
  color: #79c0ff;
  text-decoration: underline;
}

.text-muted {
  color: #484f58;
}

/* Actions */
.action-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #8b949e;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e6edf3;
  border-color: rgba(255, 255, 255, 0.2);
}

.action-btn.action-map {
  background: rgba(212, 160, 18, 0.1);
  border-color: rgba(212, 160, 18, 0.2);
  color: #d4a012;
}

.action-btn.action-map:hover {
  background: rgba(212, 160, 18, 0.2);
  border-color: rgba(212, 160, 18, 0.4);
}

.action-btn.action-visit {
  padding: 6px 8px;
}

.action-btn.action-edit {
  padding: 6px 8px;
}

.action-btn svg {
  flex-shrink: 0;
}

/* Footer */
.entity-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #161b22;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  gap: 16px;
  flex-wrap: wrap;
}

.pagination-info {
  color: #8b949e;
  font-size: 13px;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #8b949e;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #e6edf3;
  border-color: rgba(255, 255, 255, 0.2);
}

.page-btn.active {
  background: rgba(212, 160, 18, 0.15);
  border-color: rgba(212, 160, 18, 0.3);
  color: #d4a012;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn.page-prev,
.page-btn.page-next {
  font-size: 16px;
  font-weight: 400;
}

.page-ellipsis {
  color: #6e7681;
  padding: 0 4px;
}

/* Page Size Selector */
.page-size-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-size-selector label {
  color: #6e7681;
  font-size: 13px;
}

.page-size-selector select {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #e6edf3;
  font-size: 13px;
  cursor: pointer;
}

.page-size-selector select:focus {
  outline: none;
  border-color: #d4a012;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #6e7681;
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 15px;
  margin: 0;
}

/* Skeleton Loading */
.skeleton-row td {
  padding: 16px;
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .entity-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left {
    max-width: none;
  }

  .toolbar-right {
    justify-content: space-between;
  }

  .entity-table-footer {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .entity-table {
    font-size: 12px;
  }

  .entity-table th,
  .entity-table td {
    padding: 10px 12px;
  }

  .col-website,
  .col-type {
    display: none;
  }

  .action-btn {
    padding: 8px;
  }

  .action-btn span {
    display: none;
  }
}
