
/* SIMSAR_AI_COMPACT_CHAT_V113 */

@media screen and (max-width: 767px) {

  /* Compact floating assistant instead of full screen */
  html body #sm-ai-v2-panel,
  html body #sm-ai-v2-panel[data-open="true"] {
    position: fixed !important;
    inset: auto 10px
      calc(82px + env(safe-area-inset-bottom, 0px))
      10px !important;
    top: auto !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px))
      !important;

    width: auto !important;
    max-width: 430px !important;
    height: 62dvh !important;
    max-height: calc(
      100dvh - 115px - env(safe-area-inset-bottom, 0px)
    ) !important;
    min-height: 0 !important;

    margin: 0 auto !important;
    transform: none !important;

    border-radius: 18px !important;
    border: 1px solid rgba(225, 231, 238, .95) !important;
    background: #fff !important;
    box-shadow: 0 12px 36px rgba(15, 23, 42, .22)
      !important;

    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 2147483003 !important;
  }

  html body #sm-ai-v2-panel:not([data-open="true"]) {
    display: none !important;
  }

  html body #sm-ai-v2-panel[data-open="true"] {
    display: flex !important;
  }

  /* Compact header */
  html body #sm-ai-v2-head {
    flex: 0 0 auto !important;
    min-height: 52px !important;
    padding: 8px 12px !important;
    gap: 8px !important;
  }

  html body #sm-ai-v2-head .sm-ai-v2-avatar {
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
    font-size: 20px !important;
  }

  html body #sm-ai-v2-head strong {
    font-size: 14px !important;
  }

  html body #sm-ai-v2-head .sm-ai-v2-titles span {
    font-size: 10px !important;
  }

  /* Internal message scrolling */
  html body #sm-ai-v2-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 11px !important;
    gap: 9px !important;
    overscroll-behavior: contain;
  }

  html body #sm-ai-v2-panel .sm-ai-v2-message {
    max-width: 96% !important;
    padding: 9px 11px !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
  }

  /* Smaller suggestions section */
  html body #sm-ai-v2-tips {
    flex: 0 0 auto !important;
    max-height: 76px !important;
    overflow-y: auto !important;
    padding: 7px 9px !important;
    gap: 5px !important;
  }

  html body #sm-ai-v2-tips .sm-ai-v2-chip {
    padding: 5px 8px !important;
    font-size: 10px !important;
  }

  /* Input stays visible at bottom */
  html body #sm-ai-v2-form {
    flex: 0 0 auto !important;
    padding: 8px 9px !important;
    gap: 7px !important;
    background: #fff !important;
  }

  html body #sm-ai-v2-input {
    height: 42px !important;
    min-height: 42px !important;
    font-size: 14px !important;
    min-width: 0 !important;
  }

  html body #sm-ai-v2-send {
    height: 42px !important;
    min-height: 42px !important;
    min-width: 58px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }

  /* Hide the AI floating button while chat is open */
  html body:has(#sm-ai-v2-panel[data-open="true"])
  #simsarAiIconV112,
  html body:has(#sm-ai-v2-panel[data-open="true"])
  #sm-ai-v2-launch,
  html body:has(#sm-ai-v2-panel[data-open="true"])
  .simsar-ai-map-dock-v11 {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* Extra compact layout on shorter phones */
@media screen and (max-width: 767px) and (max-height: 650px) {
  html body #sm-ai-v2-panel {
    height: 58dvh !important;
    bottom: 68px !important;
    max-height: calc(100dvh - 95px) !important;
  }
}
