/* Karim Academy | Chat space V9 — applied after all previous theme styles.
   Keep the composer visible while giving the conversation history real room. */
.app .social-community .social-rooms-layout:has(.social-chat) {
  min-height: 830px !important;
  background: #f6f7fc;
}
.app .social-community .social-chat {
  box-sizing: border-box;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: clamp(830px, calc(100dvh - 85px), 1200px) !important;
  min-height: 830px !important;
  max-height: none !important;
  min-width: 0;
  overflow: hidden !important;
}
.app .social-community .social-chat .social-chat-head,
.app .social-community .social-chat .social-room-description {
  flex: 0 0 auto !important;
}
.app .social-community .social-chat .social-chat-messages {
  flex: 1 1 0 !important;
  min-height: 365px !important;
  max-height: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  padding: 24px 22px !important;
}
.app .social-community .social-chat .social-chat-bottom {
  flex: 0 0 auto !important;
  position: relative;
  z-index: 2;
}
/* A discoverable fullscreen control for smaller screens and long discussions. */
.app .social-community .social-chat .kf-chat-size-toggle {
  margin-inline-start: auto;
  display: inline-flex !important;
  gap: 6px;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 9px 11px;
  border: 1.5px solid #cbcfe9;
  border-radius: 12px;
  color: #4435ac;
  background: #f4f1ff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease;
}
.app .social-community .social-chat .kf-chat-size-toggle:hover {
  background: #e8e2ff;
  border-color: #a8a0e8;
}
.app .social-community .social-chat .kf-chat-size-toggle svg {
  display: block;
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex: 0 0 auto;
}
/* A chat window that can truly use the whole viewport, including on mobile. */
body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
}
body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-messages {
  flex: 1 1 0 !important;
  min-height: 0 !important;
}
body.kf-chat-fullscreen-open {
  overflow: hidden !important;
}
body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-bottom {
  padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
}
@media (max-width: 850px) {
  .app .social-community .social-chat {height: max(760px, calc(100dvh - 100px)) !important;min-height:760px !important;}
  .app .social-community .social-rooms-layout:has(.social-chat) {min-height: 760px !important;}
  .app .social-community .social-chat .social-chat-messages {min-height: 325px !important;padding: 19px 15px !important;}
}
@media (max-width: 620px) {
  .app .social-community .social-rooms-layout:has(.social-chat) {
    min-height: 730px !important;
  }
  .app .social-community .social-chat {
    height: max(730px, calc(100dvh - 120px)) !important;
    min-height: 730px !important;
  }
  .app .social-community .social-chat .social-chat-messages {
    min-height: 315px !important;
    padding: 16px 11px !important;
  }
  .app .social-community .social-chat .kf-chat-size-toggle {
    padding: 9px;
    min-width: 41px;
    min-height: 41px;
  }
  .app .social-community .social-chat .kf-chat-size-toggle span {display:none;}
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized {
    height: 100dvh !important;
    min-height: 0 !important;
  }
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-messages {
    min-height: 0 !important;
  }
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-head {
    padding-block: 10px !important;
  }
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-room-description {
    max-height: 48px;
    overflow: auto;
  }
}
@media (max-height: 590px) {
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-head {
    padding-block: 6px !important;
    min-height: 58px !important;
  }
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-bottom {
    padding-block: 8px !important;
  }
  body.kf-chat-fullscreen-open .app .social-community .social-chat.kf-chat-maximized .social-chat-compose textarea {
    height: 58px !important;
    min-height: 58px !important;
  }
}
