/* ===========================================
   Crisp Chat Widget — Prevent Full-Screen
   Keep as bottom-right popup on desktop/laptop
   ===========================================
   Crisp's full-view mode does TWO things:
   1. Sets data-full-view="true" on chatbox container
   2. Adds a hashed class (e.g. cc-1ge4k) to <html>
      that collapses page to width:0/height:0

   LAYER 1 prevents the html/body collapse.
   LAYER 2 constrains the chatbox to a popup.
   =========================================== */

@media screen and (min-width: 768px) {
  /* LAYER 1: Prevent html/body collapse (the actual root cause)
     min-width/min-height always win over width/height when larger,
     so this overrides Crisp's "width: 0 !important" collapse.
     :has(#crisp-chatbox) gives ID-level specificity (0-1-0-1)
     which beats Crisp's class-level specificity (0-0-1-1). */
  html:has(#crisp-chatbox),
  html:has(#crisp-chatbox) > body {
    min-width: 100vw !important;
    min-height: 100vh !important;
    overflow: visible !important;
    overflow-y: auto !important;
  }

  /* LAYER 2: Keep Crisp at a reasonable z-index layer */
  #crisp-chatbox {
    z-index: 100000 !important;
  }

  /* Override full-view container — prevent full-viewport takeover */
  #crisp-chatbox [data-full-view="true"] {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 450px !important;
    max-height: 700px !important;
    background: transparent !important;
  }

  /* Prevent full-screen backdrop overlay */
  #crisp-chatbox [data-full-view="true"]::before {
    display: none !important;
  }
}
