/**
 * Practice Performance table – matches reference (rounded card, header, table layout).
 * Expand column, center-aligned data, monospace numbers, dotted underline on missed calls, trend icons, status pills.
 */

.practice-table-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0; /* allow shrink inside flex/constrained parent */
  overflow-x: hidden; /* no scrollbar when table fits */
}

@media (max-width: 900px) {
  .practice-table-container {
    overflow-x: auto; /* enable scroll on narrow viewports */
  }
}

.practice-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed; /* respect container width; prevents unnecessary horizontal scrollbar */
  border-collapse: collapse;
  font-size: 0.875rem; /* text-sm */
  caption-side: bottom;
}

.practice-table-head-row {
  border-bottom: 1px solid #e5e7eb;
}

.practice-table th {
  padding: 0 0.5rem; /* px-2 */
  height: 2.5rem; /* h-10 */
  vertical-align: middle;
  font-weight: 500;
  color: #6b7280; /* text-muted-foreground */
}

.practice-table-th-expand {
  width: 3rem; /* w-12 */
}

.practice-table-th-left {
  text-align: left;
}

.practice-table-th-center {
  text-align: center;
}

.practice-table td {
  padding: 0.5rem; /* p-2 */
  vertical-align: middle;
  border-bottom: 1px solid #e5e7eb;
}

.practice-table tr:last-child td {
  border-bottom: 0;
}

.practice-table tr:hover td {
  background-color: #f9fafb; /* hover:bg-gray-50 */
}

.practice-table-td-expand {
  width: 3rem;
}

.practice-table-td-center {
  text-align: center;
}

.practice-table-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0.25rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  cursor: pointer;
  color: #374151;
}

.practice-table-expand-btn:hover:not(:disabled) {
  background: #f3f4f6;
  color: #111827;
}

.practice-table-expand-btn:disabled {
  opacity: 0.9;
}

.practice-table-expand-btn .pp-chevron {
  width: 1rem;
  height: 1rem;
}

/* Loading spinner inside expand button */
.pp-expand-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: pp-spin 0.7s linear infinite;
}

.practice-table-expand-btn-loading .pp-expand-spinner {
  display: block;
}

@keyframes pp-spin {
  to { transform: rotate(360deg); }
}

.practice-table-expand-placeholder {
  width: 1.5rem;
  height: 1.5rem;
}

.practice-table-name {
  font-weight: 500; /* font-medium */
  color: #111827;
}

.practice-table-meta {
  font-size: 0.875rem;
  color: #6b7280; /* text-gray-500 */
  margin-top: 0.125rem;
}

.practice-table-mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.practice-table-num {
  font-size: 1rem; /* text-base */
  color: #111827; /* text-gray-900 */
}

.practice-table-missed-cell {
  cursor: pointer;
  transition: background-color 0.15s;
}

.practice-table-missed-cell:hover {
  background-color: #f3f4f6 !important; /* hover:bg-gray-100 */
}

/* Match Answered Calls layout: two stacked divs, centered (text-base + text-sm rows) */
.practice-table-missed-cell > div {
  display: block;
  width: 100%;
  text-align: center;
}

.practice-table-missed-num {
  display: block;
  font-size: 1rem; /* text-base */
  color: #111827; /* text-gray-900 */
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

.practice-table-missed-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.125rem;
  font-size: 0.875rem; /* text-sm */
  color: #6b7280; /* text-gray-500 */
}

.practice-table-missed-meta .pp-trend {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.practice-table-time-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.practice-table-time-row .pp-trend {
  width: 1rem;
  height: 1rem;
}

.pp-trend-up {
  color: #22c55e; /* text-green-500 */
}

.pp-trend-down {
  color: #ef4444; /* text-red-500 */
}

/* Status pills – rounded-full, border, dot */
.practice-table-status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem; /* gap-1.5 */
  padding: 0.125rem 0.625rem; /* px-2.5 py-0.5 */
  font-size: 0.75rem; /* text-xs */
  font-weight: 500;
  border-radius: 9999px; /* rounded-full */
  border: 1px solid transparent;
}

.practice-table-status-dot {
  width: 8px; /* w-2 */
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.practice-table-status-good {
  background: #dcfce7; /* green-100 */
  color: #166534; /* green-800 */
  border-color: #bbf7d0; /* green-200 */
}

.practice-table-status-good .practice-table-status-dot {
  background: #22c55e; /* green-500 */
}

.practice-table-status-watch {
  background: #fef9c3; /* yellow-100 */
  color: #854d0e; /* yellow-800 */
  border-color: #fef08a; /* yellow-200 */
}

.practice-table-status-watch .practice-table-status-dot {
  background: #eab308; /* yellow-500 */
}

.practice-table-status-flagged {
  background: #fee2e2; /* red-100 */
  color: #991b1b; /* red-800 */
  border-color: #fecaca; /* red-200 */
}

.practice-table-status-flagged .practice-table-status-dot {
  background: #ef4444; /* red-500 */
}

.practice-row {
  background: #fff;
}

.location-row {
  background: #fff;
}

.practice-table-loading-row-wrap {
  background: #f9fafb;
}

.practice-table-loading-row {
  text-align: center;
  color: #6b7280;
  padding: 1rem 1.25rem !important;
  font-size: 0.875rem;
  vertical-align: middle;
}

.practice-table-loading-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  animation: pp-loading-fade 0.25s ease-out;
}

.practice-table-loading-spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: pp-spin 0.7s linear infinite;
  flex-shrink: 0;
}

.practice-table-loading-text {
  color: #6b7280;
  font-weight: 500;
}

@keyframes pp-loading-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Sortable columns */
.practice-table th.sortable {
  user-select: none;
  cursor: pointer;
}

.practice-table th.sortable:hover {
  background-color: #f9fafb;
}

.sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.75rem;
  color: #6b7280;
}

.sort-arrow.active {
  color: #111827;
  font-weight: 600;
}

.sort-arrow.inactive {
  opacity: 0.3;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.pagination-button {
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  color: #111827;
  font-size: 0.875rem;
  cursor: pointer;
}

.pagination-button:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
}

.pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0.5rem;
}

.pagination-pages {
  display: flex;
  gap: 4px;
}

.pagination-page {
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: #fff;
  color: #111827;
  font-size: 0.875rem;
  cursor: pointer;
}

.pagination-page:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.pagination-page.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}
