/* Dashboard Loader Overlay */
.dashboard-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

.loader-text {
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
}

/* Header styles now handled by Tailwind - keeping for backward compatibility if needed */
.app-header {
  /* Tailwind classes handle styling */
}

.app-header__title {
  /* Tailwind classes handle styling */
}

.brand-pill {
  /* Tailwind classes handle styling */
}

.app-header h1 {
  /* Tailwind classes handle styling */
}

.app-nav a {
  /* Tailwind classes handle styling */
}

.app-main {
  padding: 2rem;
  font-family: "Inter", sans-serif;
  background: #f1f5f9;
  min-height: 100vh;
}

.document-section {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid #e2e8f0;
}

.document-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #38bdf8;
}

.filters {
  margin-bottom: 1.5rem;
}

.filters label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  gap: 0.4rem;
}

.filters select {
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #cbd5f9;
  background: #fff;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.kpi-label {
  margin: 0;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kpi-label-text {
  flex: 1;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.2s, color 0.2s;
}

.info-icon:hover {
  background: #38bdf8;
  color: #0f172a;
}

.info-icon:hover .tooltip,
.info-icon:focus .tooltip {
  visibility: visible;
  opacity: 1;
}

.info-icon:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

.tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  white-space: normal;
  width: 240px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: opacity 0.2s, visibility 0.2s;
  pointer-events: none;
  line-height: 1.5;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #0f172a;
}

/* Adjust tooltip position for edge cases - prevent overflow */
.info-icon {
  position: relative;
}

/* For cards on the right edge, show tooltip to the left */
.kpi-card:last-child .info-icon .tooltip,
.kpi-card:nth-last-child(2) .info-icon .tooltip {
  left: auto;
  right: 0;
  transform: none;
}

.kpi-card:last-child .info-icon .tooltip::after,
.kpi-card:nth-last-child(2) .info-icon .tooltip::after {
  left: auto;
  right: 16px;
  transform: none;
}

.kpi-value {
  margin: 0.5rem 0 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: #0f172a;
}

.error-breakdown {
  margin-bottom: 2rem;
  background: #fff;
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.error-breakdown h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: #0f172a;
}

.error-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.error-breakdown-card {
  background: #f8fafc;
  border-radius: 0.5rem;
  padding: 1rem;
  border-left: 4px solid #38bdf8;
}

.error-breakdown-card .error-label {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
}

.error-breakdown-card .error-value {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.charts-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.chart-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  width: 100%;
}

.chart-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-card header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #0f172a;
  flex: 1;
}

.chart-card header .info-icon {
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 400px;
  height: 400px !important;
}

.chart-summary {
  padding: 1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  margin-top: 0.5rem;
}

.chart-summary p {
  margin: 0.5rem 0;
}

.chart-summary ul {
  margin: 0.5rem 0;
}

.review-links {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
}

.review-link {
  padding: 0.75rem 1.5rem;
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.review-metrics {
  display: flex;
  gap: 1rem;
}

.review-metrics .metric {
  background: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  text-align: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.review-controls {
  margin-bottom: 1rem;
}

.review-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.review-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.07);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.review-card__image {
  width: 100%;
  min-height: 220px;
  border-radius: 0.75rem;
  overflow: hidden;
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-fallback {
  text-align: center;
  padding: 1rem;
  color: #475569;
  font-weight: 500;
}

.image-fallback a {
  display: inline-block;
  margin-top: 0.5rem;
  color: #0f172a;
  font-weight: 600;
  text-decoration: underline;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #0ea5e9;
  font-weight: 600;
  text-decoration: none;
}

.btn-link::after {
  content: "↗";
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

.review-card__meta {
  font-size: 0.9rem;
  color: #475569;
}

.review-card__actions button {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
}

.btn-correct {
  background: #16a34a;
  color: #fff;
}

.btn-fp {
  background: #f97316;
  color: #fff;
}

.review-card.labeled-correct {
  border: 2px solid #16a34a;
}

.review-card.labeled-fp {
  border: 2px solid #f97316;
}

/* Face review specific styles */
.review-card--face {
  max-width: 100%;
}

.review-card__images-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.review-card__image-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.review-card__image-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #475569;
  text-align: center;
}

.review-card__image-wrapper .review-card__image {
  min-height: 200px;
}

.review-card__links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.review-card__links .btn-link {
  padding: 0.5rem 1rem;
  background: #f1f5f9;
  color: #0f172a;
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.review-card__links .btn-link:hover {
  background: #e2e8f0;
}

@media (max-width: 768px) {
  .review-card__images-comparison {
    grid-template-columns: 1fr;
  }
}

.review-pagination {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.review-pagination button {
  padding: 0.75rem 1.5rem;
  border: none;
  background: #0f172a;
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
}

@media (max-width: 768px) {
  /* Header responsive styles now handled by Tailwind */
  header {
    flex-direction: column;
    gap: 1rem;
  }

  .chart-card canvas {
    height: 320px !important;
    max-height: 320px;
  }
}

