/* CME Content Helper — page-specific styles.
   Shared: base.css (reset/body/focus/keyframes/print),
           components.css (.header-stripe/.header-main/.header-title/.header-badge,
           .card/.card-tight, .spinner, tooltip .tip-*, .error-box).
   Palette: tokens.css. */

/* LAYOUT */
.app-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.main-layout {
  display: flex;
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 16px;
  gap: 20px;
}
.input-panel {
  width: 35%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.output-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 820px) {
  .main-layout {
    flex-direction: column;
    padding: 12px;
  }
  .input-panel {
    width: 100%;
  }
}

/* CARD overflow — tooltips need to escape the card box */
.card {
  overflow: visible;
}

/* INPUTS */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.field-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.field-textarea {
  width: 100%;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s;
  line-height: 1.5;
}
.field-textarea:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--arboretum-blue);
  box-shadow: 0 0 0 3px rgba(47, 101, 167, 0.1);
}
.field-textarea::placeholder {
  color: var(--text-muted);
}

/* REQUIRED BADGE */
.req-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--michigan-maize);
  color: var(--michigan-blue);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

/* CHECK TILES — audience professions and physician specialties */
.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 4px;
}
.check-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
  user-select: none;
  min-height: 44px;
}
.check-tile:hover {
  border-color: var(--border-mid);
  background: var(--bg-blue-tint);
}
.check-tile.checked {
  border-color: var(--arboretum-blue);
  border-top: 2.5px solid var(--michigan-maize);
  background: var(--bg-blue-tint);
  color: var(--arboretum-blue);
}
.check-tile input {
  accent-color: var(--arboretum-blue);
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  pointer-events: none;
}

/* FORMAT CHIPS */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: 1.5px solid var(--border-light);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
  user-select: none;
}
.chip:hover {
  border-color: var(--border-mid);
  background: var(--bg-blue-tint);
}
.chip.checked {
  border-color: var(--arboretum-blue);
  border-bottom: 2.5px solid var(--michigan-maize);
  background: var(--bg-blue-tint);
  color: var(--arboretum-blue);
}
.chip input {
  accent-color: var(--arboretum-blue);
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  pointer-events: none;
}
.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
  user-select: none;
  flex: 1;
  justify-content: center;
}
.radio-chip:hover {
  border-color: var(--border-mid);
  background: var(--bg-blue-tint);
}
.radio-chip.checked {
  border-color: var(--arboretum-blue);
  background: var(--arboretum-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(47, 101, 167, 0.25);
}
/* Focus ring on the label (input is visually hidden) */
.radio-chip:focus-within {
  outline: 3px solid var(--michigan-maize);
  outline-offset: 2px;
}
.radio-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* SECTION DIVIDER inside input card */
.input-divider {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 0 2px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}

/* BUTTONS — this page keeps its own button class names (markup unchanged);
   they use the shared tokens for colour so branding stays centralized. */
.btn-generate {
  width: 100%;
  padding: 14px;
  background: var(--michigan-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(0, 39, 76, 0.3);
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-generate:hover:not(:disabled) {
  background: var(--blue-hover);
  transform: translateY(-1px);
}
.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
@keyframes btnReady {
  0%,
  100% {
    box-shadow: 0 4px 14px rgba(0, 39, 76, 0.3);
  }
  50% {
    box-shadow:
      0 4px 28px rgba(0, 39, 76, 0.55),
      0 0 0 6px rgba(47, 101, 167, 0.15);
  }
}
.btn-generate.ready {
  animation: btnReady 1.4s ease-in-out 3;
}
.btn-regen {
  padding: 9px 16px;
  background: #fff;
  color: var(--arboretum-blue);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
}
.btn-regen:hover {
  background: var(--bg-blue-tint);
  border-color: var(--arboretum-blue);
}
.btn-print {
  padding: 9px 18px;
  background: var(--michigan-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-print:hover {
  background: var(--blue-hover);
}
.btn-copy-all {
  padding: 9px 16px;
  background: #fff;
  color: var(--arboretum-blue);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.btn-copy-all:hover {
  background: var(--bg-blue-tint);
}
.btn-copy-all.copied {
  background: var(--pass-bg);
  border-color: var(--pass-border);
  color: var(--pass-fg);
}
.action-bar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 6px;
}

/* EMPTY / LOADING */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 48px;
  opacity: 0.35;
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
}
.empty-sub {
  font-size: 13px;
  max-width: 300px;
  line-height: 1.5;
}
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 10px;
}
.loading-state .spinner {
  margin-bottom: 4px;
}
.loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 1.4em;
  transition: opacity 0.3s;
}
.loading-progress-wrap {
  width: 100%;
  max-width: 280px;
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}
.loading-progress-bar {
  height: 100%;
  background: var(--arboretum-blue);
  border-radius: 2px;
  width: 0%;
  transition: width 1s ease-out;
}
.loading-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* OUTPUT SECTIONS */
.out-section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--michigan-blue);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 7px;
  border-bottom: 2.5px solid var(--michigan-maize);
  margin-bottom: 5px;
}
.out-section-accme {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  font-style: italic;
}
.section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 4px;
}
.cloudcme-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  display: block;
  margin-bottom: 12px;
}

/* REASONING BOX */
.reasoning-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-blue-tint-2);
  border: 1.5px solid #c8d8ea;
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 12px;
}

/* OPTION PILLS */
.option-pills {
  display: flex;
  gap: 7px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.option-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border-mid);
  background: #fff;
  color: var(--text-secondary);
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
  cursor: pointer;
}
.option-pill.active {
  background: var(--arboretum-blue);
  border-color: var(--arboretum-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(47, 101, 167, 0.25);
  border-bottom: 3px solid var(--michigan-maize);
}

/* EDITABLES */
.editable-area {
  width: 100%;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  line-height: 1.6;
  transition: border-color 0.15s;
  min-height: 80px;
}
.editable-area:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--arboretum-blue);
  box-shadow: 0 0 0 3px rgba(47, 101, 167, 0.08);
}
.editable-area.tall {
  min-height: 110px;
}

/* NEED BLOCKS */
.need-block {
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
}
.need-header {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.need-body {
  padding: 11px 13px;
}

/* OBJECTIVES */
.obj-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.obj-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.obj-check {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 4px;
  accent-color: var(--arboretum-blue);
  cursor: pointer;
}
.obj-text {
  flex: 1;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: #fff;
  line-height: 1.5;
  min-height: 44px;
  transition: border-color 0.15s;
}
.obj-text:focus:not(:focus-visible) {
  outline: none;
  border-color: var(--arboretum-blue);
  box-shadow: 0 0 0 3px rgba(47, 101, 167, 0.08);
}
.obj-row.dimmed .obj-text {
  opacity: 0.38;
  text-decoration: line-through;
}

/* COMPETENCY CHIPS */
.comp-section {
  margin-bottom: 12px;
}
.comp-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.comp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.comp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1.5px solid;
  background: #f8f9fb;
}

/* ELIGIBILITY PANEL */
.elig-panel {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow:
    0 1px 3px rgba(0, 39, 76, 0.06),
    0 2px 8px rgba(0, 39, 76, 0.04);
  border-top: 4px solid var(--michigan-maize);
}
.elig-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
}
.elig-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.elig-body {
  padding: 12px 14px;
}
.elig-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  margin-left: auto;
  white-space: nowrap;
}
.elig-steps ol {
  margin: 0 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.elig-steps li {
  font-size: 13px;
  color: var(--blue-hover);
  line-height: 1.55;
}
.elig-note {
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  background: var(--bg-blue-tint);
  border-left: 3px solid var(--arboretum-blue);
  border-radius: 0 6px 6px 0;
  padding: 7px 11px;
  margin-top: 8px;
  line-height: 1.5;
}

/* COPY BUTTON */
.copy-wrap {
  position: relative;
  display: block;
}
.copy-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.15s,
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
  z-index: 2;
  backdrop-filter: blur(2px);
}
.copy-wrap:hover .copy-btn,
.copy-wrap:focus-within .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}
.copy-btn:hover {
  background: #fff;
  border-color: var(--arboretum-blue);
  color: var(--arboretum-blue);
}
.copy-btn.copied {
  opacity: 1;
  background: var(--pass-bg);
  border-color: var(--pass-border);
  color: var(--pass-fg);
}
.copy-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}
#copy-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-dark);
  color: var(--surface-dark-text);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}
#copy-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* VALIDATION ERROR inline — replaces alert() */
.validation-error {
  background: var(--error-bg);
  border: 1.5px solid var(--error-border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  color: var(--error-fg);
  font-weight: 600;
  line-height: 1.5;
  display: none;
}
.validation-error.show {
  display: block;
}
