/*
 * MDT OSCE V2 Result & Direct Restore
 * Build: W2.3-R40.9-visible-transcript-checklist
 *
 * Owns only the finalising/result route presentation. It deliberately does not
 * alter station controls or navigation behaviour on active consultation routes.
 */


html.osce-v2-terminal-route,
body.osce-v2-terminal-route {
  height: 100% !important;
  overflow: hidden !important;
}

body.osce-v2-terminal-route #osce-chatbot-app,
body.osce-v2-terminal-route #chatbotView,
body.osce-v2-terminal-route .app-container,
body.osce-v2-terminal-route .osce-app-shell {
  height: calc(100vh - var(--wp-admin--admin-bar--height, 0px)) !important;
  max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px)) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.osce-v2-terminal-route #chatDisplay,
body.osce-v2-terminal-route .chat-display {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
}

body.osce-v2-terminal-route .chat-input-container,
body.osce-v2-terminal-route #chatInputContainer,
body.osce-v2-terminal-route .message-input-container,
body.osce-v2-terminal-route #chatInputWrapper,
body.osce-v2-terminal-route [data-osce-composer],
body.osce-v2-terminal-route .phase-tracker,
body.osce-v2-terminal-route [data-osce-phase-tracker],
body.osce-v2-terminal-route .station-phase-tracker,
body.osce-v2-terminal-route .station-header-controls {
  display: none !important;
}

body.osce-v2-terminal-route #mainContent,
body.osce-v2-terminal-route .main-content {
  height: calc(100vh - var(--wp-admin--admin-bar--height, 0px)) !important;
  max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px)) !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding-bottom: 48px !important;
  background: #f6f8fc !important;
}

.osce-v2-attempt-result-view,
.osce-v2-attempt-finalising-view {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 72px;
  box-sizing: border-box;
  color: #172033;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.osce-v2-result-loading,
.osce-v2-finalising-card,
.osce-v2-result-card {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e1e7f0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(24, 36, 60, 0.08);
}

.osce-v2-result-loading {
  padding: 48px;
  color: #667085;
  font-weight: 700;
}

.osce-v2-result-card {
  padding: clamp(22px, 3vw, 36px);
}

.osce-v2-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 26px;
  border-bottom: 1px solid #edf0f5;
}

.osce-v2-result-heading {
  min-width: 0;
}

.osce-v2-result-eyebrow,
.osce-v2-result-section-heading > div > span {
  display: block;
  margin-bottom: 7px;
  color: #6266d7;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.osce-v2-result-heading h1,
.osce-v2-finalising-card h1,
.osce-v2-result-unavailable h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.14;
  letter-spacing: -.025em;
}

.osce-v2-result-attempt {
  margin: 10px 0 0;
  color: #667085;
  font-size: 13px;
  overflow-wrap: anywhere;
}


.osce-v2-result-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.osce-v2-result-quick-actions .osce-v2-result-button {
  min-height: 40px;
  padding-inline: 15px;
}

.osce-v2-result-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(98px, 1fr));
  gap: 10px;
  flex: 0 0 auto;
}

.osce-v2-result-score,
.osce-v2-result-outcome {
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 13px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
  text-align: center;
}

.osce-v2-result-score strong,
.osce-v2-result-outcome strong {
  display: block;
  color: #111827;
  font-size: 25px;
  line-height: 1;
}

.osce-v2-result-score span,
.osce-v2-result-outcome span {
  margin-top: 7px;
  color: #667085;
  font-size: 12px;
  font-weight: 650;
}

.osce-v2-result-outcome.pass {
  border-color: #a7e8ce;
  background: #effcf6;
}
.osce-v2-result-outcome.pass strong { color: #087f5b; }
.osce-v2-result-outcome.fail {
  border-color: #f2c7a7;
  background: #fff8f1;
}
.osce-v2-result-outcome.fail strong { color: #c2410c; }

.osce-v2-result-integrity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}
.osce-v2-result-integrity strong { white-space: nowrap; }
.osce-v2-result-integrity.conflict {
  border: 1px solid #f5d18e;
  background: #fffbeb;
  color: #7c4a03;
}

.osce-v2-result-feedback {
  margin-top: 28px;
}

.osce-v2-result-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.osce-v2-result-section-heading h2 {
  margin: 0;
  color: #111827;
  font-size: 22px;
  letter-spacing: -.015em;
}

.osce-v2-result-status,
.osce-v2-result-verdict {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.osce-v2-result-status.consistent,
.osce-v2-result-verdict.pass {
  background: #eafaf3;
  color: #087f5b;
}
.osce-v2-result-status.provisional,
.osce-v2-result-verdict.borderline {
  background: #fff8e8;
  color: #9a6200;
}
.osce-v2-result-status.conflict,
.osce-v2-result-verdict.fail {
  background: #fff0ed;
  color: #bd321a;
}
.osce-v2-result-verdict.neutral { background: #eef2f7; color: #4b5563; }

.osce-v2-result-feedback-grid {
  display: grid;
  gap: 14px;
}

.osce-v2-result-domain,
.osce-v2-result-free-text {
  border: 1px solid #e3e8f2;
  border-radius: 18px;
  background: #fbfcff;
}

.osce-v2-result-domain {
  padding: 20px;
}

.osce-v2-result-domain > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.osce-v2-result-domain > header h2 {
  margin: 0;
  color: #1f2937;
  font-size: 17px;
  line-height: 1.35;
}

.osce-v2-result-feedback-section {
  padding-top: 13px;
  border-top: 1px solid #edf0f5;
}
.osce-v2-result-feedback-section + .osce-v2-result-feedback-section { margin-top: 13px; }
.osce-v2-result-feedback-section h3 {
  margin: 0 0 6px;
  color: #5358b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .045em;
  text-transform: uppercase;
}
.osce-v2-result-feedback-section p,
.osce-v2-result-free-text p,
.osce-v2-result-list {
  margin: 0;
  color: #425066;
  font-size: 14px;
  line-height: 1.65;
}
.osce-v2-result-list { padding-left: 20px; }
.osce-v2-result-list li + li { margin-top: 6px; }
.osce-v2-result-free-text { padding: 20px; }
.osce-v2-result-empty { color: #667085; }

.osce-v2-result-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid #edf0f5;
}

.osce-v2-result-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 750;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.osce-v2-result-button:hover { transform: translateY(-1px); }
.osce-v2-result-button.secondary {
  border: 1px solid #d6dde8;
  background: #fff;
  color: #344054;
}
.osce-v2-result-button.primary {
  background: #5b52e6;
  color: #fff;
  box-shadow: 0 8px 20px rgba(91, 82, 230, .22);
}
.osce-v2-result-button.transcript {
  background: #0b86c9;
  color: #fff;
}
.osce-v2-result-button.unavailable {
  pointer-events: none;
  background: #e8edf3;
  color: #8a95a5;
  box-shadow: none;
}

.osce-v2-finalising-card {
  max-width: 720px;
  margin: 70px auto;
  padding: 34px;
}
.osce-v2-finalising-card p { color: #667085; line-height: 1.6; }
.osce-v2-finalising-progress {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg,#6255e8,#28b5dc,#6255e8);
  background-size: 200% 100%;
  animation: osceV2Pulse 1.4s linear infinite;
}

.osce-v2-result-unavailable { max-width: 720px; margin: 48px auto; }
.osce-v2-result-unavailable p { color: #667085; line-height: 1.6; }

@media (max-width: 1080px) {
  body.osce-v2-terminal-route .sidebar,
  body.osce-v2-terminal-route #sidebar {
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
  }
  body.osce-v2-terminal-route #mainContent,
  body.osce-v2-terminal-route .main-content {
    margin-left: 76px !important;
  }
  body.osce-v2-terminal-route .sidebar-nav-text,
  body.osce-v2-terminal-route .sidebar .section-title span,
  body.osce-v2-terminal-route .sidebar-role-badge span,
  body.osce-v2-terminal-route .sidebar-header h1,
  body.osce-v2-terminal-route .sidebar-header h2 {
    display: none !important;
  }
  body.osce-v2-terminal-route .sidebar-nav-link {
    justify-content: center !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }
}

@media (max-width: 720px) {
  body.osce-v2-terminal-route .sidebar,
  body.osce-v2-terminal-route #sidebar { display: none !important; }
  body.osce-v2-terminal-route #mainContent,
  body.osce-v2-terminal-route .main-content { margin-left: 0 !important; }
  .osce-v2-attempt-result-view,
  .osce-v2-attempt-finalising-view { width: min(100% - 20px, 720px); padding-top: 18px; }
  .osce-v2-result-card { padding: 18px; border-radius: 18px; }
  .osce-v2-result-header { display: grid; }
  .osce-v2-result-summary { width: 100%; }
  .osce-v2-result-section-heading { align-items: flex-start; }
  .osce-v2-result-domain > header { display: grid; }
  .osce-v2-result-verdict { justify-self: start; }
  .osce-v2-result-actions { justify-content: stretch; }
  .osce-v2-result-button { flex: 1 1 100%; }
  .osce-v2-result-integrity { display: grid; }
}

.osce-v2-result-checklist {
  margin-top: 16px;
  border: 1px solid #e3e8f2;
  border-radius: 15px;
  background: #fff;
}
.osce-v2-result-checklist summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 18px;
  color: #344054;
  font-size: 13px;
  font-weight: 750;
}
.osce-v2-result-checklist summary::-webkit-details-marker { display: none; }
.osce-v2-result-checklist summary::after {
  content: '+';
  float: right;
  color: #6266d7;
  font-size: 18px;
  line-height: 1;
}
.osce-v2-result-checklist[open] summary::after { content: '–'; }
.osce-v2-result-checklist > div {
  max-height: 440px;
  overflow: auto;
  padding: 0 18px 18px;
  border-top: 1px solid #edf0f5;
  color: #536076;
  font-size: 13px;
  line-height: 1.65;
}

/* R41 authoritative completed-attempt and transcript surfaces */
.osce-v2-attempt-transcript-view{min-height:100%;padding:28px;background:#f8fafc;color:#0f172a;overflow:auto}.osce-v2-transcript-card{max-width:1120px;margin:0 auto}.osce-v2-transcript-conversation{padding:20px 0}.osce-v2-transcript-turn{margin:12px 0;padding:14px 16px;border-left:4px solid #94a3b8;border-radius:10px;background:#f8fafc}.osce-v2-transcript-turn.user,.osce-v2-transcript-turn.candidate,.osce-v2-transcript-turn.student{border-left-color:#4f46e5;background:#eef2ff}.osce-v2-transcript-turn h3{margin:0 0 6px;color:#64748b;font-size:12px;text-transform:uppercase;letter-spacing:.08em}.osce-v2-transcript-turn p{margin:0;line-height:1.55}.osce-v2-result-integrity.verified{border-color:#86efac;background:#f0fdf4;color:#166534}.osce-v2-result-checklist-summary{display:flex;align-items:center;gap:14px;margin:18px 0;padding:15px;border:1px solid #e2e8f0;border-radius:14px;background:#f8fafc}.osce-v2-result-checklist-summary strong{font-size:22px}.osce-v2-result-checklist-summary span{color:#64748b}.osce-v2-result-button[type="button"]{font:inherit;cursor:pointer}@media(max-width:640px){.osce-v2-attempt-transcript-view{padding:12px}.osce-v2-result-checklist-summary{align-items:flex-start;flex-direction:column}}
