/* Facelov FINAL FIX v1.0.6 — Messenger polish + safe YouTube composer layout */

/* ---------- Messenger: clean desktop card ---------- */
@media (min-width:769px){
  html body [data-messages-shell].fl-msg-shell{
    position:fixed!important;
    inset:auto 18px 16px auto!important;
    width:360px!important;
    height:min(510px,calc(100dvh - 96px))!important;
    max-width:calc(100vw - 36px)!important;
    max-height:calc(100dvh - 96px)!important;
    z-index:2147482000!important;
    pointer-events:none!important;
  }

  html body [data-messages-shell] .fl-msg-panel{
    width:100%!important;
    height:100%!important;
    border:1px solid #dfe3e8!important;
    border-radius:14px!important;
    background:#fff!important;
    box-shadow:0 12px 34px rgba(24,31,45,.20)!important;
    overflow:hidden!important;
    pointer-events:auto!important;
  }
}

html body [data-messages-shell] .fl-msg-head,
html body [data-messages-shell] .fl-msg-thread-head{
  min-height:58px!important;
  padding:9px 10px!important;
  border-bottom:1px solid #e8eaee!important;
  background:#fff!important;
}

html body [data-messages-shell] .fl-msg-head h2{
  font-size:20px!important;
  line-height:1.1!important;
  letter-spacing:-.35px!important;
}

html body [data-messages-shell] .fl-msg-head small,
html body [data-messages-shell] .fl-msg-thread-head small{
  color:#7a808a!important;
  font-size:10px!important;
}

html body [data-message-thread-view] .fl-msg-thread-head{
  display:flex!important;
  align-items:center!important;
  gap:6px!important;
}

html body [data-message-thread-view] .fl-msg-thread-person{
  flex:1 1 auto!important;
  min-width:0!important;
  gap:8px!important;
}

html body [data-message-thread-view] .fl-msg-thread-person .fl-msg-avatar{
  width:36px!important;
  height:36px!important;
  flex:0 0 36px!important;
}

html body [data-message-thread-view] .fl-msg-thread-person strong{
  font-size:12px!important;
  font-weight:700!important;
}

html body [data-message-thread-view] .fl-msg-thread-head>button,
html body [data-messages-shell] .fl-msg-head-actions button,
html body [data-messages-shell] .fl-msg-minimize,
html body [data-messages-shell] .fl-msg-thread-more-v292{
  width:32px!important;
  height:32px!important;
  min-width:32px!important;
  flex:0 0 32px!important;
  padding:0!important;
  border:0!important;
  border-radius:50%!important;
  background:#f0f2f5!important;
  color:#5f6368!important;
  box-shadow:none!important;
}

html body [data-messages-shell] .fl-msg-minimize>span{
  transform:translateY(-2px)!important;
  font-size:21px!important;
}

html body [data-messages-shell] .fl-msg-thread-more-v292:hover,
html body [data-messages-shell] .fl-msg-minimize:hover,
html body [data-messages-shell] .fl-msg-thread-head>button:hover,
html body [data-messages-shell] .fl-msg-head-actions button:hover{
  background:#e4e6eb!important;
  color:#1c1e21!important;
}

html body [data-messages-shell] .fl-msg-thread{
  min-height:0!important;
  flex:1 1 auto!important;
  padding:11px 10px 9px!important;
  gap:4px!important;
  background:#fff!important;
  overflow-y:auto!important;
}

html body [data-messages-shell] .fl-msg-thread-empty{
  margin:auto!important;
  padding:18px 16px!important;
  gap:5px!important;
  color:#7a808a!important;
}

html body [data-messages-shell] .fl-msg-avatar--thread-empty{
  width:58px!important;
  height:58px!important;
  margin-bottom:3px!important;
  font-size:20px!important;
}

html body [data-messages-shell] .fl-msg-thread-empty strong{
  color:#1c1e21!important;
  font-size:12px!important;
}

html body [data-messages-shell] .fl-msg-thread-empty span:last-child{
  font-size:9.5px!important;
}

html body [data-messages-shell] .fl-msg-message-row{
  max-width:80%!important;
}

html body [data-messages-shell] .fl-msg-bubble{
  padding:8px 10px 7px!important;
  border-radius:16px!important;
  background:#e9ebef!important;
  color:#1c1e21!important;
}

html body [data-messages-shell] .fl-msg-message-row.is-mine .fl-msg-bubble{
  background:#7c3aed!important;
  color:#fff!important;
  border-bottom-right-radius:5px!important;
}

html body [data-messages-shell] .fl-msg-bubble p{
  font-size:12px!important;
  line-height:1.38!important;
}

html body [data-messages-shell] .fl-msg-compose{
  flex:0 0 auto!important;
  display:grid!important;
  grid-template-columns:34px minmax(0,1fr) 36px!important;
  align-items:end!important;
  gap:6px!important;
  padding:8px 9px 9px!important;
  border-top:1px solid #e8eaee!important;
  background:#fff!important;
}

html body [data-messages-shell] .fl-msg-attach,
html body [data-messages-shell] .fl-msg-send{
  width:34px!important;
  height:34px!important;
  min-width:34px!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  border:0!important;
  border-radius:50%!important;
  box-shadow:none!important;
}

html body [data-messages-shell] .fl-msg-attach{
  background:#f0f2f5!important;
  color:#6d43d7!important;
}

html body [data-messages-shell] .fl-msg-send{
  width:36px!important;
  height:36px!important;
  background:#7c3aed!important;
  color:#fff!important;
}

html body [data-messages-shell] .fl-msg-attach svg,
html body [data-messages-shell] .fl-msg-send svg{
  width:17px!important;
  height:17px!important;
}

html body [data-messages-shell] .fl-msg-compose textarea{
  width:100%!important;
  min-width:0!important;
  min-height:36px!important;
  max-height:110px!important;
  height:auto!important;
  margin:0!important;
  padding:9px 12px!important;
  border:0!important;
  outline:0!important;
  border-radius:18px!important;
  background:#f0f2f5!important;
  color:#1c1e21!important;
  box-shadow:none!important;
  font-size:12px!important;
  line-height:1.4!important;
  resize:none!important;
}

html body [data-messages-shell] .fl-msg-search{
  margin:9px 10px 4px!important;
  min-height:38px!important;
}

html body [data-messages-shell] .fl-msg-tabs{
  padding:2px 10px 7px!important;
}

html body [data-messages-shell] .fl-msg-conversations,
html body [data-messages-shell] .fl-msg-contacts{
  padding:5px!important;
}

/* Keep action menu inside the chat window and readable. */
html body [data-messages-shell] .fl-msg-hotfix-menu-v293{
  max-width:calc(100% - 16px)!important;
  border-radius:10px!important;
  box-shadow:0 10px 28px rgba(0,0,0,.18)!important;
  font-family:"Segoe UI",Roboto,Arial,sans-serif!important;
}

html body [data-messages-shell] .fl-msg-hotfix-menu-v293__item{
  min-height:38px!important;
  font:600 12px/1.25 "Segoe UI",Roboto,Arial,sans-serif!important;
}

/* ---------- YouTube composer: stay compact and keep Publish visible ---------- */
html body .fl-post-modal{
  max-height:calc(100dvh - 28px)!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
}

html body .fl-post-modal.fl-post-modal--youtube .fl-post-modal__textarea{
  min-height:92px!important;
  max-height:132px!important;
  resize:none!important;
}

html body .fl-post-modal__publish{
  position:sticky!important;
  bottom:8px!important;
  z-index:20!important;
  background:#7c3aed!important;
  box-shadow:0 0 0 7px rgba(255,255,255,.96)!important;
}

/* ---------- Mobile Messenger ---------- */
@media (max-width:768px){
  html body [data-messages-shell].fl-msg-shell{
    position:fixed!important;
    inset:0!important;
    width:100vw!important;
    height:100dvh!important;
    max-width:none!important;
    max-height:none!important;
  }
  html body [data-messages-shell] .fl-msg-panel{
    width:100vw!important;
    height:100dvh!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
  }
  html body [data-messages-shell] .fl-msg-compose{
    padding-bottom:max(9px,env(safe-area-inset-bottom))!important;
  }
}


/* =========================================================
   FACELOV RECOVERY v1.0.7 — hard layout guards
   Current DOM from Main/Profile templates.
   ========================================================= */

html body [data-messages-shell] .fl-msg-list-view,
html body [data-messages-shell] .fl-msg-new-view,
html body [data-messages-shell] .fl-msg-thread-view{
  min-width:0!important;
  min-height:0!important;
  width:100%!important;
  height:100%!important;
}

html body [data-messages-shell] .fl-msg-list-view:not([hidden]){
  display:grid!important;
  grid-template-rows:auto auto auto minmax(0,1fr)!important;
}

html body [data-messages-shell] .fl-msg-new-view:not([hidden]){
  display:grid!important;
  grid-template-rows:auto auto minmax(0,1fr)!important;
}

html body [data-messages-shell] .fl-msg-thread-view:not([hidden]){
  display:grid!important;
  grid-template-rows:auto minmax(0,1fr) auto auto!important;
}

html body [data-messages-shell] .fl-msg-list-view[hidden],
html body [data-messages-shell] .fl-msg-new-view[hidden],
html body [data-messages-shell] .fl-msg-thread-view[hidden],
html body [data-messages-shell] .fl-msg-image-preview[hidden]{
  display:none!important;
}

html body [data-messages-shell] .fl-msg-thread{
  width:100%!important;
  height:auto!important;
  min-height:0!important;
}

html body [data-messages-shell] .fl-msg-image-preview{
  flex:0 0 auto!important;
  max-height:105px!important;
  padding:7px 10px!important;
  border-top:1px solid #e8eaee!important;
  background:#fff!important;
}

html body [data-messages-shell] .fl-msg-image-preview img{
  display:block!important;
  width:auto!important;
  max-width:92px!important;
  height:auto!important;
  max-height:82px!important;
  border-radius:9px!important;
  object-fit:cover!important;
}

html body [data-messages-shell] .fl-msg-compose{
  width:100%!important;
  box-sizing:border-box!important;
}

html body [data-messages-shell] .fl-msg-compose textarea{
  align-self:center!important;
}

html body [data-messages-shell] .fl-msg-send{
  align-self:center!important;
}

html body [data-messages-shell] .fl-msg-attach{
  align-self:center!important;
}

html body [data-messages-shell] .fl-msg-thread-person>span:last-child{
  min-width:0!important;
}

html body [data-messages-shell] .fl-msg-thread-person strong,
html body [data-messages-shell] .fl-msg-thread-person small{
  display:block!important;
  overflow:hidden!important;
  white-space:nowrap!important;
  text-overflow:ellipsis!important;
}

/* Prevent old CSS layers from stretching the Messenger to page height. */
@media (min-width:769px){
  html body [data-messages-shell] .fl-msg-panel,
  html body [data-messages-shell] .fl-msg-list-view,
  html body [data-messages-shell] .fl-msg-new-view,
  html body [data-messages-shell] .fl-msg-thread-view{
    max-height:100%!important;
  }
}

/* Old uCoz reconfirm banner: visual fallback in case it appears before JS hides it. */
html body .fl-ucoz-reconfirm-hidden{
  display:none!important;
  pointer-events:none!important;
}
