/**
 * AUTOGRADING AI - Bulk Exam Upload & Review Styles
 * Responsive styling from 320px mobile to 1280px+ desktop.
 */

/* Review Modal & Card Layout */
.bulk-review-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.25rem 0.5rem;
}

.bulk-group-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-md, 12px);
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bulk-group-card.needs-review {
  border-left: 4px solid var(--color-warning, #f59e0b);
  background: #fffbeb;
}

.bulk-group-card.has-error {
  border-color: var(--color-danger, #ef4444);
  background: #fef2f2;
}

.bulk-group-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.bulk-group-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light, #eff6ff);
  color: var(--primary, #2563eb);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.bulk-group-title {
  flex: 1;
  font-weight: 700;
  font-size: 0.95rem;
}

.bulk-group-flag {
  font-size: 0.72rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid #fde68a;
  white-space: nowrap;
}

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

.bulk-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}

.bulk-group-summary {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.6rem;
  font-weight: 500;
}

.bulk-file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bulk-file-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.bulk-file-chip.is-rubric {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.bulk-file-kind {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  text-transform: uppercase;
}

.bulk-file-chip.is-rubric .bulk-file-kind {
  background: #dcfce7;
  color: #166534;
}

.bulk-file-name {
  flex: 1;
  min-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-main, #1e293b);
}

.bulk-role-toggle {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bulk-file-chip.is-rubric .bulk-role-toggle {
  border-color: #86efac;
  color: #166534;
  background: #ffffff;
}

.bulk-move-select {
  font-size: 0.72rem;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
}

.bulk-group-error {
  color: var(--color-danger, #ef4444);
  font-size: 0.76rem;
  font-weight: 600;
  margin: 0.5rem 0 0 0;
}

/* Floating Ingest Progress Tray */
.bulk-ingest-tray {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: min(420px, calc(100vw - 2rem));
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: var(--radius-lg, 16px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  z-index: 1050;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.bulk-ingest-tray.is-collapsed .bulk-tray-body {
  display: none;
}

.bulk-tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.bulk-tray-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  cursor: pointer;
  text-align: left;
}

.bulk-tray-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.bulk-tray-close:hover {
  color: var(--text-main, #1e293b);
  background: #e2e8f0;
}

.bulk-tray-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--primary, #2563eb);
  border-radius: 50%;
  animation: bulk-spin 0.8s linear infinite;
}

.bulk-ingest-tray:not(.is-running) .bulk-tray-spinner {
  display: none;
}

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

.bulk-tray-body {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bulk-tray-job-item {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.6rem;
}

.bulk-tray-job-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.bulk-tray-job-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main, #1e293b);
  margin-bottom: 0.25rem;
}

.bulk-tray-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.4rem;
}

.bulk-tray-exam-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 0.25rem 0;
}

.bulk-tray-exam-name {
  font-weight: 600;
  color: var(--text-main, #334155);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.bulk-tray-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  white-space: nowrap;
}

.bulk-tray-badge.tone-processing {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.bulk-tray-badge.tone-ready {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.bulk-tray-badge.tone-attention {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

@media (max-width: 480px) {
  .bulk-ingest-tray {
    bottom: 4.5rem;
    right: 0.75rem;
    width: calc(100vw - 1.5rem);
  }

  .bulk-group-meta {
    grid-template-columns: 1fr;
  }
}
