/*
  PROFPORTAL: Tutor-only custom styles.

  This stylesheet is safe to load site-wide because it is scoped under `body.tutor-lms`.
*/

/* --- Tutor LMS: quiz layout + feedback styling (scoped) --- */
/* Tutor pages can be rendered under different wrappers (dashboard vs spotlight/single content). */
.tutor-wrap-parent,
.tutor-course-single-content-wrapper,
.tutor-quiz-wrapper {
  background: #fff;
}

/* Study Mode: reveal correct answers + instant feedback (green/red) */
.tutor-quiz-wrapper.pp-study-mode .pp-answer-hint .tutor-card {
  border-left: 5px solid #006400;
  /* Make correct options visible even before user clicks anything */
  background-color: rgba(149, 245, 176, 0.18);
  font-weight: 600;
}

.tutor-quiz-wrapper.pp-study-mode .pp-answer-correct .tutor-card {
  background-color: #95f5b0;
  border-left: 5px solid #006400;
  font-weight: 700;
}

.tutor-quiz-wrapper.pp-study-mode .pp-answer-incorrect .tutor-card {
  background-color: #ffdddd;
  border-left: 5px solid #f00;
  color: #a00;
}

.tutor-quiz-wrapper.pp-study-mode .pp-answer-incorrect .tutor-card::after {
  content: "Вы ответили неверно";
  display: block;
  color: #c00;
  font-weight: 700;
  margin-top: 6px;
}

/* CSS-only instant feedback (no JS): prep only */
.tutor-quiz-wrapper.pp-study-mode.pp-study-mode--instant .tutor-quiz-answer-single.pp-answer-hint:has(input:checked) .tutor-card {
  background-color: #95f5b0;
}

.tutor-quiz-wrapper.pp-study-mode.pp-study-mode--instant .tutor-quiz-answer-single:not(.pp-answer-hint):has(input:checked) .tutor-card {
  background-color: #ffdddd;
  border-left: 5px solid #f00;
  color: #a00;
}

/* Force quiz answers to a single column (Tutor sometimes uses 2-col grid) */
.tutor-course-single-content-wrapper .quiz-question-ans-choice-area .tutor-row,
.tutor-wrap-parent .quiz-question-ans-choice-area .tutor-row {
  display: block !important;
}

.tutor-course-single-content-wrapper .quiz-question-ans-choice-area .tutor-quiz-answer-single,
.tutor-wrap-parent .quiz-question-ans-choice-area .tutor-quiz-answer-single {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  flex: 0 0 100% !important;
}

/* Clear feedback: correct / incorrect (works when Tutor marks answers) */
/* PROFPORTAL: show correct/incorrect feedback only in study modes (prep + exam_review) */
.tutor-quiz-wrapper.pp-study-mode .tutor-quiz-answer-single-correct .tutor-card {
  background-color: #95f5b0;
  border-left: 5px solid #006400;
  font-weight: 700;
}

.tutor-quiz-wrapper.pp-study-mode .tutor-quiz-answer-single-incorrect .tutor-card {
  background-color: #ffdddd;
  border-left: 5px solid #f00;
  color: #a00;
}

.tutor-quiz-wrapper.pp-study-mode .tutor-quiz-answer-single-incorrect::after {
  content: "Вы ответили неверно";
  display: block;
  color: #c00;
  font-weight: 700;
  margin-top: 6px;
}

/* PROFPORTAL: Exam lock — after feedback is shown, prevent changing answers */
.tutor-quiz-wrapper .pp-locked-question .tutor-quiz-answer-single {
  pointer-events: none !important;
  opacity: 0.9;
}

.tutor-quiz-wrapper .pp-locked-question .tutor-quiz-answer-next-btn {
  pointer-events: auto !important;
}

/* PROFPORTAL: hints visibility by mode
   - prep + exam_review: allow "Подсказка" as Tutor renders it (click to expand)
   - exam: hide hints */
body.tutor-lms .tutor-quiz-wrapper.pp-mode-exam details.pp-quiz-hint {
  display: none !important;
}

/* --- PROFPORTAL: Quiz mode picker (prep/exam) --- */
.pp-quiz-modes {
  display: none; /* show ONLY when moved into Tutor left sidebar */
  /* Tutor-like card look */
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
}

.pp-quiz-modes__title {
  /* Typography is mostly from Tutor utility classes */
  margin-bottom: 10px;
}

.pp-quiz-modes__opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pp-quiz-modes__opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
}

/* Compact mode when moved into course left sidebar */
.pp-quiz-modes.pp-quiz-modes--sidebar {
  display: block;
  margin: 10px 10px 14px;
  padding: 14px 14px;
}

/* Input alignment inside the label */
body.tutor-lms .pp-quiz-modes__opt input[type="radio"] {
  margin-top: 2px;
}

/* --- PROFPORTAL: Attempts summary (mode-aware) --- */
body.tutor-lms .tutor-quiz-result-summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.02);
}

body.tutor-lms .tutor-quiz-result-summary .tutor-d-flex {
  gap: 6px;
  align-items: baseline;
}

/* --- PROFPORTAL: Embedded trainer inside quiz page --- */
body.tutor-lms .tutor-quiz-wrapper .pp-quiz-trainer-area {
  display: none;
  margin: 16px 0 0;
}

body.tutor-lms .tutor-quiz-wrapper.pp-trainer-active .pp-quiz-trainer-area {
  display: block;
}

/* Embedded trainer: always-available exit button */
body.tutor-lms .tutor-quiz-wrapper .pp-trainer-exit-fab {
  display: none;
}

body.tutor-lms .tutor-quiz-wrapper.pp-trainer-active .pp-trainer-exit-fab {
  display: inline-flex;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.18);
  border-radius: 999px;
  padding: 10px 14px;
}

/* When trainer is active, hide the rest of the quiz UI (keeps "in one window" feeling). */
body.tutor-lms .tutor-quiz-wrapper.pp-trainer-active > :not(.pp-quiz-trainer-area) {
  display: none !important;
}

/* Sidebar local tools */
body.tutor-lms .pp-quiz-local-tools details summary {
  list-style: none;
}

body.tutor-lms .pp-quiz-local-tools details summary::-webkit-details-marker {
  display: none;
}

/* Quiz local tools layout */
body.tutor-lms .pp-quiz-local-tools__toggles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quiz local tools: explicit radios for mode selection */
body.tutor-lms .pp-quiz-local-tools__view label {
  cursor: pointer;
}

body.tutor-lms .pp-quiz-local-tools__view .tutor-form-check-input {
  margin: 0;
}

body.tutor-lms .pp-quiz-local-tools__counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

body.tutor-lms .pp-quiz-local-tools__panel {
  width: 100%;
}

body.tutor-lms .pp-quiz-local-tools__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

body.tutor-lms .pp-quiz-local-tools .tutor-btn {
  border-radius: 12px;
}

body.tutor-lms .pp-quiz-local-tools__summary {
  cursor: pointer;
}

/* Hide duplicate "Повторение" buttons inside quiz sidebar */
body.tutor-lms .pp-hide-repeat-links a[href*="/pp-favorites"],
body.tutor-lms .pp-hide-repeat-links a[href*="/pp-wrong-answers"] {
  display: none !important;
}

/* Small count badge used in sidebar links/buttons */
body.tutor-lms .pp-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
  background: rgba(17, 24, 39, 0.08);
  color: #111827;
  margin-left: 8px;
}

/* --- PROFPORTAL: Favorites button (☆/★) --- */
.pp-qfav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111 !important;
  background: transparent !important;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  border: 1px solid rgba(17, 24, 39, 0.14) !important;
}

.pp-qfav-btn.pp-qfav-btn--active {
  color: #f5a623 !important;
  border-color: rgba(245, 166, 35, 0.5) !important;
  background: rgba(245, 166, 35, 0.08) !important;
}

.pp-qfav-btn .pp-qfav-btn__star {
  font-size: 18px;
  line-height: 1;
}

.pp-qfav-btn.pp-qfav-btn--compact {
  padding: 4px 8px;
  font-size: 13px;
}

/* Quiz question favorite button: separate bar (no layout breaking) */
body.tutor-lms .pp-qfav-bar {
  display: flex;
  justify-content: flex-end;
  margin: 6px 0 10px;
}

/* --- PROFPORTAL: Trainer UI helpers --- */
.pp-card {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.02);
}

.pp-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.pp-opt {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Trainer layout (Tutor-like spacing, minimal custom CSS). */
body.tutor-lms .pp-trainer__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

body.tutor-lms .pp-trainer__answer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pp-trainer-answer {
  /* Hook class: keep minimal to avoid overriding Tutor's quiz styles */
}

/* Optional feedback highlights (only after submit, controlled by JS) */
body.tutor-lms .pp-trainer-answer--selected .tutor-card {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.05);
}

body.tutor-lms .pp-trainer-answer--correct .tutor-card {
  border-color: rgba(36, 161, 72, 0.45);
  background: rgba(36, 161, 72, 0.08);
}

body.tutor-lms .pp-trainer-answer--wrong .tutor-card {
  border-color: rgba(244, 67, 55, 0.45);
  background: rgba(244, 67, 55, 0.06);
}

/* ---------- Trainer page: compact filter bar + full-width question ----------
   Settings live in a single horizontal bar on top. After Start the JS adds
   `pp-trainer--running` on the root → controls collapse to a one-line summary,
   so the question card uses 100% of the available width. */
body.tutor-lms .pp-trainer-bar {
  padding: 16px 18px;
}
body.tutor-lms .pp-trainer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
}
body.tutor-lms .pp-trainer-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
body.tutor-lms .pp-trainer-field__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #6b7280;
}

/* Segmented "Режим" control (radios styled as a pill group). */
body.tutor-lms .pp-seg {
  display: inline-flex;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 3px;
  background: #f9fafb;
  gap: 2px;
}
body.tutor-lms .pp-seg__item {
  margin: 0;
  cursor: pointer;
}
body.tutor-lms .pp-seg__item input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
body.tutor-lms .pp-seg__item span {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
body.tutor-lms .pp-seg__item input:checked + span {
  background: #3e64de;
  color: #fff;
  box-shadow: 0 1px 2px rgba(62, 100, 222, .35);
}
body.tutor-lms .pp-seg__item input:focus-visible + span {
  outline: 2px solid rgba(62, 100, 222, .5);
  outline-offset: 1px;
}

body.tutor-lms .pp-trainer-select {
  min-width: 200px;
  height: 40px;
}
body.tutor-lms .pp-trainer-select--narrow {
  min-width: 88px;
  width: 88px;
}
body.tutor-lms .pp-trainer-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 2px;
}
body.tutor-lms .pp-trainer-opt {
  margin: 0;
}
body.tutor-lms .pp-trainer-chip {
  align-self: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3e64de;
  font-size: 13px;
  font-weight: 500;
}
body.tutor-lms .pp-trainer-start-btn {
  margin-left: auto;
  min-width: 120px;
}
body.tutor-lms .pp-trainer-hint {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f1f3f7;
  font-size: 13px;
  color: #6b7280;
}

/* Collapsed (running) summary — hidden until a session starts. */
body.tutor-lms .pp-trainer-summary {
  display: none;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
body.tutor-lms .pp-trainer-summary__text {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
}
body.tutor-lms .pp-trainer-summary__text::before {
  content: "⚙ ";
  color: #3e64de;
}

body.tutor-lms .pp-trainer--running .pp-trainer-controls,
body.tutor-lms .pp-trainer--running .pp-trainer-hint {
  display: none;
}
body.tutor-lms .pp-trainer--running .pp-trainer-summary {
  display: flex;
}
body.tutor-lms .pp-trainer--running .pp-trainer-bar {
  padding: 12px 18px;
}

/* Question area: always full width (single-column layout). */
body.tutor-lms .pp-trainer-main {
  width: 100%;
}

@media (max-width: 600px) {
  body.tutor-lms .pp-trainer-controls {
    gap: 12px 14px;
  }
  body.tutor-lms .pp-trainer-field,
  body.tutor-lms .pp-trainer-select,
  body.tutor-lms .pp-trainer-start-btn {
    width: 100%;
    min-width: 0;
  }
  body.tutor-lms .pp-trainer-start-btn {
    margin-left: 0;
  }
  body.tutor-lms .pp-seg {
    width: 100%;
    justify-content: stretch;
  }
  body.tutor-lms .pp-seg__item {
    flex: 1;
    text-align: center;
  }
}

/* --- Tutor LMS: responsive / fluid layout (tables + dashboard) --- */
/* Make Tutor pages more "rubber" (use available width) without affecting non-Tutor pages. */
body.tutor-lms .ast-container {
  max-width: 100% !important;
}

/* PROFPORTAL: reusable help box (Tutor pages). */
body.tutor-lms .pp-help-box {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: rgba(17, 24, 39, 0.02);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 0;
}

body.tutor-lms .pp-help-box__title {
  font-weight: 700;
  margin-bottom: 8px;
}

body.tutor-lms .pp-help-box__text p {
  margin: 0 0 10px;
}

body.tutor-lms .pp-help-box__text ol {
  margin: 0 0 10px 18px;
}

body.tutor-lms .pp-help-box__note {
  opacity: 0.9;
}

body.tutor-lms .site-content .ast-container,
body.tutor-lms .site-content .ast-container-fluid {
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 1280px) {
  body.tutor-lms .site-content .ast-container,
  body.tutor-lms .site-content .ast-container-fluid {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 768px) {
  body.tutor-lms .site-content .ast-container,
  body.tutor-lms .site-content .ast-container-fluid {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Tables: always allow horizontal scroll instead of clipping. */
body.tutor-lms .tutor-table-responsive,
body.tutor-lms .tutor-dashboard-content-inner .tutor-table-responsive,
body.tutor-lms .tutor-dashboard-content-inner .tutor-table-responsive.tutor-dashboard-list-table {
  /*
    IMPORTANT (desktop issue): some Tutor blocks can become vertically scrollable (wheel scroll gets "trapped")
    when overflow-y is auto/scroll or when a max-height is applied.
    We allow horizontal scroll, but forbid vertical scrolling inside the table wrapper.
  */
  overflow: visible !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  max-height: none !important;
  height: auto !important;
}

/*
  Desktop "scroll trap" (wheel scroll stuck inside a block):
  In some Tutor dashboard views the scrollable container is NOT the .tutor-table-responsive itself,
  but one of the wrappers (dashboard content / list-table wrapper / attempt details wrapper) that applies
  max-height + overflow-y:auto. We disable that (keep page scrolling), while still allowing horizontal
  scroll on the table wrapper.
*/
body.tutor-lms .tutor-dashboard,
body.tutor-lms .tutor-dashboard-content-inner,
body.tutor-lms .tutor-dashboard-content,
body.tutor-lms .tutor-dashboard-list-table,
body.tutor-lms .tutor-quiz-attempt-details-wrapper {
  overflow: visible !important;
  overflow-y: visible !important;
  max-height: none !important;
  height: auto !important;
  min-width: 0;
}

/* Extra safety: if any "attempt details" table wrapper gets capped, uncap it. */
body.tutor-lms .tutor-quiz-attempt-details-wrapper .tutor-table-responsive {
  overflow: visible !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  max-height: none !important;
  height: auto !important;
}

/* Keep tables readable: let cells wrap instead of forcing cut-off. */
body.tutor-lms table.tutor-table {
  width: 100%;
  max-width: 100%;
  table-layout: auto;
}

body.tutor-lms table.tutor-table th,
body.tutor-lms table.tutor-table td {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Attempts table: override global aggressive wrapping */
body.tutor-lms table.tutor-table.tutor-table-quiz-attempts th,
body.tutor-lms table.tutor-table.tutor-table-quiz-attempts td {
  word-break: normal;
  overflow-wrap: normal;
}

/* Attempts tables: ensure header separators even without `.tutor-table-responsive` wrapper */
body.tutor-lms table.tutor-table.tutor-table-quiz-attempts {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid rgba(17, 24, 39, 0.14) !important;
  border-radius: 12px !important;
  background: #fff;
}

body.tutor-lms table.tutor-table.tutor-table-quiz-attempts thead th {
  background: rgba(17, 24, 39, 0.04);
  border-bottom: 1px solid rgba(17, 24, 39, 0.14);
  /* Header text may be long — allow wrapping */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  line-height: 1.15;
}

body.tutor-lms table.tutor-table.tutor-table-quiz-attempts th,
body.tutor-lms table.tutor-table.tutor-table-quiz-attempts td {
  border-right: 1px solid rgba(17, 24, 39, 0.10);
  border-bottom: 1px solid rgba(17, 24, 39, 0.10);
}

body.tutor-lms table.tutor-table.tutor-table-quiz-attempts th:last-child,
body.tutor-lms table.tutor-table.tutor-table-quiz-attempts td:last-child {
  border-right: 0;
}

body.tutor-lms table.tutor-table.tutor-table-quiz-attempts tbody tr:last-child td {
  border-bottom: 0;
}

/* Attempts tables: fixed layout helps keep numeric columns compact */
@media (min-width: 769px) {
  body.tutor-lms table.tutor-table.tutor-table-quiz-attempts {
    table-layout: fixed !important;
  }
}

/* Attempts table: do NOT break dates / action buttons into letters */
@media (min-width: 769px) {
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts th:first-child,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts td:first-child {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    min-width: 132px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts th:last-child,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts td:last-child {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    min-width: 140px;
  }
}

/* PROFPORTAL: attempts table compact numeric columns (desktop) */
@media (min-width: 769px) {
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts {
    table-layout: fixed;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts th,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts td {
    padding: 10px 12px;
    font-size: 14px;
    vertical-align: middle;
  }

  /* Headers can wrap by words (not by letters) */
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts thead th {
    white-space: normal;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts .pp-attempt-col--date {
    white-space: nowrap;
    min-width: 130px;
  }

  body.tutor-lms .pp-attempt-date {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
  }

  body.tutor-lms .pp-attempt-date__t {
    opacity: 0.82;
    font-size: 12px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--question,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--total_marks,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--correct_answer,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--incorrect_answer,
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--earned_marks {
    text-align: center;
    white-space: nowrap;
    min-width: 86px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--question {
    min-width: 70px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--earned_marks {
    min-width: 110px;
  }

  body.tutor-lms .pp-attempt-earned {
    display: inline-flex;
    gap: 6px;
    align-items: baseline;
  }

  body.tutor-lms .pp-attempt-earned__p {
    opacity: 0.82;
    font-size: 12px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--result {
    text-align: center;
    white-space: nowrap;
    min-width: 92px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--details {
    text-align: center;
    white-space: nowrap;
    min-width: 120px;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--details .tutor-btn {
    padding: 8px 10px;
    white-space: nowrap;
  }

  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table-quiz-attempts
    .pp-attempt-col--result .tutor-badge-label {
    font-size: 12px;
    padding: 4px 10px;
  }
}

@media (min-width: 769px) {
  /* "Мои попытки теста" + quiz attempts: compact numeric columns */
  body.tutor-lms table.tutor-table-quiz-attempts th,
  body.tutor-lms table.tutor-table-quiz-attempts td {
    padding: 10px 12px;
    font-size: 14px;
    vertical-align: middle;
  }

  /* Allow header text to wrap by words */
  body.tutor-lms table.tutor-table-quiz-attempts thead th {
    white-space: normal;
  }

  /* Numeric columns (2..6) */
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(2),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(2),
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(3),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(3),
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(4),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(4),
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(5),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(5),
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(6),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(6) {
    text-align: center;
    white-space: nowrap;
  }

  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(2),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(2) {
    width: 76px;
  }
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(3),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(3) {
    width: 88px;
  }
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(4),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(4),
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(5),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(5) {
    width: 118px;
  }
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(6),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(6) {
    width: 128px;
  }

  /* Result + Details */
  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(7),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(7) {
    width: 110px;
    text-align: center;
    white-space: nowrap;
  }

  body.tutor-lms table.tutor-table-quiz-attempts th:nth-child(8),
  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(8) {
    width: 132px;
    text-align: center;
    white-space: nowrap;
  }

  body.tutor-lms table.tutor-table-quiz-attempts td:nth-child(8) .tutor-btn {
    padding: 8px 10px;
    white-space: nowrap;
  }
}

/* PROFPORTAL: Tutor tables "beauty pass" (consistent borders + rounded corners, no weird cut corners). */
body.tutor-lms .tutor-table-responsive {
  /* Avoid double frames from wrappers; the table itself will draw the frame. */
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.tutor-lms .tutor-table-responsive table.tutor-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border: 1px solid rgba(17, 24, 39, 0.14) !important;
  border-radius: 12px !important;
  background: #fff;
}

body.tutor-lms .tutor-table-responsive table.tutor-table thead th {
  background: rgba(17, 24, 39, 0.04);
  border-bottom: 1px solid rgba(17, 24, 39, 0.14);
}

body.tutor-lms .tutor-table-responsive table.tutor-table th,
body.tutor-lms .tutor-table-responsive table.tutor-table td {
  border-right: 1px solid rgba(17, 24, 39, 0.10);
  border-bottom: 1px solid rgba(17, 24, 39, 0.10);
}

body.tutor-lms .tutor-table-responsive table.tutor-table th:last-child,
body.tutor-lms .tutor-table-responsive table.tutor-table td:last-child {
  border-right: 0;
}

body.tutor-lms .tutor-table-responsive table.tutor-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Attempt details ("Подробности" + "Quiz Overview"): make content wrap nicely and avoid cramped layout. */
body.tutor-lms table.tutor-table.tutor-quiz-attempt-details th,
body.tutor-lms table.tutor-table.tutor-quiz-attempt-details td {
  white-space: normal !important;
  vertical-align: top;
}

body.tutor-lms table.tutor-table.tutor-quiz-attempt-details td.questions,
body.tutor-lms table.tutor-table.tutor-quiz-attempt-details td.given-answer,
body.tutor-lms table.tutor-table.tutor-quiz-attempt-details td.correct-answer {
  max-width: 560px;
}

/* On small screens, prevent "squeezed" columns: prefer horizontal scroll. */
@media (max-width: 768px) {
  /* Default behavior: allow horizontal scrolling for wide tables */
  body.tutor-lms .tutor-table-responsive:not(.tutor-table-mobile) table.tutor-table {
    min-width: 680px;
  }

  /*
    Tutor adds .tutor-table-mobile for quiz attempt tables on frontend dashboard.
    Tutor's own CSS turns it into a mobile-friendly stacked layout.
    We must NOT force min-width there, otherwise it looks "cut" or causes unnecessary scroll.
  */
  body.tutor-lms .tutor-table-responsive.tutor-table-mobile table.tutor-table {
    min-width: 0 !important;
  }

  /* Reduce overly large fixed first column in attempt tables on small screens */
  body.tutor-lms .tutor-dashboard .tutor-dashboard-content .tutor-table.tutor-table-quiz-attempts tr th:first-child,
  body.tutor-lms .tutor-dashboard .tutor-dashboard-content .tutor-table.tutor-table-quiz-attempts tr td:first-child {
    min-width: 140px !important;
  }

  /*
    "My Quiz Attempts" on mobile: Tutor converts rows into vertical cards.
    Make sure the wrapper does NOT create its own vertical scrolling area (no max-height / overflow-y:auto),
    and remove the "boxed" feeling by reducing horizontal paddings.
  */
  body.tutor-lms .tutor-dashboard .tutor-dashboard-content {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.tutor-lms .tutor-dashboard .tutor-dashboard-content-inner {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.tutor-lms .tutor-dashboard .tutor-table-responsive.tutor-table-mobile {
    max-height: none !important;
    height: auto !important;
    overflow-y: visible !important;
    box-shadow: none !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  /* Make Tutor form controls and buttons comfortable on mobile. */
  body.tutor-lms .tutor-form-control,
  body.tutor-lms .tutor-form-select {
    width: 100%;
  }

  body.tutor-lms .tutor-btn {
    max-width: 100%;
  }
}

/* ==========================================================================
   Режим «Просмотр» (view) — read-only список вопросов и ответов для запоминания.
   ========================================================================== */

/* While the read-only view is active, hide Tutor's start/attempt UI to avoid a flash. */
html.pp-quiz-view-active #tutor-start-quiz,
html.pp-quiz-view-active .tutor-quiz-info-area,
html.pp-quiz-view-active .start-quiz-wrap,
html.pp-quiz-view-active .quiz-attempt-single-question,
html.pp-quiz-view-active .tutor-quiz-attempt-wrapper {
  display: none !important;
}

.pp-trainer-view {
  margin: 0 0 24px;
}

.pp-view-controls {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  margin-bottom: 16px;
  background: #fff;
  border-bottom: 1px solid #e6e9ef;
}

.pp-view-search {
  flex: 1 1 260px;
  min-width: 180px;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid #cfd6e4;
  border-radius: 8px;
  outline: none;
}

.pp-view-search:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pp-view-count {
  font-size: 13px;
  color: #6b7280;
  white-space: nowrap;
}

.pp-view-print {
  padding: 9px 16px;
  font-size: 14px;
  color: #1f2937;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
}

.pp-view-print:hover {
  background: #e5e7eb;
}

.pp-view-questions {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pp-view-q;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pp-view-item {
  counter-increment: pp-view-q;
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.pp-view-q {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: #111827;
  margin-bottom: 12px;
}

.pp-view-q::before {
  content: counter(pp-view-q) ". ";
  color: #6b7280;
  font-weight: 600;
}

.pp-view-answers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-view-answers li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.4;
}

.pp-view-answers .pp-correct {
  background: #ecfdf3;
  border: 1px solid #abefc6;
  color: #085d3a;
  font-weight: 600;
}

.pp-view-answers .pp-wrong {
  background: #f9fafb;
  border: 1px solid #eef0f4;
  color: #374151;
}

.pp-view-mark {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-weight: 700;
}

.pp-view-answers .pp-correct .pp-view-mark {
  color: #12b76a;
}

.pp-view-answers .pp-wrong .pp-view-mark {
  color: #9ca3af;
}

.pp-view-atext {
  flex: 1 1 auto;
}

.pp-view-explanation {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 3px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
}

/* Print: clean black-on-white, drop controls and chrome. */
@media print {
  .pp-view-controls,
  .tutor-course-single-sidebar-wrapper,
  .pp-quiz-modes,
  header,
  footer,
  .site-header,
  .site-footer {
    display: none !important;
  }

  .pp-view-item {
    border: 1px solid #999;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .pp-view-answers .pp-correct {
    background: transparent;
    border: 1px solid #000;
  }

  .pp-view-answers .pp-wrong {
    background: transparent;
    border: 1px dashed #bbb;
  }
}

/* === PROFPORTAL v0.3.1: trainer polish === */

/* (1) Hide raw Tutor "skip quiz" control on scoped quizzes — meaningless for
   attestation practice and reads as leftover "standard Tutor" chrome. */
body.pp-scoped-quiz .skip-quiz-btn {
  display: none !important;
}

/* (2) "Следующий →" instant-advance button shown during the exam-review
   feedback window, so faster users don't have to wait for the auto-advance. */
.pp-next-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.pp-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #3e64de;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(62, 100, 222, 0.28);
  transition: background 0.15s ease, transform 0.05s ease;
}

.pp-next-btn:hover {
  background: #2f50bd;
}

.pp-next-btn:active {
  transform: translateY(1px);
}

/* (3) Mode picker: clearly highlight the active mode. */
.pp-quiz-modes__opt.is-active {
  border-radius: 10px;
  background: rgba(62, 100, 222, 0.08);
  box-shadow: inset 0 0 0 2px #3e64de;
  margin: -4px -8px;
  padding: 4px 8px;
}

.pp-quiz-modes__opt.is-active span {
  color: #1f2937 !important;
  font-weight: 600;
}

/* (3) Toast confirming the selected mode after a switch. */
.pp-mode-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 100000;
  background: #1f2937;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.pp-mode-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* (3) Spinner overlay shown for the brief moment a mode switch reloads the page. */
.pp-mode-spinner {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(1px);
}

.pp-mode-spinner__ring {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(62, 100, 222, 0.25);
  border-top-color: #3e64de;
  border-radius: 50%;
  animation: pp-spin 0.7s linear infinite;
}

@keyframes pp-spin {
  to {
    transform: rotate(360deg);
  }
}

