.results-table-container {
  padding: 1rem;
}

.table-responsive {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.table {
  margin-bottom: 0;
}

.table th {
  white-space: nowrap;
  background-color: #f8f9fa;
}

.table th[colspan] {
  background-color: #e9ecef;
  border-bottom: 2px solid #dee2e6;
}

.table td {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle !important;
}

.table td:hover {
  white-space: normal;
  word-break: break-word;
}

/* Matched Data JSON Display Styles */
.matched-data-cell {
  max-width: 300px;
  padding: 8px !important;
}

.matched-data-section {
  margin-bottom: 8px;
}

.matched-data-section:last-child {
  margin-bottom: 0;
}

.matched-data-section strong {
  display: block;
  margin-bottom: 2px;
  color: #495057;
}

/* Row highlight styles based on confidence */
.table-success {
  background-color: rgba(40, 167, 69, 0.15) !important;
}

.table-warning {
  background-color: rgba(255, 193, 7, 0.15) !important;
}

.table-danger {
  background-color: rgba(220, 53, 69, 0.15) !important;
}

/* Matched row style - Blue for matched rows */
.table-matched {
  background-color: #e6f3ff !important;
}

.table-matched:hover td {
  background-color: #cce5ff !important;
}

/* Unmatched row style - Grey for unmatched rows */
.table tbody tr {
  background-color: #f5f5f5 !important;
}

.table tbody tr:hover td {
  background-color: #e8e8e8 !important;
}

/* Override for matched rows */
.table tbody tr.table-matched {
  background-color: #e6f3ff !important;
}

.table tbody tr.table-matched:hover td {
  background-color: #cce5ff !important;
}

/* Confidence styles */
.confidence-cell {
  width: 150px;
  padding: 0.5rem !important;
  background-color: rgba(0, 0, 0, 0.02);
}

.confidence-badge-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.confidence-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 45px;
  text-align: center;
}

.confidence-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.confidence-high {
  color: #155724 !important;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
}

.confidence-medium {
  color: #856404 !important;
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
}

.confidence-low {
  color: #721c24 !important;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
}

/* Matched data JSON display */
.matched-data-container {
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.8rem;
  padding: 5px;
  background-color: #f8f9fa;
  border-radius: 3px;
}

.json-data {
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 0.75rem;
  margin: 3px 0;
  background-color: #f1f1f1;
  padding: 3px;
  border-radius: 2px;
  color: #333;
}

/* Hover effects */
.table tr:hover td {
  background-color: rgba(0, 0, 0, 0.075) !important;
}

.table tr:hover .confidence-badge {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* Utility styles */
.pagination {
  margin-bottom: 0;
}

.form-control:focus {
  box-shadow: none;
  border-color: #80bdff;
}

.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
}

.btn-secondary:hover {
  background-color: #5a6268;
  border-color: #545b62;
}

.table th[role="columnheader"] {
  cursor: pointer;
  user-select: none;
}

.table th[role="columnheader"]:hover {
  background-color: #e9ecef;
}

.table th svg {
  margin-left: 0.5rem;
  opacity: 0.5;
}

.table th:hover svg {
  opacity: 1;
}

.spinner-border {
  width: 3rem;
  height: 3rem;
}

.alert {
  margin-bottom: 1rem;
}

.input-group {
  max-width: 300px;
}

/* Filter buttons when active */
.filter-active {
  border-color: #0d6efd !important;
  border-width: 2px !important;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
}

/* Matching Status Styles */
.matching-status-alert {
  margin-bottom: 0.5rem;
}

.matching-status-alert .alert {
  margin-bottom: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

.matching-status-alert .small-alert {
  max-width: fit-content;
  border-radius: 20px;
}

.matching-status-alert .spinner-border {
  width: 0.8rem;
  height: 0.8rem;
  border-width: 0.15em;
  margin-right: 0.25rem;
}

@media (max-width: 768px) {
  .d-flex {
    flex-direction: column;
    gap: 1rem;
  }

  .input-group {
    max-width: 100%;
  }

  .pagination {
    justify-content: center;
  }

  .confidence-badge-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .confidence-cell {
    width: 100px;
  }
}
