/* --------------------------------------------------------------------------
   detailed-grading-guide.css
   Detailed Grading Guide & Step-by-Step Solutions (Hướng Dẫn Chấm Chi Tiết)
   Specialized stylesheet for Rubric & Solution Accordion visual components.
   Complies strictly with <= 400 lines ceiling.
   Official branding: AUTOGRADING.
   -------------------------------------------------------------------------- */

.ocr-grading-guide-wrapper {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ocr-guide-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid #e0e7ff;
  border-radius: 10px;
}

[data-theme="dark"] .ocr-guide-toolbar {
  background: rgba(30, 41, 59, 0.7);
  border-color: #334155;
}

.ocr-guide-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.ocr-guide-title {
  font-weight: 800;
  font-size: 0.96rem;
  color: #1e1b4b;
}

[data-theme="dark"] .ocr-guide-title {
  color: #f1f5f9;
}

.ocr-guide-score-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

[data-theme="dark"] .ocr-guide-score-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.ocr-guide-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.ocr-guide-view-switch {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

[data-theme="dark"] .ocr-guide-view-switch {
  background: #0f172a;
  border-color: #334155;
}

.btn-guide-mode {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-guide-mode.active {
  background: #ffffff;
  color: #4338ca;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-guide-mode.active {
  background: #1e293b;
  color: #818cf8;
}

.ocr-guide-actions-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* General Guidelines Executive Box */
.ocr-general-guidelines-box {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
  border: 1.5px solid #bae6fd;
  border-left: 4px solid #0284c7;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  color: #0c4a6e;
}

[data-theme="dark"] .ocr-general-guidelines-box {
  background: rgba(15, 23, 42, 0.85);
  border-color: #0369a1;
  border-left-color: #38bdf8;
  color: #e0f2fe;
}

.guidelines-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
  font-size: 0.86rem;
}

.guidelines-body {
  line-height: 1.55;
}

/* Detail Box & Accordion Row Styles */
.btn-toggle-row-detail {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: #4338ca;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.45rem;
  transition: all 0.15s ease;
}

.btn-toggle-row-detail:hover {
  background: rgba(99, 102, 241, 0.15);
}

.btn-toggle-row-detail.active {
  background: #4338ca;
  color: #ffffff;
}

[data-theme="dark"] .btn-toggle-row-detail {
  background: rgba(129, 140, 248, 0.15);
  border-color: rgba(129, 140, 248, 0.3);
  color: #c7d2fe;
}

[data-theme="dark"] .btn-toggle-row-detail.active {
  background: #6366f1;
  color: #ffffff;
}

.ocr-row-detail-box {
  margin-top: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  animation: fadeIn 0.2s ease-in-out;
}

[data-theme="dark"] .ocr-row-detail-box {
  background: #0f172a;
  border-color: #334155;
}

.detail-sub-section {
  margin-bottom: 0.5rem;
}

.detail-sub-section:last-child {
  margin-bottom: 0;
}

.detail-sub-heading {
  font-weight: 800;
  font-size: 0.8rem;
  color: #334155;
  margin-bottom: 0.2rem;
}

[data-theme="dark"] .detail-sub-heading {
  color: #cbd5e1;
}

.detail-sub-section.warning .detail-sub-heading {
  color: #b91c1c;
}

[data-theme="dark"] .detail-sub-section.warning .detail-sub-heading {
  color: #f87171;
}

.detail-sub-content {
  font-size: 0.83rem;
  line-height: 1.5;
  color: #475569;
}

[data-theme="dark"] .detail-sub-content {
  color: #94a3b8;
}

/* Full-Text Cards View */
.ocr-full-cards-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ocr-full-question-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .ocr-full-question-card {
  background: #1e293b;
  border-color: #334155;
}

.full-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid #f1f5f9;
}

[data-theme="dark"] .full-card-header {
  border-bottom-color: #334155;
}

.full-card-qid {
  font-weight: 900;
  font-size: 1.05rem;
  color: #1e1b4b;
}

[data-theme="dark"] .full-card-qid {
  color: #f8fafc;
}

.full-card-group {
  font-size: 0.78rem;
  padding: 2px 7px;
  background: #e2e8f0;
  color: #475569;
  border-radius: 4px;
}

[data-theme="dark"] .full-card-group {
  background: #334155;
  color: #cbd5e1;
}

.full-section-label {
  font-weight: 800;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.full-card-problem,
.full-card-solution,
.full-card-criteria,
.full-card-deduction {
  margin-top: 0.55rem;
  font-size: 0.86rem;
  line-height: 1.55;
}

.solution-text {
  background: rgba(2, 132, 199, 0.04);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #0284c7;
}

[data-theme="dark"] .solution-text {
  background: rgba(15, 23, 42, 0.6);
  border-left-color: #38bdf8;
}

.criteria-text {
  background: rgba(16, 185, 129, 0.04);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border-left: 3px solid #059669;
}

[data-theme="dark"] .criteria-text {
  background: rgba(15, 23, 42, 0.6);
  border-left-color: #34d399;
}

.ocr-matrix-problem-box {
  font-size: 0.82rem;
  color: #334155;
  background: #f8fafc;
  border-left: 3px solid #6366f1;
  padding: 0.4rem 0.65rem;
  border-radius: 5px;
  margin-bottom: 0.45rem;
  line-height: 1.5;
}

[data-theme="dark"] .ocr-matrix-problem-box {
  background: rgba(15, 23, 42, 0.75);
  color: #e2e8f0;
  border-left-color: #818cf8;
}

.quick-stage-3-results-layout {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.quick-stage-3-results-layout > .quick-annotated-pages-container[style*="display:none"] + .quick-grading-questions-container,
.quick-stage-3-results-layout > .quick-annotated-pages-container[style*="display: none"] + .quick-grading-questions-container {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .ocr-guide-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .ocr-guide-toolbar-right {
    justify-content: space-between;
  }
  .ocr-guide-actions-group {
    flex-wrap: wrap;
    width: 100%;
  }
  .ocr-rubric-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .quick-stage-3-toolbar .ocr-stage-3-header-actions {
    width: 100%;
  }
  .quick-stage-3-toolbar .ocr-stage-3-header-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
