/*
 * InventyHub v6.7.1 PWA SAFE
 * CHAT COMPOSER LAYOUT FIX ONLY
 *
 * Baseline app-v6.6.0.js is NOT modified.
 * This changes only how the existing chat elements are laid out.
 */

/* The right conversation panel must have a definite, clipped working area. */
.chat-conversation-panel{
  height:100%;
  min-height:0;
  overflow:hidden;
}

/*
 * Flex column is safer than the previous fixed grid rows because:
 * - Technician has: header + quick actions + messages + composer.
 * - User has: header + messages + composer.
 * The same layout now works for both without changing JavaScript.
 */
.chat-conversation{
  height:100%;
  min-height:0;
  overflow:hidden;
  display:flex !important;
  flex-direction:column;
}

/* Fixed-height sections never get pushed out of the panel. */
.chat-conversation-head,
.chat-quick-actions,
.chat-composer{
  flex:0 0 auto;
}

/* Only the message history expands and scrolls. */
.chat-messages{
  flex:1 1 auto;
  min-height:0 !important;
  height:auto !important;
  overflow-y:auto !important;
  overscroll-behavior:contain;
}

/* Composer is always visible at the bottom. */
.chat-composer{
  position:relative;
  z-index:5;
  width:100%;
  min-height:70px;
  background:#fff;
  border-top:1px solid var(--line);
  box-shadow:0 -6px 18px rgba(30,20,20,.035);
}

/* Make the typing field visually obvious. */
.chat-composer textarea{
  min-height:48px !important;
}

/* Prevent a long transaction selector from stretching the composer. */
.chat-composer select,
.chat-composer textarea,
.chat-composer button{
  min-width:0;
}

/* Mobile/PWA standalone protection. */
@media(max-width:700px){
  .chat-conversation-panel{
    min-height:620px;
  }
  .chat-conversation{
    min-height:620px;
  }
}

@media(max-width:440px){
  .chat-conversation-panel,
  .chat-conversation{
    min-height:640px;
  }
}
