/* Modular CSS slice extracted from math-ocr.css (1435-1851) */
.ocr-annotated-subtext {
  font-size: 0.77rem;
  color: #475569;
  margin-top: 0.15rem;
  line-height: 1.38;
}

.ocr-annotated-page-pills {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.ocr-page-pill-btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
}

.ocr-page-pill-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.ocr-annotation-viewer-mount {
  min-height: 420px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
}

.ocr-annotation-viewer-mount .viewer-toolbar {
  height: auto;
  min-height: 44px;
  padding: 0.45rem 0.75rem;
}

.ocr-annotation-viewer-mount .viewer-canvas-area {
  min-height: 360px;
  max-height: 70vh;
  padding: 1rem;
}

/* ==========================================================================
   ENHANCED COMPACT & MOBILE ERGONOMIC ANNOTATION VIEWER
   ========================================================================== */
.ocr-annotated-panel-header--compact {
  padding: 0.5rem 0.85rem;
  align-items: center;
}

.ocr-annotated-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-ocr-fullscreen {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-ocr-fullscreen:hover,
.btn-ocr-fullscreen.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

/* Floating Action Dock inside Viewer */
.viewer-floating-dock {
  position: absolute;
  right: 1rem;
  bottom: 1.25rem;
  z-index: 25;
  display: none;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: auto;
}

.floating-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(203, 213, 225, 0.85);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #1e293b;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}

.floating-btn:active {
  transform: scale(0.92);
  background: #e2e8f0;
}

#btn-float-peek {
  background: rgba(254, 242, 242, 0.95);
  border-color: #fca5a5;
  color: #dc2626;
  font-weight: 800;
}

#btn-float-peek.is-peeking {
  background: #dc2626;
  color: #ffffff;
}

/* Fullscreen Focus Mode */
.ocr-panel-fullscreen-active {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 100000 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
}

.ocr-panel-fullscreen-active .ocr-annotation-viewer-mount {
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
}

.ocr-panel-fullscreen-active .viewer-canvas-area {
  flex: 1 1 auto !important;
  height: 100% !important;
  max-height: 100% !important;
}

body.ocr-fullscreen-locked {
  overflow: hidden !important;
}

body.ocr-fullscreen-locked #zalo-chat-widget,
body.ocr-fullscreen-locked .zalo-chat-container,
body.ocr-fullscreen-locked .mobile-bottom-bar,
body.ocr-fullscreen-locked .bottom-nav {
  display: none !important;
}

@media (max-width: 768px) {
  .ocr-hide-mobile {
    display: none !important;
  }

  .ocr-heading-full {
    display: none !important;
  }

  .ocr-annotated-panel-header--compact {
    padding: 0.45rem 0.65rem;
  }

  .ocr-annotated-heading {
    font-size: 0.86rem;
  }

  /* Ẩn bộ chọn trang lặp đôi trong toolbar khi đã có pills ở trên */
  .ocr-annotated-panel .viewer-toolbar .toolbar-group-nav {
    display: none !important;
  }

  /* Ẩn 5 nút zoom tĩnh trên toolbar, chuyển sang floating dock */
  .ocr-annotated-panel .viewer-toolbar .toolbar-group-zoom {
    display: none !important;
  }

  .ocr-annotated-panel .viewer-toolbar {
    min-height: 38px;
    padding: 0.25rem 0.6rem;
    justify-content: flex-end;
  }

  /* Kích hoạt floating dock trên mobile */
  .ocr-annotated-panel .viewer-floating-dock {
    display: flex !important;
  }

  /* Tối ưu không gian canvas trên mobile */
  .ocr-annotation-viewer-mount {
    min-height: 480px;
    max-height: 75vh;
  }

  .ocr-annotation-viewer-mount .viewer-canvas-area {
    min-height: 420px;
    max-height: 70vh;
    padding: 0.4rem;
  }
}

@media (max-width: 480px) {
  .btn-ocr-fullscreen .fullscreen-label {
    display: none;
  }

  .ocr-annotation-viewer-mount {
    min-height: 440px;
  }
}

/* Pedagogical Strengths & Improvements in Score Ribbon */
.ocr-pedagogical-highlights {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.ocr-highlight-pill {
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  line-height: 1.4;
}

.ocr-highlight-pill.is-strength {
  background: #ecfdf5;
  color: #065f46;
  border-left: 3px solid #10b981;
}

.ocr-highlight-pill.is-improve {
  background: #fffbeb;
  color: #92400e;
  border-left: 3px solid #f59e0b;
}

/* Interactive Question Breakdown & Red-Pen Notes */
.ocr-extracted-rubric-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.75rem;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #1e1b4b;
}

.ocr-questions-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.ocr-questions-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
}

.ocr-questions-section-hint {
  font-size: 0.75rem;
  color: #64748b;
}

.ocr-grading-question-item.is-interactive {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.ocr-grading-question-item.is-interactive:hover {
  border-color: #fda4af;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.08);
}

.ocr-q-title-group,
.ocr-q-score-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ocr-q-status-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
}

.ocr-q-status-dot.is-full { background: #dcfce7; color: #15803d; }
.ocr-q-status-dot.is-partial { background: #fef3c7; color: #b45309; }
.ocr-q-status-dot.is-zero { background: #fee2e2; color: #b91c1c; }

.ocr-q-page-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.ocr-btn-locate-redpen {
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
  cursor: pointer;
}

.ocr-q-redpen-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.4rem 0;
}

.ocr-redpen-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  font-size: 0.76rem;
  font-weight: 700;
}

.ocr-q-criteria {
  font-size: 0.8rem;
  color: #334155;
  background: #f8fafc;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.4rem;
}

@media (max-width: 1024px) {
  .ocr-stage-3-results-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .ocr-workflow-mode-bar {
    grid-template-columns: 1fr;
  }

  .ocr-stage-1-cta-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  #btn-ocr-grade-combined-shortcut,
  #btn-ocr-print-annotated-pdf {
    width: 100%;
    justify-content: center;
  }

  .ocr-combined-selectors {
    width: 100%;
  }

  .ocr-combined-selectors .form-control {
    flex: 1;
  }
}

@media (min-width: 769px) {
  #math-ocr-view {
    padding-bottom: 96px !important;
  }
  body.utility-mode #ag-support-fab,
  body.math-ocr-mode #ag-support-fab {
    bottom: 14px;
    right: 14px;
    transform: scale(0.92);
    transform-origin: bottom right;
  }
}
