/* Modular CSS slice extracted from style.css (6463-7183) */
.rubric-section-correction {
  background: #f0fdf4;
  border-left: 3px solid #10b981;
}
.rubric-section-correction .rubric-block-header {
  color: #047857;
}

/* Submission Viewer Rubric Drawer */
.mvs-rubric-drawer {
  transition: width 0.3s ease, opacity 0.3s ease;
  z-index: 20;
}

@media (max-width: 900px) {
  .mvs-rubric-drawer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 60vh !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25) !important;
    z-index: 250 !important;
  }
}

/* Pre-bound Exam Banner in Student Portal */
.portal-exam-banner {
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-md, 8px);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.9rem;
  color: #3730a3;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.08);
}

.portal-exam-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #4f46e5;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* =====================================================================
   PORTAL DEADLINE & UPLOAD LIMIT DESIGN SYSTEM (v1.9.8)
   ===================================================================== */
.portal-deadline-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md, 10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.portal-deadline-card.active {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1.5px solid #86efac;
  color: #166534;
}

.portal-deadline-card.urgent {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  color: #92400e;
  animation: deadlinePulseRing 2s infinite ease-in-out;
}

.portal-deadline-card.expired {
  background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%);
  border: 1.5px solid #fecdd3;
  color: #9f1239;
}

@keyframes deadlinePulseRing {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.deadline-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.deadline-text-group {
  flex: 1;
  min-width: 0;
}

.deadline-title {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
}

.deadline-subtitle {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.15rem;
}

.countdown-digits {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.deadline-status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.deadline-status-pill.active-pill {
  background: #15803d;
  color: #ffffff;
}

.deadline-status-pill.urgent-pill {
  background: #d97706;
  color: #ffffff;
}

.deadline-status-pill.expired-pill {
  background: #be123c;
  color: #ffffff;
}

/* Upload Counter Badge */
.upload-counter-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease;
}

.upload-counter-badge.counter-normal {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.upload-counter-badge.counter-warn {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.upload-counter-badge.counter-max {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 800;
}

/* Preset Chips for Teacher QR Modal */
.qr-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-qr-chip,
.btn-quota-chip {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-qr-chip:hover,
.btn-quota-chip:hover {
  border-color: #6366f1;
  color: #4f46e5;
  background: #f5f3ff;
}

.btn-qr-chip.active,
.btn-quota-chip.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.badge-status-neutral {
  background: #e2e8f0;
  color: #475569;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.badge-status-urgent {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.portal-zone-locked {
  pointer-events: none;
  opacity: 0.6;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

/* Mobile Responsive Camera Scanner & Student Portal Styles */
@media (max-width: 640px) {
  .portal-deadline-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }
  .portal-deadline-card .deadline-status-pill {
    align-self: flex-start;
  }
  .qr-preset-chips {
    justify-content: flex-start;
  }
  .btn-qr-chip {
    padding: 0.35rem 0.6rem;
    font-size: 0.76rem;
  }

  #modal-camera-scanner {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #000000 !important;
    z-index: 99999 !important;
  }

  #modal-camera-scanner .camera-modal-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    background: #000000 !important;
    padding: max(0.5rem, env(safe-area-inset-top, 10px)) 0.75rem max(1.2rem, env(safe-area-inset-bottom, 24px)) 0.75rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  #modal-camera-scanner .camera-viewfinder-box video#camera-video-stream {
    height: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
  }

  .portal-flow-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .portal-action-btn-group {
    flex-direction: column !important;
    width: 100% !important;
  }

  .portal-action-btn-group button {
    width: 100% !important;
    min-height: 48px !important;
    justify-content: center !important;
    font-size: 0.95rem !important;
  }

  .portal-thumbnails-tray {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0.5rem 0 !important;
    gap: 0.5rem !important;
  }

  .portal-thumb-item {
    width: 75px !important;
    height: 95px !important;
    flex-shrink: 0 !important;
  }

  #btn-portal-confirm-submit {
    min-height: 50px !important;
    font-size: 1.05rem !important;
  }
}

/* ==========================================================================
   RUBRIC & GRADING GUIDE MANAGEMENT (4 MODES & RUBRIC STUDIO)
   ========================================================================== */
.rubric-management-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
}

.rubric-mode-tabs {
  display: flex;
  gap: 0.35rem;
  background: var(--surface-hover);
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 0.75rem;
  overflow-x: auto;
}

.rubric-tab-btn {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.rubric-tab-btn:hover {
  color: var(--text-main);
  background: var(--surface-active);
}

.rubric-tab-btn.active {
  background: var(--card-bg);
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .rubric-tab-btn {
  color: #94a3b8;
}

[data-theme="dark"] .rubric-tab-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .rubric-tab-btn.active {
  background: #1e293b;
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.rubric-badge-neutral {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-score-valid {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

[data-theme="dark"] .badge-score-valid {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-score-invalid {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

[data-theme="dark"] .badge-score-invalid {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.rubric-ai-assistant-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 0.6rem;
}

.rubric-ai-assistant-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: #166534;
}

.rubric-ai-assistant-badge {
  font-size: 0.75rem;
  color: #15803d;
}

[data-theme="dark"] .rubric-ai-assistant-box {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="dark"] .rubric-ai-assistant-title {
  color: #6ee7b7;
}

[data-theme="dark"] .rubric-ai-assistant-badge {
  color: #34d399;
}

.rubric-panel-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: var(--card-bg);
  color: var(--text-main);
}

.rubric-dropzone {
  border: 2px dashed #818cf8;
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  background: #f5f3ff;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rubric-dropzone:hover {
  border-color: #6366f1;
  background: #eef2ff;
}

.rubric-dropzone-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #4338ca;
  margin-bottom: 0.25rem;
}

[data-theme="dark"] .rubric-dropzone {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(129, 140, 248, 0.4);
}

[data-theme="dark"] .rubric-dropzone:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #818cf8;
}

[data-theme="dark"] .rubric-dropzone-title {
  color: #a5b4fc !important;
}

.rubric-question-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s ease;
}

.rubric-question-card:hover {
  border-color: #93c5fd;
}

.rubric-q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.rubric-q-meta-grid {
  display: grid;
  grid-template-columns: 120px 1fr 90px auto;
  gap: 0.4rem;
  align-items: center;
}

.rubric-q-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.rubric-methods-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin: 0.4rem 0;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--border-color, #e2e8f0);
}

.rubric-methods-tabs {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.rubric-methods-tabs::-webkit-scrollbar {
  display: none;
}

.rubric-method-tab {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .rubric-methods-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
  .rubric-methods-tabs {
    width: 100%;
    padding-bottom: 2px;
  }
  .rubric-q-detail {
    grid-template-columns: 1fr;
  }
}

.btn-add-rubric-question {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-weight: 700;
  transition: all 0.15s ease;
}
.btn-add-rubric-question:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
}
[data-theme="dark"] .btn-add-rubric-question {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  color: #93c5fd !important;
}
[data-theme="dark"] .btn-add-rubric-question:hover {
  background: rgba(59, 130, 246, 0.3) !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

.rubric-criteria-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.2rem;
}
[data-theme="dark"] .rubric-criteria-label {
  color: #4ade80 !important;
}

.rubric-solution-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #2563eb;
  margin-bottom: 0.2rem;
}
[data-theme="dark"] .rubric-solution-label {
  color: #60a5fa !important;
}

.rubric-textarea,
.rubric-q-detail textarea {
  width: 100% !important;
  font-size: 0.78rem !important;
  padding: 0.4rem 0.6rem !important;
  border: 1px solid var(--border-color, #cbd5e1) !important;
  border-radius: var(--radius-xs, 6px) !important;
  resize: vertical !important;
  min-height: 52px !important;
  background: var(--input-bg, #ffffff) !important;
  color: var(--input-text, #0f172a) !important;
  font-family: inherit !important;
  line-height: 1.45 !important;
}

.rubric-deduction-field {
  background: #fff1f2 !important;
  color: #991b1b !important;
  border: 1px solid #fecdd3 !important;
}
.rubric-deduction-field::placeholder {
  color: #f87171 !important;
}
[data-theme="dark"] .rubric-deduction-field {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
}
[data-theme="dark"] .rubric-deduction-field::placeholder {
  color: #f87171 !important;
}
/* ==========================================================================
   RUBRIC STUDIO MATHEMATICAL FORMULA RENDERING & LIVE PREVIEW
   ========================================================================== */
.rubric-math-box {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  border-radius: var(--radius-xs, 6px);
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.6;
  min-height: 52px;
  cursor: pointer;
  transition: all 0.18s ease;
  word-break: break-word;
  user-select: text;
}

.rubric-math-box.criteria {
  background: rgba(240, 253, 244, 0.75);
  border: 1px solid #86efac;
  color: #14532d;
}
.rubric-math-box.criteria:hover {
  background: #f0fdf4;
  border-color: #4ade80;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.12);
}

.rubric-math-box.solution {
  background: rgba(239, 246, 255, 0.75);
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}
.rubric-math-box.solution:hover {
  background: #eff6ff;
  border-color: #60a5fa;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.12);
}
