/* TEMVIO v1.1.4 — Chat Composer & Keyboard Final Fix */

/* Composer itself */
.chat-compose textarea{
  min-height:76px !important;
  max-height:180px !important;
  line-height:1.75 !important;
  overflow-y:auto !important;
  white-space:pre-wrap !important;
  overflow-wrap:anywhere !important;
  resize:none !important;
  scroll-padding-block:18px;
}
.chat-bubble p{
  white-space:pre-wrap !important;
}

/*
  When the Android keyboard is open AND the chat textarea owns focus,
  temporarily turn the chat into a focused workspace fitted to VisualViewport.
  This avoids the 510px mobile min-height sitting underneath the IME.
*/
html.temvio-keyboard-open.temvio-chat-composing .bottom-nav,
html.temvio-keyboard-open.temvio-chat-composing .fab{
  display:none !important;
}

html.temvio-keyboard-open.temvio-chat-composing #appShell{
  padding-bottom:0 !important;
}

html.temvio-keyboard-open.temvio-chat-composing #appShell .topbar{
  display:none !important;
}

html.temvio-keyboard-open.temvio-chat-composing #appShell .main{
  padding:
    var(--temvio-inset-top-safe)
    max(8px,var(--temvio-inset-right-safe))
    0
    max(8px,var(--temvio-inset-left-safe)) !important;
  min-height:0 !important;
  height:var(--temvio-vv-height) !important;
  overflow:hidden !important;
}

html.temvio-keyboard-open.temvio-chat-composing .messages-layout{
  position:fixed !important;
  z-index:45;
  top:calc(var(--temvio-vv-top) + var(--temvio-inset-top-safe)) !important;
  right:max(6px,var(--temvio-inset-right-safe)) !important;
  bottom:auto !important;
  left:max(6px,var(--temvio-inset-left-safe)) !important;
  height:calc(var(--temvio-vv-height) - var(--temvio-inset-top-safe) - 4px) !important;
  min-height:0 !important;
  margin:0 !important;
  display:block !important;
  overflow:hidden !important;
}

html.temvio-keyboard-open.temvio-chat-composing .messages-layout .thread-list{
  display:none !important;
}

html.temvio-keyboard-open.temvio-chat-composing .chat-panel{
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) auto !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;
  overflow:hidden !important;
  border-radius:18px 18px 0 0 !important;
}

html.temvio-keyboard-open.temvio-chat-composing .chat-head{
  padding:10px 13px !important;
  min-height:54px;
}

html.temvio-keyboard-open.temvio-chat-composing .chat-messages{
  min-height:0 !important;
  overflow-y:auto !important;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:12px !important;
  scroll-padding-bottom:20px;
}

html.temvio-keyboard-open.temvio-chat-composing .chat-compose{
  position:relative !important;
  z-index:2;
  padding:8px !important;
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto !important;
  align-items:end !important;
  gap:7px !important;
  background:#fbfaf7 !important;
  padding-bottom:max(8px,var(--temvio-inset-bottom-safe)) !important;
}

html.temvio-keyboard-open.temvio-chat-composing .chat-compose textarea{
  min-height:72px !important;
  max-height:min(168px,36vh) !important;
}

html.temvio-keyboard-open.temvio-chat-composing .chat-compose .btn{
  width:auto !important;
  min-width:76px;
  height:48px;
  align-self:end;
}

@media(max-width:480px){
  html.temvio-keyboard-open.temvio-chat-composing .chat-compose{
    grid-template-columns:1fr !important;
  }
  html.temvio-keyboard-open.temvio-chat-composing .chat-compose .btn{
    width:100% !important;
    height:44px;
  }
  html.temvio-keyboard-open.temvio-chat-composing .chat-compose textarea{
    max-height:min(142px,31vh) !important;
  }
}
