/* ==========================================================================
   Auctions module – grid, drawer & row styling
   Mirrors shortages (21_shortages.css) design language.
   ========================================================================== */

/* ── Grid chrome ─────────────────────────────────────────────────────────── */
#au-grid .ag-header-cell {
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748b;
  text-transform: none;
  letter-spacing: 0.04em;
}

#au-grid .ag-header-row {
  border-bottom: 2px solid #e2e8f0;
}

/* ── Remove header column separator lines ──────────────────────────────── */
#au-grid .ag-header-cell-resize {
  display: none;
}

#au-grid .ag-header-cell::after {
  display: none !important;
}

#au-grid .ag-cell {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: #1e293b;
  transition: background-color 120ms ease;
}

#au-grid .ag-row {
  transition: background-color 120ms ease, box-shadow 120ms ease;
  border-bottom: 1px solid #f1f5f9;
}

/* ── Zebra striping for scanability ──────────────────────────────────────── */
#au-grid .ag-row-odd:not(.ag-row-hover):not(.ag-row-selected) {
  background-color: #fafbfd;
}

/* ── Hover: subtle blue tint + lift ────────────────────────────────────── */
#au-grid .ag-row:hover {
  background-color: #f0f5ff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* ── Selected row ────────────────────────────────────────────────────────── */
#au-grid .ag-row-selected {
  background-color: #e8f1ff !important;
}

/* ── At-risk row: warm left accent ─────────────────────────────────────── */
#au-grid .au-row-at-risk {
  border-left: 3px solid #d55e00;
  background-color: rgba(213, 94, 0, 0.025);
}
#au-grid .au-row-at-risk:hover {
  background-color: rgba(213, 94, 0, 0.05) !important;
}

/* ── Medium-risk row: blue left accent ──────────────────────────────────── */
#au-grid .au-row-medium {
  border-left: 3px solid #0066cc;
  background-color: rgba(0, 102, 204, 0.025);
}
#au-grid .au-row-medium:hover {
  background-color: rgba(0, 102, 204, 0.05) !important;
}

/* ── Low-risk row: green left accent ───────────────────────────────────── */
#au-grid .au-row-low {
  border-left: 3px solid #009e8f;
  background-color: rgba(0, 158, 143, 0.025);
}
#au-grid .au-row-low:hover {
  background-color: rgba(0, 158, 143, 0.05) !important;
}

/* ── Effective row: subtle green left accent ────────────────────────────── */
#au-grid .au-row-effective {
  border-left: 3px solid rgba(0, 158, 143, 0.35);
}

/* ── Win column: effective winner highlight ──────────────────────────────── */
#au-grid .eff-win {
  background-color: rgba(0, 158, 143, 0.06);
}

/* ── Substance column: ellipsis overflow ─────────────────────────────────── */
#au-grid [col-id="Substance"] .ag-cell-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Auction ID column: monospace for numeric readability ────────────────── */
#au-grid [col-id="Auction"] .ag-cell-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #334155;
  font-size: 0.82rem;
}

/* ── Winner column: highlight the champion ──────────────────────────────── */
#au-grid [col-id="Distributor"] .ag-cell-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Participants column: badge-like styling ──────────────────────────────── */
#au-grid [col-id="Participants"] .ag-cell-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #475569;
}

/* ── Status column ────────────────────────────────────────────────────────── */

/* ── Group row styling ───────────────────────────────────────────────────── */
#au-grid .ag-row-group {
  font-weight: 600;
  background-color: #fafbfc;
}

#au-grid .ag-row-group:hover {
  background-color: rgba(0, 0, 0, 0.035);
}

/* ── Responsive row height ───────────────────────────────────────────────── */
#au-grid .ag-row .ag-cell {
  line-height: 1.4;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* ── Cursor pointer on rows (affordance for detail drawer) ───────────────── */
#au-grid .ag-row {
  cursor: pointer;
}

/* ── Empty state overlay ─────────────────────────────────────────────────── */
#au-grid .ag-overlay-no-rows-center {
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 3rem 1rem;
}

/* ── Results card: toolbar spacing ───────────────────────────────────────── */
.au-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.au-results-count {
  font-size: 0.80rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  margin-left: 0.5rem;
  font-variant-numeric: tabular-nums;
}

/* ── Toolbar button refinements ──────────────────────────────────────────── */
.au-toolbar .clear-filters {
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  transition: all 160ms ease;
  border-color: #cbd5e1;
  color: #64748b;
}

.au-toolbar .clear-filters:hover {
  border-color: #94a3b8;
  color: #334155;
  background-color: #f8fafc;
}

.au-toolbar .export-button {
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all 160ms ease;
}

/* ── Smooth grid entrance ────────────────────────────────────────────────── */
#au-grid.grid-visible {
  animation: auGridFadeIn 280ms ease-out;
}

@keyframes auGridFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════════════
   Drawer – participant cards & sections (dark glass context)
   All scoped under .pi-glass-offcanvas for the dark glass drawer.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Scrollable offcanvas body ──────────────────────────────────────────── */
.pi-glass-offcanvas.custom-offcanvas .offcanvas-body {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* ── Drawer section headings ─────────────────────────────────────────────── */
.au-drawer-section-heading {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(148, 163, 184, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

/* ── Participant card base ───────────────────────────────────────────────── */
.au-participant-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  background: rgba(255, 255, 255, 0.05);
}

.au-participant-card:hover {
  border-color: rgba(148, 163, 184, 0.30);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ── Card row layout: avatar | info | price ────────────────────────────── */
.au-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.au-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.au-card-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.au-card-price-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  text-align: right;
}

.au-card-price {
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.95);
  white-space: nowrap;
}

.au-card-discount {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.75);
  white-space: nowrap;
}

.au-product-id {
  font-size: 0.72rem;
  color: #94a3b8;
  font-family: monospace;
  letter-spacing: 0.3px;
}

/* ── Inline badge ──────────────────────────────────────────────────────── */
.au-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  line-height: 1.4;
  border: 1px solid transparent;
  white-space: nowrap;
}
.au-badge--success {
  background-color: rgba(0, 158, 143, 0.10);
  color: #009e8f;
  border-color: rgba(0, 158, 143, 0.20);
}
.au-badge--warning {
  background-color: rgba(213, 94, 0, 0.10);
  color: #d55e00;
  border-color: rgba(213, 94, 0, 0.20);
}

/* ── Winner card highlight ───────────────────────────────────────────────── */
.au-participant-card--winner {
  border-color: rgba(0, 158, 143, 0.35);
  background: rgba(0, 158, 143, 0.06);
}

.au-participant-card--winner:hover {
  border-color: rgba(0, 158, 143, 0.50);
}

/* ── At-risk (High) winner card ─────────────────────────────────────────── */
.au-participant-card--at-risk {
  border-color: rgba(213, 94, 0, 0.30);
  background: rgba(213, 94, 0, 0.05);
}

.au-participant-card--at-risk:hover {
  border-color: rgba(213, 94, 0, 0.45);
}

/* ── Medium-risk winner card ───────────────────────────────────────────── */
.au-participant-card--medium {
  border-color: rgba(0, 102, 204, 0.30);
  background: rgba(0, 102, 204, 0.05);
}

.au-participant-card--medium:hover {
  border-color: rgba(0, 102, 204, 0.45);
}

/* ── Low-risk winner card ──────────────────────────────────────────────── */
.au-participant-card--low {
  border-color: rgba(0, 158, 143, 0.30);
  background: rgba(0, 158, 143, 0.05);
}

.au-participant-card--low:hover {
  border-color: rgba(0, 158, 143, 0.45);
}

/* ── Participant avatar (initials circle) ────────────────────────────────── */
.au-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  color: rgba(226, 232, 240, 0.80);
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.au-participant-card--winner .au-avatar {
  background-color: rgba(0, 158, 143, 0.12);
  color: #3dd4c6;
  border-color: rgba(0, 158, 143, 0.30);
}

.au-participant-card--at-risk .au-avatar {
  background-color: rgba(213, 94, 0, 0.10);
  color: #f0944d;
  border-color: rgba(213, 94, 0, 0.25);
}

.au-participant-card--medium .au-avatar {
  background-color: rgba(0, 102, 204, 0.12);
  color: #4da6ff;
  border-color: rgba(0, 102, 204, 0.30);
}

.au-participant-card--low .au-avatar {
  background-color: rgba(0, 158, 143, 0.12);
  color: #3dd4c6;
  border-color: rgba(0, 158, 143, 0.30);
}

/* ── Detail key:value pairs ──────────────────────────────────────────────── */
.au-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 3px;
  font-size: 0.82rem;
}

.au-detail-label {
  color: rgba(148, 163, 184, 0.75);
  font-weight: 500;
  white-space: nowrap;
  text-align: right;
}

.au-detail-value {
  color: rgba(226, 232, 240, 0.92);
  font-weight: 500;
}

/* ── Risk detail card ────────────────────────────────────────────────────── */
.au-risk-detail-card {
  background-color: rgba(213, 94, 0, 0.04);
  border: 1px solid rgba(213, 94, 0, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.85);
  line-height: 1.55;
}

/* ── Risk detail card – Medium (blue tint) ─────────────────────────────── */
.au-risk-detail-card--medium {
  background-color: rgba(0, 102, 204, 0.04);
  border-color: rgba(0, 102, 204, 0.15);
}

/* ── Risk detail card – Low (green tint) ───────────────────────────────── */
.au-risk-detail-card--low {
  background-color: rgba(0, 158, 143, 0.04);
  border-color: rgba(0, 158, 143, 0.15);
}

/* ── Substitution group info card ────────────────────────────────────────── */
.au-group-info-card {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Loading & empty states
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Grid loading shimmer (skeleton placeholder) ─────────────────────────── */
.au-grid-loading {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.au-skeleton-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.au-skeleton-row:nth-child(odd) {
  background-color: #fafbfd;
}

.au-skeleton-bar {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef1f6 25%, #e2e8f0 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: auShimmer 1.5s ease-in-out infinite;
}

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

/* ── Empty state illustration ────────────────────────────────────────────── */
.au-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.au-empty-state__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.au-empty-state__icon i {
  font-size: 1.4rem;
  color: #cbd5e1;
}

.au-empty-state__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.au-empty-state__desc {
  font-size: 0.82rem;
  color: #94a3b8;
  max-width: 300px;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #au-grid .ag-row,
  #au-grid .ag-cell {
    transition: none;
  }
  #au-grid.grid-visible {
    animation: none;
  }
  .au-skeleton-bar {
    animation: none;
  }
  .au-participant-card {
    transition: none;
  }
}
