/* Modular CSS slice extracted from style.css (7184-7904) */
.rubric-math-box.empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-style: italic;
}

.rubric-math-box .katex-display {
  margin: 0.4rem 0 !important;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

.rubric-math-deduction-box {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #991b1b;
  border-radius: var(--radius-xs, 6px);
  padding: 0.4rem 0.65rem;
  font-size: 0.78rem;
  line-height: 1.45;
  cursor: pointer;
  transition: all 0.18s ease;
}
.rubric-math-deduction-box:hover {
  border-color: #f87171;
}

.rubric-live-math-preview-container {
  margin-top: 0.35rem;
}

.rubric-live-math-preview {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-main);
  max-height: 160px;
  overflow-y: auto;
}

.rubric-live-math-preview-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.rubric-view-mode-tabs .btn {
  transition: all 0.15s ease;
}
.rubric-view-mode-tabs .btn.btn-primary {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

[data-theme="dark"] .rubric-math-box.criteria {
  background: rgba(34, 197, 94, 0.1) !important;
  border-color: rgba(74, 222, 128, 0.35) !important;
  color: #86efac !important;
}

[data-theme="dark"] .rubric-math-box.solution {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .rubric-math-box.empty {
  background: rgba(30, 41, 59, 0.5) !important;
  border-color: #334155 !important;
  color: #64748b !important;
}

[data-theme="dark"] .rubric-math-deduction-box {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
}

[data-theme="dark"] .rubric-live-math-preview {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}

.rubric-delete-btn {
  color: #ef4444 !important;
  border: 1px solid #fca5a5 !important;
  background: transparent !important;
}
.rubric-delete-btn:hover {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
[data-theme="dark"] .rubric-delete-btn {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
}
[data-theme="dark"] .rubric-delete-btn:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}

/* Universal Dark Form Controls and Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color-scheme: dark;
}

[data-theme="dark"] .rubric-textarea,
[data-theme="dark"] .rubric-q-detail textarea,
[data-theme="dark"] .q-criteria-input,
[data-theme="dark"] .q-solution-input,
[data-theme="dark"] textarea,
[data-theme="dark"] input.form-control,
[data-theme="dark"] input.input-form,
[data-theme="dark"] input.input-gate,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] select.form-control,
[data-theme="dark"] select {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] textarea::placeholder,
[data-theme="dark"] input::placeholder {
  color: #64748b !important;
}

[data-theme="dark"] select option,
[data-theme="dark"] optgroup {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
  accent-color: #4f46e5;
}

[data-theme="dark"] input[type="file"]::file-selector-button,
[data-theme="dark"] input[type="file"]::-webkit-file-upload-button {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #475569 !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.75rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}
[data-theme="dark"] input[type="file"]::file-selector-button:hover,
[data-theme="dark"] input[type="file"]::-webkit-file-upload-button:hover {
  background: #334155 !important;
  border-color: #64748b !important;
}

/* Modal Sub-Containers and Specialized Cards in Dark Mode */
[data-theme="dark"] .rubric-export-icon {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

[data-theme="dark"] #modal-reset-student-password div[style*="background: #fef3c7"] {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
}

[data-theme="dark"] #card-export-zip {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
[data-theme="dark"] #card-export-zip strong {
  color: #4ade80 !important;
}

[data-theme="dark"] #payment-live-status-container {
  background: rgba(34, 197, 94, 0.12) !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
  color: #4ade80 !important;
}
[data-theme="dark"] #payment-live-status-text {
  color: #4ade80 !important;
}

[data-theme="dark"] #modal-student-accounts div[style*="background: #f0fdf4"] {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
}
[data-theme="dark"] #modal-student-accounts div[style*="background: #fffbeb"] {
  background: rgba(245, 158, 11, 0.12) !important;
  border-color: rgba(245, 158, 11, 0.25) !important;
}
[data-theme="dark"] #stat-class-active-accounts {
  color: #4ade80 !important;
}
[data-theme="dark"] #stat-class-pending-accounts {
  color: #fbbf24 !important;
}

[data-theme="dark"] .data-table thead tr {
  background: #1e293b !important;
  color: #f8fafc !important;
}
[data-theme="dark"] .data-table thead th {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] #qr-direct-link {
  background: #0f172a !important;
  color: #94a3b8 !important;
  border: 1px solid #334155 !important;
}
[data-theme="dark"] #qr-modal-exam-badge {
  background: rgba(99, 102, 241, 0.15) !important;
  color: #a5b4fc !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

[data-theme="dark"] .upload-field-card {
  background: rgba(15, 23, 42, 0.75) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
[data-theme="dark"] #edit-sub-dropzone {
  background: rgba(59, 130, 246, 0.1) !important;
  border-color: rgba(96, 165, 250, 0.3) !important;
}
[data-theme="dark"] #edit-sub-dropzone div {
  color: #93c5fd !important;
}
[data-theme="dark"] #edit-sub-existing-gallery {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] #edit-sub-graded-alert {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.35) !important;
  color: #fbbf24 !important;
}

[data-theme="dark"] #form-batch-import-students div[style*="background: #eef2ff"],
[data-theme="dark"] #modal-batch-import-students div[style*="background: #eef2ff"] {
  background: rgba(99, 102, 241, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}
[data-theme="dark"] #form-batch-import-students label,
[data-theme="dark"] #modal-batch-import-students label {
  color: #c7d2fe !important;
}

[data-theme="dark"] .plan-workload-badge {
  background: rgba(99, 102, 241, 0.18) !important;
  color: #a5b4fc !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
}

[data-theme="dark"] #modal-teacher-subscription div[style*="background: linear-gradient(135deg, #f8fafc"] {
  background: linear-gradient(135deg, #151e32 0%, #1e293b 100%) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
[data-theme="dark"] #sub-plan-title {
  color: #93c5fd !important;
}
[data-theme="dark"] .cycle-switcher-wrapper {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .cycle-switch-btn:not(.active) {
  color: #94a3b8 !important;
}
[data-theme="dark"] #modal-teacher-subscription div[style*="background: #eff6ff"] {
  background: rgba(59, 130, 246, 0.12) !important;
  border-color: rgba(59, 130, 246, 0.25) !important;
}
[data-theme="dark"] #modal-teacher-subscription div[style*="background: #eff6ff"] h3 {
  color: #93c5fd !important;
}
[data-theme="dark"] #modal-teacher-subscription div[style*="background: #eff6ff"] p {
  color: #cbd5e1 !important;
}

[data-theme="dark"] #portal-exam-selector {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #6366f1 !important;
}
[data-theme="dark"] #portal-live-submitted-card {
  background: #151e32 !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}
[data-theme="dark"] #portal-live-exam-title {
  color: #f8fafc !important;
}
[data-theme="dark"] #portal-live-submitted-card div {
  color: #cbd5e1 !important;
}
[data-theme="dark"] #portal-success-receipt {
  background: rgba(5, 150, 105, 0.15) !important;
  border-color: rgba(5, 150, 105, 0.35) !important;
}
[data-theme="dark"] #portal-success-receipt h4 {
  color: #34d399 !important;
}
[data-theme="dark"] #portal-success-receipt div {
  color: #a7f3d0 !important;
}
[data-theme="dark"] #portal-routing-info {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}
[data-theme="dark"] .portal-manual-entry-box {
  background: #151e32 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .portal-manual-entry-box label {
  color: #f8fafc !important;
}
[data-theme="dark"] .upload-dropzone-box {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] #portal-ocr-loading {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #4ade80 !important;
}
[data-theme="dark"] .segmented-button-group {
  background: #0f172a !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .segmented-btn:not(.active) {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
[data-theme="dark"] .segmented-btn:not(.active):hover {
  background: #334155 !important;
  color: #ffffff !important;
}

/* Rubric Studio Modal & Pro Layout */
#modal-rubric-studio .rubric-studio-modal-content,
#modal-rubric-studio .modal-content,
.rubric-studio-modal-content {
  max-width: min(96vw, 1380px) !important;
  width: min(96vw, 1380px) !important;
  height: min(92vh, 920px) !important;
  max-height: min(92vh, 920px) !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 1.25rem 1.5rem !important;
  border-radius: 20px !important;
  margin: auto !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.rubric-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  flex-shrink: 0;
}

.rubric-studio-title-group {
  min-width: 0;
  flex: 1 1 auto;
}

.rubric-studio-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.rubric-studio-title {
  font-size: 1.22rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.rubric-studio-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 650px;
}

.rubric-studio-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.rubric-studio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.rubric-studio-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.rubric-studio-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.rubric-studio-toolbar-right #studio-ai-instructions {
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 260px;
  font-size: 0.78rem;
}

.rubric-studio-disclaimer {
  margin-top: 0.65rem;
  flex-shrink: 0;
}

.rubric-studio-body {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  margin-top: 0.75rem;
}

.rubric-studio-left {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}
[data-theme="dark"] .rubric-studio-left {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(255, 255, 255, 0.1);
}

.rubric-studio-right {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  overflow-y: auto;
  min-height: 0;
}
[data-theme="dark"] .rubric-studio-right {
  background: #151e32;
  border-color: rgba(255, 255, 255, 0.1);
}

/* Print Friendly Styles */
@media print {
  /* Let the dedicated print iframe handle standard printing.
     If printed directly from window, hide app UI modals cleanly. */
  .modal-backdrop, .app-header, .sidebar, .speedgrader-cockpit-toolbar {
    display: none !important;
  }
}

/* Rubric Export Modal & Action Cards */
.rubric-export-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.rubric-export-card:hover, .rubric-export-card:focus-visible {
  border-color: #3b82f6;
  background: #f8fafc;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.rubric-export-card:active {
  transform: translateY(0);
}

[data-theme="dark"] .rubric-export-card {
  background: #151e32;
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .rubric-export-card:hover,
[data-theme="dark"] .rubric-export-card:focus-visible {
  background: #1e293b;
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.rubric-export-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

/* AI Progress Tracker Modal Styles */
.ai-progress-modal-content {
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.ai-sparkle-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #eff6ff 0%, #ede9fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.ai-progress-bar-container {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin: 0.75rem 0 1rem;
}

.ai-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #10b981 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.ai-progress-shimmer {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.ai-stepper-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ai-step-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}

.ai-step-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.ai-step-item.completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.ai-step-item.pending {
  opacity: 0.55;
}

.ai-step-icon {
  font-size: 1.15rem;
  width: 28px;
  text-align: center;
}

.ai-step-info {
  flex: 1;
  min-width: 0;
}

.ai-step-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.ai-step-status {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 1px;
}

.ai-step-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.ai-step-item.active .ai-step-badge {
  background: #dbeafe;
  color: #1d4ed8;
  animation: pulse-badge 1.5s infinite;
}

.ai-step-item.active.is-retrying {
  background: #fffbeb;
  border-color: #fde68a;
}

.ai-step-item.active.is-retrying .ai-step-badge {
  background: #fef3c7;
  color: #b45309;
  animation: pulse-badge 1.5s infinite;
}

[data-theme="dark"] .ai-step-item.active {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(96, 165, 250, 0.4);
}
[data-theme="dark"] .ai-step-item.active.is-retrying {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.45);
}
[data-theme="dark"] .ai-step-item.active.is-retrying .ai-step-badge {
  background: rgba(217, 119, 6, 0.35);
  color: #fde68a;
}