/* ================================================================
   LEGACY ELEMENT VISUAL UPGRADES
   Modern styles for legacy wrapper elements. Applied via CSS override
   to all existing content without markup changes.
   ================================================================ */

/* --- Objective Header: Dark header bar + clean body --- */
.objective-header {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-left: none !important;
  border-radius: 10px !important;
  padding: 0 !important;
  margin: 0 auto 32px !important;
  overflow: hidden;
  position: relative;
  max-width: 820px;
}
.objective-header .obj-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  margin: 0 !important;
  background: #0F2B3C;
  color: #e2e8f0 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.8px !important;
}
.objective-header .obj-label::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: rgba(255,255,255,0.12);
  border-radius: 4px;
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='4' fill='rgba(255,255,255,0.15)'/%3E%3Cpath d='M5 9l3 3 5-5' stroke='%23E86A2A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  flex-shrink: 0;
}
.objective-header .obj-problem {
  padding: 12px 16px 8px !important;
  margin: 0 !important;
  font-size: 14px !important;
  color: #334155 !important;
  line-height: 1.65 !important;
}
.objective-header .obj-deliverable {
  margin: 0 12px 8px !important;
  padding: 10px 14px !important;
  background: #f1f5f9 !important;
  border-radius: 6px !important;
  border-left: 3px solid #E86A2A !important;
  font-size: 13px !important;
  color: #334155 !important;
}
.objective-header .obj-deliverable strong {
  color: #E86A2A !important;
}
.objective-header .obj-time {
  padding: 0 16px 12px !important;
  margin: 0 !important;
  font-size: 12px !important;
  color: #64748b !important;
}

/* --- Compliance Myth: Split myth/reality with visual distinction --- */
.compliance-myth {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 0 !important;
  margin: 24px auto !important;
  overflow: hidden;
  max-width: 820px;
}
.compliance-myth::before {
  content: none !important;
}
.compliance-myth .myth-header,
.compliance-myth .myth-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  margin: 0 !important;
  background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%) !important;
  color: #fecaca !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
  text-transform: uppercase;
  border-bottom: none !important;
}
.compliance-myth .myth-header::before,
.compliance-myth .myth-label::before {
  content: '⚠';
  font-size: 14px;
}
.compliance-myth .myth-body,
.compliance-myth .myth-text {
  padding: 14px 16px !important;
  font-size: 14px !important;
  color: #334155 !important;
  line-height: 1.7 !important;
}
.compliance-myth .myth-body p,
.compliance-myth .myth-text p {
  margin: 0 0 8px !important;
  color: #334155 !important;
}
.compliance-myth .myth-body p:last-child,
.compliance-myth .myth-text p:last-child {
  margin-bottom: 0 !important;
}
.compliance-myth .myth-reality {
  color: #059669 !important;
  font-weight: 600;
}

/* --- CP Block (Decision Point): Amber accent card --- */
.cp-block {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 0 !important;
  margin: 24px auto !important;
  overflow: hidden;
  max-width: 820px;
}
.cp-block .cp-header {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  margin: 0 !important;
  background: linear-gradient(135deg, #78350f 0%, #92400e 100%) !important;
  color: #fde68a !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase;
}
.cp-block .cp-header::before {
  content: '◆';
  font-size: 10px;
}
.cp-block .cp-body {
  padding: 14px 16px !important;
  border-left: 3px solid #d97706;
  margin-left: 0;
  font-size: 14px !important;
  color: #334155 !important;
  line-height: 1.7 !important;
}
.cp-block .cp-body p {
  color: #334155 !important;
}

/* --- Artifact Footer: Clean completion card --- */
.artifact-footer {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 0 !important;
  margin: 32px auto 24px !important;
  overflow: hidden;
  max-width: 820px;
}
.artifact-footer .artifact-header {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  background: #0F2B3C !important;
  color: #e2e8f0 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  letter-spacing: 0.8px !important;
  text-transform: uppercase;
}
.artifact-footer .artifact-header::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: rgba(5,150,105,0.3);
  border-radius: 4px;
  font-size: 11px;
  color: #86efac;
}
.artifact-footer .artifact-body {
  padding: 14px 16px !important;
  font-size: 14px !important;
  color: #334155 !important;
  line-height: 1.7 !important;
}
.artifact-footer .artifact-body p,
.artifact-footer .artifact-body blockquote {
  color: #334155 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  font-style: normal !important;
}

/* --- Details/Context Expand: Modern expandable --- */
details.context-expand,
.module-content details {
  background: #f5f3ed !important;
  border: 1px solid #d4cbbe !important;
  border-radius: 8px !important;
  margin: 16px 0 !important;
  overflow: hidden;
}
details.context-expand summary,
.module-content details summary {
  padding: 12px 16px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #1a1612 !important;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s;
}
details.context-expand summary:hover,
.module-content details summary:hover {
  background: #e3dacc;
}
details.context-expand summary::before,
.module-content details summary::before {
  content: '▸';
  display: inline-block;
  font-size: 11px;
  color: #E86A2A;
  transition: transform 0.2s;
}
details[open].context-expand summary::before,
.module-content details[open] summary::before {
  transform: rotate(90deg);
}
/* Remove default marker */
details.context-expand summary::-webkit-details-marker,
.module-content details summary::-webkit-details-marker {
  display: none;
}
details.context-expand .context-body,
details.context-expand > *:not(summary),
.module-content details > *:not(summary) {
  padding: 4px 16px 16px !important;
  font-size: 14px;
  color: #334155;
  line-height: 1.7;
}

/* --- Legacy inline KC (with onclick handlers): basic visual cleanup --- */
.module-content .knowledge-check h3 {
  padding: 10px 16px !important;
  margin: 0 !important;
  background: #0F2B3C;
  color: #e2e8f0 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: 8px 8px 0 0;
}

/* --- Callout boxes: Unified styling for all legacy callout types --- */
.callout {
  border-radius: 8px !important;
  margin: 16px 0 !important;
  padding: 14px 16px !important;
  font-size: 14px !important;
  line-height: 1.7 !important;
}
/* When callouts escape module-content */
main > .callout {
  max-width: 820px;
  margin-left: auto !important;
  margin-right: auto !important;
}
.callout-key {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-left: 4px solid #2563eb !important;
}
.callout-remember {
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
  border-left: 4px solid #059669 !important;
}
.callout-warning {
  background: #fef7f3 !important;
  border: 1px solid #fed7c3 !important;
  border-left: 4px solid #E86A2A !important;
}
.callout-grc {
  background: #f0fdfa !important;
  border: 1px solid #99f6e4 !important;
  border-left: 4px solid #0891b2 !important;
}

/* --- KC engine: constrain when escaping module-content --- */
main > .kce-engine {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 48px;
}

/* --- Legacy inline KC: constrain when escaping module-content --- */
main > .knowledge-check {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 48px;
}

/* --- Dark mode overrides --- */
[data-theme="dark"] .objective-header { background: #112436 !important; border-color: #1a3348 !important; }
[data-theme="dark"] .objective-header .obj-problem,
[data-theme="dark"] .objective-header .obj-deliverable { color: #cbd5e1 !important; }
[data-theme="dark"] .objective-header .obj-deliverable { background: #0a1929 !important; }

[data-theme="dark"] .compliance-myth { background: #112436 !important; border-color: #1a3348 !important; }
[data-theme="dark"] .compliance-myth .myth-body p { color: #cbd5e1 !important; }

[data-theme="dark"] .cp-block { background: #112436 !important; border-color: #1a3348 !important; }
[data-theme="dark"] .cp-block .cp-body { color: #cbd5e1 !important; }

[data-theme="dark"] .artifact-footer { background: #112436 !important; border-color: #1a3348 !important; }
[data-theme="dark"] .artifact-footer .artifact-body p { color: #cbd5e1 !important; }

[data-theme="dark"] details.context-expand,
[data-theme="dark"] .module-content details {
  background: #0f2035 !important;
  border-color: #1a3348 !important;
}
[data-theme="dark"] details summary { color: #e2e8f0 !important; }
