/* RELIK V2.3.0 — Apple / Instagram Reply Layout */

/* message wrapping */
.relik-dcl-row p,
.relik-mini-bubble{
  max-width:min(520px,78%)!important;
  white-space:pre-wrap!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
  line-height:1.38!important;
  height:auto!important;
  min-height:0!important;
}

#relikMiniChat .relik-mini-bubble{
  max-width:min(280px,82%)!important;
}

.relik-v221-bubble-host{
  position:relative!important;
  overflow:visible!important;
}

.relik-v220-row{
  position:relative!important;
  overflow:visible!important;
}

/* Reply/Copy actions near bubble */
.relik-v220-actions{
  position:absolute;
  top:50%;
  left:-72px;
  transform:translateY(-50%) translateX(-4px);
  display:flex;
  align-items:center;
  gap:7px;
  z-index:90;
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
  user-select:none!important;
  -webkit-user-select:none!important;
}

.relik-v221-bubble-host:hover .relik-v220-actions,
.relik-v220-row:hover .relik-v220-actions{
  opacity:1;
  pointer-events:auto;
  transform:translateY(-50%) translateX(0);
}

.relik-v220-action{
  width:32px;
  height:32px;
  border:0;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.98);
  color:#315cff;
  box-shadow:0 12px 30px rgba(15,23,42,.16);
  backdrop-filter:blur(14px) saturate(160%);
  -webkit-backdrop-filter:blur(14px) saturate(160%);
  cursor:pointer;
  font-size:15px;
  line-height:1;
  transition:transform .16s ease,background .16s ease,color .16s ease;
}

.relik-v220-action:hover{
  transform:translateY(-1px) scale(1.04);
  background:#315cff;
  color:#fff;
}

/* Composer reply preview */
.relik-v220-reply-preview{
  display:none;
  align-items:flex-start!important;
  gap:11px;
  margin:0 12px 10px;
  padding:10px 12px;
  border-radius:20px;
  background:linear-gradient(135deg,rgba(255,255,255,.94),rgba(245,248,255,.88));
  border:1px solid rgba(49,92,255,.15);
  box-shadow:0 16px 44px rgba(15,23,42,.10);
  backdrop-filter:blur(20px) saturate(170%);
  -webkit-backdrop-filter:blur(20px) saturate(170%);
  max-height:150px!important;
  overflow:hidden!important;
}

.relik-v220-reply-preview.is-visible{
  display:flex!important;
  animation:relikV230ReplyIn .22s cubic-bezier(.22,1,.36,1);
}

@keyframes relikV230ReplyIn{
  from{opacity:0;transform:translateY(8px) scale(.98)}
  to{opacity:1;transform:translateY(0) scale(1)}
}

.relik-v220-reply-icon{
  width:34px;
  height:34px;
  min-width:34px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#315cff,#5a77ff);
  color:#fff;
  box-shadow:0 12px 26px rgba(49,92,255,.24);
  font-size:16px;
  margin-top:2px;
}

.relik-v220-reply-copy{
  min-width:0;
  flex:1;
  border-left:3px solid rgba(49,92,255,.46);
  padding-left:10px;
}

.relik-v220-reply-copy strong{
  display:block;
  color:#315cff;
  font-size:12px;
  line-height:1.1;
  font-weight:850;
}

.relik-v220-reply-copy span{
  display:block!important;
  margin-top:3px;
  max-width:100%;
  color:#475467;
  font-size:13px;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
  line-height:1.35!important;
  max-height:92px!important;
  overflow-y:auto!important;
  padding-right:4px!important;
}

.relik-v220-reply-close{
  width:32px;
  height:32px;
  min-width:32px;
  border:0;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#f4f7ff;
  color:#475467;
  font-size:21px;
  line-height:1;
  cursor:pointer;
  margin-top:2px;
}

/* Apple/Instagram rendered reply group */
.relik-v230-reply-message{
  background:transparent!important;
  box-shadow:none!important;
  padding:0!important;
  display:flex!important;
  flex-direction:column!important;
  gap:0!important;
  max-width:min(520px,78%)!important;
  color:inherit!important;
}

.relik-dcl-row.out .relik-v230-reply-message,
.relik-mini-row.out .relik-v230-reply-message{
  align-items:flex-end!important;
}

.relik-dcl-row.in .relik-v230-reply-message,
.relik-mini-row.in .relik-v230-reply-message{
  align-items:flex-start!important;
}

.relik-v230-reply-title{
  display:block!important;
  max-width:100%!important;
  margin:0 8px 5px!important;
  font-size:12px!important;
  line-height:1.25!important;
  font-weight:750!important;
  color:#667085!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}

.relik-dcl-row.out .relik-v230-reply-title,
.relik-mini-row.out .relik-v230-reply-title{
  text-align:right!important;
}

.relik-v230-reply-quote{
  display:block!important;
  width:100%!important;
  box-sizing:border-box!important;
  padding:10px 13px!important;
  border-radius:20px 20px 8px 20px!important;
  background:rgba(49,92,255,.16)!important;
  color:#315cff!important;
  font-size:13px!important;
  line-height:1.35!important;
  max-height:76px!important;
  overflow:hidden!important;
  border:1px solid rgba(49,92,255,.10)!important;
}

.relik-dcl-row.in .relik-v230-reply-quote,
.relik-mini-row.in .relik-v230-reply-quote{
  border-radius:20px 20px 20px 8px!important;
  background:rgba(17,24,39,.07)!important;
  color:#475467!important;
}

.relik-v230-reply-quote span{
  display:-webkit-box!important;
  -webkit-line-clamp:3!important;
  -webkit-box-orient:vertical!important;
  white-space:normal!important;
  overflow:hidden!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
}

.relik-v230-reply-body{
  display:block!important;
  width:100%!important;
  box-sizing:border-box!important;
  padding:11px 14px!important;
  margin-top:2px!important;
  border-radius:20px 8px 20px 20px!important;
  background:linear-gradient(135deg,#315cff,#5a77ff)!important;
  color:#fff!important;
  box-shadow:0 14px 32px rgba(49,92,255,.20)!important;
  white-space:pre-wrap!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
}

.relik-dcl-row.in .relik-v230-reply-body,
.relik-mini-row.in .relik-v230-reply-body{
  border-radius:8px 20px 20px 20px!important;
  background:#fff!important;
  color:#111827!important;
  box-shadow:0 14px 32px rgba(15,23,42,.08)!important;
}

/* Composer textarea grow */
.relik-v225-hidden-input{
  position:absolute!important;
  opacity:0!important;
  pointer-events:none!important;
  width:1px!important;
  height:1px!important;
  min-width:1px!important;
  max-width:1px!important;
  padding:0!important;
  margin:0!important;
  border:0!important;
}

.relik-v225-compose-textarea{
  flex:1 1 auto!important;
  width:100%!important;
  min-width:0!important;
  min-height:42px!important;
  max-height:138px!important;
  resize:none!important;
  overflow-y:auto!important;
  border:0!important;
  outline:0!important;
  background:transparent!important;
  color:inherit!important;
  font:inherit!important;
  line-height:1.38!important;
  padding:11px 0!important;
  white-space:pre-wrap!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
}

.relik-v225-compose-textarea::placeholder{
  color:#98a2b3;
}

.relik-mini-composer,
.relik-dcl-composer{
  align-items:flex-end!important;
  height:auto!important;
  min-height:52px!important;
}

/* Toast */
.relik-v220-toast{
  position:fixed;
  left:50%;
  bottom:28px;
  transform:translateX(-50%) translateY(20px);
  z-index:1000002;
  padding:10px 15px;
  border-radius:999px;
  background:rgba(17,24,39,.92);
  color:#fff;
  font-size:13px;
  font-weight:800;
  box-shadow:0 18px 54px rgba(0,0,0,.22);
  opacity:0;
  pointer-events:none;
  transition:opacity .2s ease,transform .2s ease;
}

.relik-v220-toast.is-visible{
  opacity:1;
  transform:translateX(-50%) translateY(0);
}

@media(max-width:760px){
  .relik-v220-actions{
    opacity:0;
    pointer-events:none;
    left:-68px;
    transform:translateY(-50%) translateX(-8px) scale(.96);
  }

  .relik-v221-bubble-host:hover .relik-v220-actions,
  .relik-v220-row:hover .relik-v220-actions{
    opacity:0;
    pointer-events:none;
  }

  .relik-v220-row.relik-v220-swipe-open .relik-v220-actions{
    opacity:1;
    pointer-events:auto;
    transform:translateY(-50%) translateX(0) scale(1);
  }

  .relik-v220-row.relik-v220-swipe-open .relik-v221-bubble-host{
    transform:translateX(46px)!important;
    transition:transform .18s cubic-bezier(.22,1,.36,1)!important;
  }

  .relik-v220-action{
    width:31px;
    height:31px;
  }

  .relik-v230-reply-message{
    max-width:min(300px,82%)!important;
  }
}

@media(max-width:420px){
  .relik-v220-actions{
    left:-64px;
    gap:5px;
  }

  .relik-v220-action{
    width:29px;
    height:29px;
  }

  #relikMiniChat .relik-mini-bubble,
  #relikMiniChat .relik-v230-reply-message{
    max-width:min(250px,80%)!important;
  }

  .relik-v230-reply-title{
    font-size:11.5px!important;
  }
}

/* Hide old reply styles/buttons */
.relik-visible-reply-btn,
.relik-force-reply-btn,
.relik-message-reply-btn,
.relik-v221-inline-preview,
.relik-v221-inline-body,
.relik-v229-reply-title{
  display:none!important;
}


/* RELIK V2.3.1 — name fallback + premium attached reply group */
.relik-v230-reply-message{
  background:transparent!important;
  box-shadow:none!important;
  padding:0!important;
  gap:0!important;
  overflow:visible!important;
}

.relik-v230-reply-title{
  width:100%!important;
  box-sizing:border-box!important;
  margin:0 0 6px!important;
  padding:0 4px!important;
  font-size:12px!important;
  line-height:1.2!important;
  font-weight:800!important;
  color:#667085!important;
  letter-spacing:-.01em!important;
}

.relik-dcl-row.out .relik-v230-reply-title,
.relik-mini-row.out .relik-v230-reply-title{
  text-align:right!important;
}

.relik-v230-reply-quote{
  width:100%!important;
  box-sizing:border-box!important;
  padding:11px 14px 10px!important;
  margin:0!important;
  border-radius:22px 22px 8px 22px!important;
  background:linear-gradient(135deg,rgba(235,240,255,.96),rgba(218,228,255,.92))!important;
  border:1px solid rgba(49,92,255,.12)!important;
  box-shadow:0 10px 26px rgba(49,92,255,.08)!important;
  color:#3058df!important;
  font-size:13px!important;
  line-height:1.36!important;
  max-height:74px!important;
  overflow:hidden!important;
}

.relik-dcl-row.in .relik-v230-reply-quote,
.relik-mini-row.in .relik-v230-reply-quote{
  border-radius:22px 22px 22px 8px!important;
  background:linear-gradient(135deg,rgba(255,255,255,.96),rgba(246,248,252,.94))!important;
  color:#475467!important;
  box-shadow:0 10px 26px rgba(15,23,42,.07)!important;
}

.relik-v230-reply-quote span{
  display:-webkit-box!important;
  -webkit-line-clamp:2!important;
  -webkit-box-orient:vertical!important;
  overflow:hidden!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
  transform:none!important;
}

.relik-v230-reply-body{
  width:100%!important;
  box-sizing:border-box!important;
  margin:2px 0 0!important;
  padding:10px 14px 11px!important;
  border-radius:8px 8px 22px 22px!important;
  background:linear-gradient(135deg,#315cff,#5272ff)!important;
  color:#fff!important;
  box-shadow:0 14px 32px rgba(49,92,255,.18)!important;
  font-size:14px!important;
  line-height:1.38!important;
  white-space:pre-wrap!important;
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
}

.relik-dcl-row.in .relik-v230-reply-body,
.relik-mini-row.in .relik-v230-reply-body{
  background:linear-gradient(135deg,#ffffff,#f8faff)!important;
  color:#111827!important;
  box-shadow:0 14px 32px rgba(15,23,42,.07)!important;
}

/* Remove old visible preview styles that may push text down */
.relik-v230-reply-quote .relik-v221-inline-preview,
.relik-v230-reply-message .relik-v221-inline-preview,
.relik-v230-reply-message .relik-v221-inline-body{
  display:none!important;
}

@media(max-width:420px){
  .relik-v230-reply-title{
    font-size:11.5px!important;
  }
  .relik-v230-reply-quote{
    padding:10px 12px!important;
    border-radius:20px 20px 8px 20px!important;
  }
  .relik-v230-reply-body{
    padding:10px 12px!important;
    border-radius:8px 8px 20px 20px!important;
  }
}


/* RELIK V2.3.2 — compact premium reply */
.relik-v230-reply-message{
  gap:0!important;
}

.relik-v230-reply-title{
  margin:0 0 4px!important;
}

.relik-v230-reply-quote{
  padding:10px 14px!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  overflow:visible!important;
  border-radius:22px 22px 10px 22px!important;
}

.relik-v230-reply-quote span{
  display:block!important;
  -webkit-line-clamp:unset!important;
  -webkit-box-orient:unset!important;
  overflow:visible!important;
  max-height:none!important;
}

.relik-v230-reply-body{
  margin-top:1px!important;
  border-radius:10px 10px 22px 22px!important;
}

.relik-dcl-row.in .relik-v230-reply-quote,
.relik-mini-row.in .relik-v230-reply-quote{
  border-radius:22px 22px 22px 10px!important;
}

.relik-dcl-row.in .relik-v230-reply-body,
.relik-mini-row.in .relik-v230-reply-body{
  border-radius:10px 10px 22px 22px!important;
}

/* RELIK V2.3.3.2 — Reply Preview Compact + Incoming Actions Side Hotfix
   Scope:
   1) Keeps replied-message preview compact, removing tall top/bottom spacing.
   2) Moves Reply/Copy hover actions to the RIGHT side for received messages.
   DB: no changes.
*/

/* Compact replied-message preview */
.relik-v230-reply-message{
  gap:0!important;
  height:auto!important;
  min-height:0!important;
  align-self:auto!important;
}

.relik-v230-reply-title{
  margin:0 6px 3px!important;
  line-height:1.15!important;
}

.relik-v230-reply-quote{
  padding:7px 11px!important;
  min-height:0!important;
  height:auto!important;
  max-height:52px!important;
  overflow:hidden!important;
  line-height:1.25!important;
  box-sizing:border-box!important;
}

.relik-v230-reply-quote span{
  display:-webkit-box!important;
  -webkit-line-clamp:2!important;
  -webkit-box-orient:vertical!important;
  overflow:hidden!important;
  max-height:34px!important;
  line-height:1.25!important;
}

.relik-v230-reply-body{
  margin-top:2px!important;
  padding:9px 13px!important;
  min-height:0!important;
  height:auto!important;
  line-height:1.32!important;
}

/* Prevent inherited bubble sizing from making reply previews tall */
.relik-v230-reply-message .relik-v230-reply-quote,
.relik-v230-reply-message .relik-v230-reply-body{
  min-width:0!important;
}

/* Desktop/tablet: outgoing messages keep actions on the left, incoming messages move actions to the right */
.relik-dcl-row.in .relik-v220-actions,
.relik-mini-row.in .relik-v220-actions{
  left:auto!important;
  right:-72px!important;
  transform:translateY(-50%) translateX(4px)!important;
}

.relik-dcl-row.in .relik-v221-bubble-host:hover .relik-v220-actions,
.relik-dcl-row.in.relik-v220-row:hover .relik-v220-actions,
.relik-mini-row.in .relik-v221-bubble-host:hover .relik-v220-actions,
.relik-mini-row.in.relik-v220-row:hover .relik-v220-actions{
  transform:translateY(-50%) translateX(0)!important;
}

/* Mobile swipe: received messages reveal actions from the right side */
@media(max-width:760px){
  .relik-dcl-row.in .relik-v220-actions,
  .relik-mini-row.in .relik-v220-actions{
    left:auto!important;
    right:-68px!important;
    transform:translateY(-50%) translateX(8px) scale(.96)!important;
  }

  .relik-dcl-row.in.relik-v220-swipe-open .relik-v220-actions,
  .relik-mini-row.in.relik-v220-swipe-open .relik-v220-actions{
    transform:translateY(-50%) translateX(0) scale(1)!important;
  }

  .relik-dcl-row.in.relik-v220-swipe-open .relik-v221-bubble-host,
  .relik-mini-row.in.relik-v220-swipe-open .relik-v221-bubble-host{
    transform:translateX(-46px)!important;
  }

  .relik-v230-reply-quote{
    padding:7px 10px!important;
    max-height:50px!important;
  }

  .relik-v230-reply-body{
    padding:9px 12px!important;
  }
}

@media(max-width:420px){
  .relik-dcl-row.in .relik-v220-actions,
  .relik-mini-row.in .relik-v220-actions{
    left:auto!important;
    right:-64px!important;
  }
}

/* RELIK V2.3.3.4 — Reply Preview Vertical Align Micro Hotfix
   Base: V2.3.3.2 Reply UI Fix
   Fix: removes inherited bubble/attachment spacing from the quoted preview and centers the preview text vertically.
   DB: no changes.
*/

/* The reply wrapper must not inherit regular message bubble spacing. */
.relik-mini-bubble.relik-v230-reply-message,
#relikMiniChat .relik-mini-bubble.relik-v230-reply-message,
#relikDesktopChatLayer .relik-dcl-row p.relik-v230-reply-message{
  display:flex!important;
  flex-direction:column!important;
  gap:0!important;
  padding:0!important;
  margin-top:0!important;
  margin-bottom:0!important;
  height:auto!important;
  min-height:0!important;
  line-height:1.25!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:visible!important;
}

/* Compact title: keeps the label close to the preview, like the mockup. */
.relik-v230-reply-message > .relik-v230-reply-title{
  display:block!important;
  width:100%!important;
  box-sizing:border-box!important;
  margin:0 0 4px!important;
  padding:0 4px!important;
  line-height:1.15!important;
}

/* Compact quoted preview: flex centers text vertically and blocks old min-height rules. */
.relik-v230-reply-message > .relik-v230-reply-quote{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  width:100%!important;
  box-sizing:border-box!important;
  margin:0!important;
  padding:7px 12px!important;
  min-height:34px!important;
  height:auto!important;
  max-height:46px!important;
  line-height:1.22!important;
  overflow:hidden!important;
}

.relik-v230-reply-message > .relik-v230-reply-quote > span{
  display:block!important;
  width:100%!important;
  margin:0!important;
  padding:0!important;
  line-height:1.22!important;
  max-height:31px!important;
  overflow:hidden!important;
  white-space:normal!important;
  text-overflow:ellipsis!important;
  transform:none!important;
}

/* If old media/file preview markup ever leaks inside a quote, make it a tiny textual/compact preview instead of a tall attachment block. */
.relik-v230-reply-message > .relik-v230-reply-quote .relik-chat-image-preview,
.relik-v230-reply-message > .relik-v230-reply-quote .relik-chat-file-preview,
.relik-v230-reply-message > .relik-v230-reply-quote img,
.relik-v230-reply-message > .relik-v230-reply-quote video{
  max-height:32px!important;
  min-height:0!important;
  height:32px!important;
  width:auto!important;
  max-width:100%!important;
  border-radius:10px!important;
  box-shadow:none!important;
  margin:0!important;
  padding:0!important;
  object-fit:cover!important;
}

/* Body below quote: no extra top/bottom air. */
.relik-v230-reply-message > .relik-v230-reply-body{
  display:block!important;
  width:100%!important;
  box-sizing:border-box!important;
  margin:2px 0 0!important;
  padding:9px 13px!important;
  min-height:0!important;
  height:auto!important;
  line-height:1.28!important;
}

@media(max-width:760px){
  .relik-v230-reply-message > .relik-v230-reply-title{
    margin-bottom:3px!important;
  }

  .relik-v230-reply-message > .relik-v230-reply-quote{
    padding:6px 11px!important;
    min-height:32px!important;
    max-height:44px!important;
  }

  .relik-v230-reply-message > .relik-v230-reply-body{
    padding:8px 12px!important;
    margin-top:2px!important;
  }
}
