/**
 * Out of Class Tracker — page-specific styles (Phase 1 migration)
 *
 * outofclass.html shares a "logging page" component library with
 * infringements.html: css/unified-logging-system.css (analytics-card,
 * empty/loading states, modal header/summary-chip pieces, and the
 * --accent-color/--accent-gradient vars set per-page via
 * body[data-page="outofclass"] — info/navy for this page), css/
 * unified-form-layout.css (.unified-form-section base card),
 * css/unified-student-search.css and css/form-workflow-polish.css (modal
 * overlay/container/body/footer structure + animation). All of that is
 * left untouched — this file only supplies what's genuinely page-specific
 * and was previously buried in a ~2200-line inline <style> block
 * (glassmorphism cards, hover shimmer sweeps, animated gradient borders,
 * a dead .dark-mode.* block — body.dark-mode is never set anywhere,
 * theming is data-theme driven — and a submit button/step header
 * hardcoded to purple, inconsistent with the page's actual info/navy
 * --accent-color; both now use --accent-color/--accent-gradient instead).
 *
 * Loaded LAST (after the shared files above) so these page-specific
 * rules win ties without needing !important.
 */

/* ===== Layout ===== */
.main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-6) var(--sp-8);
  display: grid;
  gap: var(--sp-6);
}
@media (max-width: 768px) {
  .main-container { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
}

/* Hero title block — centered as a single column (title text was already
   centering but the actions row underneath wasn't, since the shared
   unified-page-header is a left/right split layout by default). */
.unified-page-header {
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.unified-page-title-block {
  text-align: center;
}
.unified-page-title::after {
  left: 50%;
  transform: translateX(-50%);
}
.unified-page-header-actions {
  justify-content: center;
}

/* ===== "At a Glance" — now sits first, above the task flow, so no extra
   top margin is needed beyond .main-container's own padding ===== */
.at-a-glance-heading {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.at-a-glance-heading svg { width: 14px; height: 14px; }

/* Compact + premium presentation — the shared unified-logging-system.css
   cards (min-height 92px, flat surface, plain-stroke icon, left border)
   read fine as a primary dashboard but are heavier/plainer than an
   "at a glance" strip wants now that it sits above the task flow as a
   summary rather than as its own section. Keeps --card-color (set inline
   per card in the HTML) as the single source of each card's accent. */
.analytics-dashboard {
  gap: var(--sp-3);
  margin: 0 0 var(--sp-2);
}
.analytics-card {
  padding: var(--sp-3) var(--sp-4);
  min-height: auto;
  gap: var(--sp-3);
  border-left: none;
  border: 1px solid var(--border-light);
  border-radius: var(--r-lg, 14px);
  background: linear-gradient(160deg, var(--surface) 0%, color-mix(in srgb, var(--card-color, var(--blue-500)) 5%, var(--surface)) 100%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.analytics-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color, var(--blue-500));
  opacity: 0.85;
}
.analytics-card:hover {
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.09);
  transform: translateY(-1px);
}
.analytics-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--card-color, var(--blue-500)) 14%, transparent);
  color: var(--card-color, var(--text-2));
}
.analytics-card-icon svg {
  width: 18px;
  height: 18px;
}
.analytics-card-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ===== Selected students ===== */
.selected-students-container {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-6);
}
.selected-students {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  min-height: 60px;
}
@media (max-width: 768px) {
  .selected-students { grid-template-columns: 1fr; }
}

.student-card.enhanced-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 44px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  position: relative;
  transition: box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.student-card.enhanced-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}
.student-card.enhanced-card .student-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.student-card.enhanced-card .student-info-section { flex: 1; min-width: 0; }
.student-card.enhanced-card .student-name {
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text);
  margin-bottom: 4px;
}
.student-card.enhanced-card .student-meta-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.student-card.enhanced-card .meta-badge {
  font-size: var(--fs-xs);
  padding: 2px 8px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  color: var(--text-2);
  white-space: nowrap;
}
.student-card.enhanced-card .student-stats-mini {
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.student-card.enhanced-card .remove-student {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--err-500);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-out);
}
.student-card.enhanced-card .remove-student:hover { background: #dc2626; }

.clear-all-container {
  display: flex;
  justify-content: center;
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--border);
}
.clear-all-btn {
  background: var(--warn-500);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-6);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  transition: background var(--dur-fast) var(--ease-out);
}
.clear-all-btn:hover { background: #d97706; }

/* ===== Student search dropdown result rows ===== */
.student-option {
  padding: var(--sp-4);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  transition: background var(--dur-fast) var(--ease-out);
}
.student-option:last-child { border-bottom: none; }
.student-option:hover { background: var(--surface-2); }
.student-option .student-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  flex-shrink: 0;
}
.student-option .student-info { flex: 1; }
.student-option .student-name { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.student-option .student-details { font-size: 0.85em; color: var(--text-2); }

/* ===== Form elements (Advanced Filters accordion) ===== */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}
@media (max-width: 768px) {
  .filters-grid { grid-template-columns: 1fr; gap: var(--sp-4); }
}
.form-group { display: flex; flex-direction: column; }
.form-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-input, .form-select {
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-500) 20%, transparent);
}
.form-input::placeholder { color: var(--text-2); font-style: italic; }

/* ===== Date/time selection ===== */
.datetime-section {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px dashed var(--border);
}
.datetime-options { display: flex; flex-direction: column; gap: var(--sp-4); }
.datetime-option {
  display: flex;
  flex-direction: column;
  padding: var(--sp-4);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.datetime-option:hover { border-color: var(--accent-color, var(--blue-500)); background: var(--surface-2); }
.datetime-option:has(input[type="radio"]:checked) {
  border-color: var(--accent-color, var(--blue-500));
  background: color-mix(in srgb, var(--accent-color, var(--blue-500)) 6%, transparent);
}
.datetime-option input[type="radio"] {
  margin: 0 var(--sp-3) 0 0;
  transform: scale(1.15);
  accent-color: var(--accent-color, var(--blue-500));
}
.radio-label { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: var(--sp-2); }
.datetime-preview { font-size: var(--fs-xs); color: var(--text-2); margin-top: var(--sp-1); margin-left: calc(var(--sp-4) + 20px); font-style: italic; }
.custom-datetime-inputs { margin-top: var(--sp-4); margin-left: calc(var(--sp-4) + 20px); }
.datetime-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 600px) {
  .datetime-grid { grid-template-columns: 1fr; }
}

.validation-message {
  padding: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-2);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.validation-message.error {
  background: color-mix(in srgb, var(--err-500) 10%, transparent);
  color: var(--err-500);
  border: 1px solid color-mix(in srgb, var(--err-500) 30%, transparent);
}

/* ===== Submit button — uses the page's actual accent (info/navy), not the
   hardcoded purple the inline styles had drifted to ===== */
.submit-btn {
  padding: 1rem 2.5rem;
  background: var(--accent-gradient, linear-gradient(135deg, #2563eb 0%, #4f9cd9 100%));
  color: #fff;
  border: none;
  border-radius: var(--r-lg);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--sh-md);
  min-width: 280px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--sh-lg);
}
.submit-btn:disabled {
  background: var(--n-400);
  color: var(--n-0);
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.7;
}
.submit-btn-ready {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.unified-form-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  margin-top: var(--sp-8);
}
.form-help-text { color: var(--text-2); font-size: var(--fs-sm); font-style: italic; margin: 0; max-width: 500px; }

/* ===== History list ===== */
.history-list-item {
  background: var(--surface-2);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  border-left: 3px solid var(--accent-color, var(--info-500));
}
.history-list-item p { margin: var(--sp-1) 0; line-height: 1.5; }
.history-list-item .timestamp { color: var(--text-2); font-size: 0.85em; font-weight: 500; }
.history-list-item .infringement-type { color: var(--text); font-weight: 600; margin-bottom: var(--sp-1); }
.history-list-item strong { color: var(--accent-color, var(--blue-500)); }
.history-list-item .infringement-type-history { font-style: italic; color: var(--text-2); }
#infringementHistoryList { max-height: 300px; overflow-y: auto; padding-right: var(--sp-2); }

/* ===== Student stats mini display (profile card header) ===== */
.student-stats { display: flex; gap: var(--sp-4); }
.stat { text-align: center; }
.stat-value { display: block; font-size: 1.3rem; font-weight: 800; color: var(--text); }
.stat-label { display: block; font-size: var(--fs-xs); color: var(--text-2); text-transform: uppercase; letter-spacing: 0.03em; }

/* ===== Loading state (not covered by the shared logging-page CSS) ===== */
.loading-state-polished {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
}
.loading-state-polished .loading-dots { display: flex; gap: 6px; align-items: center; margin-bottom: var(--sp-2); }
.loading-state-polished .loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-color, var(--blue-500));
  opacity: 0.4;
  animation: outofclassLoadingDot 1.4s ease-in-out infinite;
}
.loading-state-polished .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-state-polished .loading-dots span:nth-child(3) { animation-delay: 0.4s; }
.loading-state-polished .loading-text { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); margin: 0; }
@keyframes outofclassLoadingDot {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

/* ===== Step 2 section header (was hardcoded purple inline; now the page's
   actual accent) ===== */
.step-section-header {
  background: color-mix(in srgb, var(--accent-color, var(--blue-500)) 6%, transparent);
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--r-md);
  margin: calc(var(--sp-6) * -1) calc(var(--sp-6) * -1) var(--sp-6);
  border-left: 4px solid var(--accent-color, var(--blue-500));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.step-section-header-inner { display: flex; align-items: center; gap: 12px; }
.step-section-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

/* ===== Confirmation modal header — fixes a real collision between two
   shared files that are both loaded here: form-workflow-polish.css's
   .modal-header sets h2/p to white (designed for the old colored gradient
   banner), while unified-logging-system.css's .modal-header--clean sets
   the clean white background but relies on source order for its own
   dark-text h2/p rules to win. On this page form-workflow-polish.css
   loads after unified-logging-system.css, so .modal-header's white-text
   rule was winning — near-invisible white-on-white text. This modal's
   markup carries both classes together, so this pins the colors via the
   overlay's #id (specificity beats both without !important or touching
   the load order of two files this migration doesn't own). ===== */
#confirmationModalOverlay .modal-header--clean h2 { color: var(--n-900, #111827); }
#confirmationModalOverlay .modal-header--clean p { color: var(--n-500, #6b7280); }

/* ===== Confirmation modal — student list rows (the one part of the modal
   that was raw inline-styled div soup rather than a shared component) ===== */
.modal-student-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-color, var(--blue-500));
  border-radius: var(--r-md);
}
.modal-student-row:last-child { margin-bottom: 0; }
.modal-student-row-name { font-weight: 600; color: var(--text); font-size: var(--fs-sm); }
.modal-student-row-meta { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
.modal-student-list {
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}

/* ===== Action buttons (not covered by the shared logging-page CSS —
   .unified-action-btn-confirm is; the plain/secondary variants aren't) ===== */
.unified-action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.65rem 1.15rem;
  border: none;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.unified-action-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.unified-action-btn-secondary:hover { background: var(--surface-2); }
