/* Shared styles for the RegDesk dashboard pages (served at /static/common.css).
   Page-specific look and feel stays in each page; this file only adds the shared pieces
   used by common.js (badges, banners, toasts, role gating, build results). */

/* Role gating: hidden until RD.applyRoles() confirms the signed-in role may use it */
[data-min-role]:not([data-role-ok]) { display: none !important; }
.rd-role-disabled { opacity: 0.55; cursor: not-allowed !important; }

/* Signed-in user in the navbar */
.nav-user {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.75rem; color: #64748B; margin-right: 0.5rem; white-space: nowrap;
}
.nav-user-email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* Badges */
.rd-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.7rem; font-weight: 600; line-height: 1.4;
  padding: 0.125rem 0.55rem; border-radius: 20px; letter-spacing: 0.01em;
  white-space: nowrap; text-transform: none;
}
.rd-ok     { background: #D1FAE5; color: #065F46; }
.rd-warn   { background: #FEF3C7; color: #92400E; }
.rd-bad    { background: #FEF2F2; color: #B91C1C; }
.rd-info   { background: #EFF6FF; color: #1D4ED8; }
.rd-muted  { color: #64748B; }
.rd-badge.rd-muted { background: #F1F5F9; color: #64748B; }
.rd-accent { background: #F5F3FF; color: #6D28D9; }

.rd-chip {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #F1F5F9; color: #334155; border: 1px solid #E2E8F0;
  border-radius: 5px; padding: 0.05rem 0.4rem; margin: 0 0.15rem 0.15rem 0;
}
.rd-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8em; }
.rd-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #64748B; margin: 0.625rem 0 0.25rem;
}
.rd-help { font-size: 0.75rem; color: #64748B; }

/* Banners */
.rd-banner {
  border-radius: 10px; padding: 0.75rem 1rem; font-size: 0.8125rem; margin-bottom: 1rem;
  border: 1.5px solid;
}
.rd-banner ul { margin: 0.375rem 0 0; padding-left: 1.25rem; }
.rd-banner-info    { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.rd-banner-success { background: #F0FDF4; border-color: #BBF7D0; color: #065F46; }
.rd-banner-warning { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.rd-banner-danger  { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }

/* Toasts */
.toast-stack {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast-stack .toast {
  min-width: 260px; max-width: 420px; border-radius: 12px !important; border: none !important;
  font-size: 0.875rem;
}
.rd-toast-list { margin: 0.375rem 0 0; padding-left: 1.25rem; font-size: 0.8125rem; }

/* Tables */
.rd-table { font-size: 0.8125rem; }
.rd-table th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: #64748B; font-weight: 700; }
.rd-table td { vertical-align: middle; }
.rd-table input.form-control, .rd-table select.form-select { padding: 0.25rem 0.5rem; font-size: 0.8125rem; border-radius: 6px; }

/* Build results */
.rd-build { margin-top: 0.5rem; }
.rd-build-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.8125rem; }
.rd-issues { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.8125rem; }
.rd-issues li { margin-bottom: 0.25rem; }
.rd-issue-error { color: #B91C1C; }
.rd-issue-warning { color: #92400E; }
.rd-issue-info { color: #0369A1; }
.rd-pre {
  white-space: pre-wrap; word-break: break-word; font-size: 0.8rem; margin: 0;
  background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 8px; padding: 0.625rem 0.75rem;
  max-height: 420px; overflow-y: auto;
}
.rd-json .json-key { color: #0369A1; }
.rd-json .json-str { color: #15803D; }
.rd-json .json-num { color: #9333EA; }
.rd-json .json-bool { color: #D97706; font-weight: 600; }
.rd-json .json-null { color: #6B7280; font-style: italic; }
.rd-sources { margin-top: 0.5rem; font-size: 0.8125rem; }
.rd-source { margin-bottom: 0.125rem; }
.rd-source i { color: #2563EB; }
.rd-unused { opacity: 0.6; }

/* Panels used by the rubric editor and admin page */
.rd-panel {
  background: #F8FAFC; border: 1.5px solid #E2E8F0; border-radius: 10px;
  padding: 0.75rem 1rem; margin: 0.75rem 0;
}
.rd-panel-title { font-size: 0.8125rem; font-weight: 700; color: #334155; margin-bottom: 0.375rem; }
.rd-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem;
  background: #0F172A; color: #E2E8F0; border-radius: 8px; padding: 0.75rem; word-break: break-all;
  user-select: all;
}

/* Dashboard uploads (submission page) */
.rd-dropzone {
  border: 2px dashed #CBD5E1; border-radius: 12px; background: #F8FAFC;
  padding: 1.25rem 1rem; text-align: center; color: #475569; font-size: 0.8125rem;
  transition: border-color 0.15s, background 0.15s;
}
.rd-dropzone.rd-dragover { border-color: #2563EB; background: #EFF6FF; }
.rd-dropzone > i { font-size: 1.5rem; color: #2563EB; display: block; margin-bottom: 0.25rem; }
.rd-upload-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.rd-upload-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 0.75rem; align-items: center;
  padding: 0.375rem 0; border-bottom: 1px solid #E2E8F0; font-size: 0.8125rem;
}
.rd-upload-row:last-child { border-bottom: 0; }
.rd-upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-upload-row .progress { height: 0.5rem; }
@media (max-width: 576px) { .rd-upload-row { grid-template-columns: minmax(0, 1fr) auto; } .rd-upload-row .progress { display: none; } }
