/**
 * Shared layout for rule-driven chat widgets (page chat + career counsellor).
 * Body classes are set in topteens.context_processor.globals → chatbot_widget_body_class.
 *
 * Position matrix (admin Chatbot Rules):
 *   Ask AI left + Career right  → (no extra classes; defaults)
 *   Ask AI right + Career right → cb-page-chat-right cb-bots-stack
 *   Ask AI left + Career left   → cb-ai-pos-left cb-bots-stack
 *   Ask AI right + Career left  → cb-page-chat-right cb-ai-pos-left
 */

/* ---- Ask AI on the right (admin rule: position = Right) ---- */
body.cb-page-chat-right #pc-fab {
  left: auto !important;
  right: 28px !important;
}

body.cb-page-chat-right #pc-win {
  left: auto !important;
  right: 28px !important;
  transform-origin: bottom right !important;
}

@media (max-width: 768px) {
  body.cb-page-chat-right #pc-fab {
    right: 18px !important;
    left: auto !important;
  }

  body.cb-page-chat-right #pc-win {
    right: 18px !important;
    left: auto !important;
    transform-origin: bottom right !important;
  }
}

/* ---- Same-side stack: Career Counsellor above Ask AI ---- */
body.cb-bots-stack #pc-fab {
  bottom: 28px !important;
}

body.cb-bots-stack #pc-win {
  bottom: 92px !important;
}

body.cb-bots-stack.cb-page-chat-right #pc-fab {
  left: auto !important;
  right: 28px !important;
}

body.cb-bots-stack.cb-page-chat-right #pc-win {
  left: auto !important;
  right: 28px !important;
  transform-origin: bottom right !important;
}

@media (max-width: 768px) {
  body.cb-bots-stack.cb-page-chat-right #pc-fab {
    right: 18px !important;
    left: auto !important;
  }

  body.cb-bots-stack.cb-page-chat-right #pc-win {
    right: 18px !important;
    left: auto !important;
  }
}

/* Standalone report pages with a fixed bottom action bar (Download PDF / Back) */
body.cb-standalone-report-page #pc-fab {
  bottom: 88px !important;
}

body.cb-standalone-report-page #pc-win {
  bottom: 152px !important;
}

body.cb-standalone-report-page #cb-fab-wrap {
  bottom: 88px !important;
}

body.cb-standalone-report-page #cb-window {
  bottom: 168px !important;
}

body.cb-standalone-report-page.cb-bots-stack #cb-fab-wrap {
  bottom: 160px !important;
}

body.cb-standalone-report-page.cb-bots-stack #cb-window {
  bottom: 248px !important;
}

@media (max-width: 480px) {
  body.cb-standalone-report-page #pc-fab {
    bottom: 78px !important;
  }

  body.cb-standalone-report-page #pc-win {
    bottom: 142px !important;
  }

  body.cb-standalone-report-page #cb-fab-wrap {
    bottom: 78px !important;
  }

  body.cb-standalone-report-page #cb-window {
    bottom: 158px !important;
  }

  body.cb-standalone-report-page.cb-bots-stack #cb-fab-wrap {
    bottom: 150px !important;
  }

  body.cb-standalone-report-page.cb-bots-stack #cb-window {
    bottom: 230px !important;
  }
}

/* Skill Lab course learning: keep bots above page chrome */
body.skilllab-course-learning-page #pc-root,
body.skilllab-course-learning-page #cb-root {
  z-index: 2147483000;
}

body.skilllab-course-learning-page #pc-fab,
body.skilllab-course-learning-page #pc-win {
  z-index: 2147483001;
}

body.skilllab-course-learning-page #cb-fab-wrap,
body.skilllab-course-learning-page #cb-window {
  z-index: 2147483002;
}
