/**
 * MEA Workshop Wizard — floating bottom-right widget.
 *
 * Owns the bottom-right slot on pages where the wizard is active
 * (workshop singulars, selected online programs, pages containing the
 * [mea_wizard] shortcode). On those pages, the MEA Companion launcher
 * is suppressed server-side so the wizard is the only chat presence.
 *
 * Distinct visual identity from the Companion: warm gold launcher dot,
 * gold accent on the workshop/program badge contrast, so the visitor
 * can tell at a glance this is the workshop-matcher, not the general
 * chat companion. Panel chrome stays neutral so the conversation reads
 * the same way as the rest of MEA's content.
 *
 * All rules namespaced under .mea-wizard / .mea-wizard__*.
 */

.mea-wizard.mea-wizard--float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147482900; /* one below the Companion's z-index so the
	                       Companion always wins if both ever appear
	                       (shouldn't happen, defense in depth) */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: #1f2937;
  margin: 0;
  max-width: none;
}

/* Inline mode — rendered at the [mea_wizard] shortcode's own position in
   the content, not as a corner bubble. Starts as a bare text box; the
   conversation appears above it once the visitor sends something. Sizes
   run a touch larger than the floating panel because this sits in the
   page's reading column rather than a 380px corner widget. */
.mea-wizard.mea-wizard--inline {
  position: static;
  display: block;
  width: 100%;
  /* margin: 24px 0; */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1f2937;
}

.mea-wizard__inline {
  display: flex;
  flex-direction: column;
  /* border: 1px solid #e8e2cd; */
  border-radius: 14px;
  /* padding: 14px;
  background: transparent; */
  color: #fcfaed;
}

.mea-wizard *,
.mea-wizard *::before,
.mea-wizard *::after {
  box-sizing: border-box;
}

/* Launcher (collapsed state) */
.mea-wizard__launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: #d96f50;
  color: #fff;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.mea-wizard__launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}
.mea-wizard__launcher:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}
.mea-wizard__launcher-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #37473c; /* forest, matches the panel header */
}

/* Panel (expanded state) */
.mea-wizard__panel {
  display: flex;
  flex-direction: column;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 580px;
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.mea-wizard__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #37473c;
  color: #fff;
  border-bottom: 4px solid #f8c05a;
}
.mea-wizard__title-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mea-wizard__title-wrap strong {
  font-size: 14px;
  font-weight: 600;
}
.mea-wizard__title-wrap span {
  font-size: 12px;
  opacity: 0.78;
  margin-top: 1px;
}
.mea-wizard__header-btn {
  background: transparent;
  color: #fff;
  border: 0;
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.8;
}
.mea-wizard__header-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}
.mea-wizard__header-close {
  font-size: 20px;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Conversation scroll area */
.mea-wizard__conversation {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  background: #fcfaed;
}

.mea-wizard__msg {
  display: flex;
  margin-bottom: 10px;
}
.mea-wizard__msg--user {
  justify-content: flex-end;
}
.mea-wizard__bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mea-wizard__msg--assistant .mea-wizard__bubble {
  padding: 0;
}
.mea-wizard__msg--user .mea-wizard__bubble {
  background: #5cb3a6;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.mea-wizard__msg--thinking .mea-wizard__bubble {
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
  color: #6b7280;
  font-style: italic;
}
.mea-wizard__msg--error .mea-wizard__bubble {
  padding: 10px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-bottom-left-radius: 4px;
  color: #991b1b;
}

/* Auto-linkified URLs inside bot replies */
.mea-wizard__link {
  color: #1d4ed8;
  text-decoration: underline;
  word-break: break-all; /* long URLs wrap inside the bubble cleanly */
}
.mea-wizard__link:hover {
  color: #1e40af;
}
.mea-wizard__msg--user .mea-wizard__link {
  color: #f8c05a; /* gold against the teal user bubble */
}

/* Special CTA button-style link (workshop wizard handoff, enrollment URL,
   admissions Book-a-Call). Overrides the plain link styles above. */
.mea-wizard__cta-button {
  display: inline-block;
  margin-top: 6px;
  padding: 8px 14px;
  background: #d96f50;
  color: #ffffff !important;
  font-weight: 600;
  text-decoration: none !important;
  border-radius: 999px;
  letter-spacing: 0.01em;
  word-break: normal;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
.mea-wizard__cta-button:hover {
  transform: translateY(-1px);
  background: #c75c3e;
  box-shadow: 0 6px 18px rgba(217, 111, 80, 0.28);
  color: #ffffff !important;
}

/* Recommendation cards */
.mea-wizard__recs-wrap {
  margin-top: 10px;
}
.mea-wizard__recs-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 6px;
}
.mea-wizard__recs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mea-wizard__card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: #fffef8;
  border: 1px solid #f6f2e2;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.mea-wizard__card:hover {
  transform: translateY(-1px);
  background: #f6f2e2;
  text-decoration: none;
}
.mea-wizard__card:focus-visible {
  outline: 2px solid #1f2937;
  outline-offset: 2px;
}
.mea-wizard__card-thumb {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  background: #f3f4f6;
  overflow: hidden;
  position: relative;
}
.mea-wizard__card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mea-wizard__card-thumb--fallback::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #e5e7eb 0%, #f3f4f6 100%);
}
.mea-wizard__card-body {
  flex: 1;
  min-width: 0; /* allow the clamped text inside to truncate */
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mea-wizard__badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
}
.mea-wizard__card--workshop .mea-wizard__badge {
  background: #1f2937;
  color: #ffffff;
}
.mea-wizard__card--program .mea-wizard__badge {
  background: #fbbf24;
  color: #111827;
}
.mea-wizard__card-title {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mea-wizard__card-desc {
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Input */
.mea-wizard__form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}
.mea-wizard__input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  color: inherit;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.4;
}
.mea-wizard__input:focus {
  outline: 2px solid #1f2937;
  outline-offset: -1px;
  border-color: transparent;
}
.mea-wizard__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  background: #d96f50;
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  font: inherit;
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  font-family: "EB Garamond";
}

.mea-wizard__send svg {
  display: block;
}
.mea-wizard__send[disabled] {
  background: #c9b39a;
  cursor: not-allowed;
}

/* ---- Inline-mode overrides for the shared conversation + form ---- */

/* The floating panel's conversation flexes to fill a fixed-height panel.
   Inline has no fixed height, so it grows with content up to a cap and
   scrolls past that — otherwise a long chat would push the rest of the
   page down indefinitely. */
.mea-wizard--inline .mea-wizard__conversation {
  flex: none;
  max-height: 440px;
  overflow-y: auto;
  background: transparent;
  padding: 14px;
  border: 1px solid #68534d;
  margin-bottom: 20px;
  border-radius: 20px;
}

.mea-wizard--inline .mea-wizard__conversation--empty {
  display: none;
}

.mea-wizard--inline .mea-wizard__form {
  padding: 0;
  border-top: 0;
  background: transparent;
  display: inline-block;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}

.mea-wizard--inline .mea-wizard__input {
  background: #3c3633;
  min-height: 46px;
  border-color: #7b7570;
  padding: 20px;
}

.mea-wizard__send--inline {
  font-size: 20px;
  padding: 10px 40px;
  min-height: 46px;
  letter-spacing: 0.01em;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
  display: block;
  margin: 10px auto 0;
  border-radius: 100px;
}

.mea-wizard__send--inline:hover:not([disabled]) {
  background: #c75c3e;
  transform: translateY(-1px);
}

.mea-wizard__inline .mea-wizard__msg--user .mea-wizard__bubble {
  background: #87432f;
}

/* "Start over", revealed only once a conversation exists */
.mea-wizard__inline-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.mea-wizard__inline-reset {
  background: transparent;
  border: 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 12px;
  color: #d96f50;
  text-decoration: underline;
  cursor: pointer;
}

.mea-wizard__inline-reset:hover {
  color: #fcfaed;
}

@media (max-width: 480px) {
  .mea-wizard--inline .mea-wizard__form {
    flex-direction: column;
    align-items: stretch;
  }
  .mea-wizard__send--inline {
    padding: 12px 22px;
  }
}
