/* =========================================================
   chat.css — DutchLine Chat (Expanded UI Kit)
   - Inbox layout (sidebar + thread)
   - Search + filters + pinned
   - Message groups, reply, edit, actions menu
   - Attachments (file/image), link preview
   - Unread divider + scroll-to-bottom button
   - Typing indicator + quick replies
   - Empty/loading states
   ========================================================= */

:root{
  --dl-chat-bg: rgba(255,255,255,.88);
  --dl-chat-head: rgba(255,255,255,.92);
  --dl-chat-thread: rgba(255,255,255,.86);

  --dl-success: rgba(32,201,151,.95);
  --dl-danger: rgba(255,77,77,.95);
  --dl-warning: rgba(255,193,7,.95);
  --dl-info: rgba(13,110,253,.95);

  --dl-success-soft: rgba(32,201,151,.12);
  --dl-danger-soft: rgba(255,77,77,.12);
  --dl-warning-soft: rgba(255,193,7,.12);
  --dl-info-soft: rgba(13,110,253,.12);
}

/* =========================================================
   Inbox frame
   ========================================================= */
.dl-chatkit{
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--dl-chat-bg);
  box-shadow: var(--shadow2);
  overflow:hidden;
}

.dl-chatkit-grid{
  display:grid;
  grid-template-columns: 340px 1fr;
  min-height: 520px;
}
@media (max-width: 991px){
  .dl-chatkit-grid{ grid-template-columns: 1fr; }
  .dl-chatkit-sidebar{ display:none; }
  .dl-chatkit.is-mobile-list .dl-chatkit-sidebar{ display:block; }
  .dl-chatkit.is-mobile-list .dl-chatkit-thread{ display:none; }
}

/* =========================================================
   Sidebar (conversation list)
   ========================================================= */
.dl-chatkit-sidebar{
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,.92);
}

.dl-chatkit-shead{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--dl-chat-head);
}

.dl-chatkit-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.dl-chatkit-title h3{
  margin: 0;
  font-weight: 950;
  letter-spacing: -.02em;
  font-size: 1.05rem;
}
.dl-chatkit-title .mini{
  color: var(--muted2);
  font-weight: 900;
  font-size: .85rem;
}

.dl-chatkit-search{
  position: relative;
  margin-top: 10px;
}
.dl-chatkit-search input{
  border-radius: 14px;
  padding-left: 42px;
}
.dl-chatkit-search svg{
  position:absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .65;
}

.dl-chatkit-filters{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin-top: 10px;
}
.dl-chatkit-chip{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.86);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 900;
  font-size: .82rem;
  color: rgba(11,18,32,.80);
  cursor:pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  user-select:none;
}
.dl-chatkit-chip:hover{ transform: translateY(-1px); background:#fff; border-color: var(--border2); }
.dl-chatkit-chip.is-active{
  border-color: rgba(48,77,161,.22);
  background: rgba(48,77,161,.08);
}

.dl-chatkit-list{
  padding: 8px;
  max-height: 420px;
  overflow:auto;
}
.dl-conv{
  display:flex;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor:pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.dl-conv:hover{
  transform: translateY(-1px);
  border-color: var(--border);
  background: rgba(255,255,255,.72);
}
.dl-conv.is-active{
  border-color: rgba(48,77,161,.22);
  background: rgba(48,77,161,.06);
}
.dl-conv .av{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    radial-gradient(520px 180px at 20% 20%, rgba(48,77,161,.10), transparent 60%),
    linear-gradient(180deg, rgba(11,18,32,.02), transparent 35%),
    rgba(255,255,255,.94);
  display:grid;
  place-items:center;
  font-weight: 950;
  flex: 0 0 auto;
  color: rgba(11,18,32,.78);
}
.dl-conv .m{
  min-width:0;
  flex: 1 1 auto;
}
.dl-conv .top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.dl-conv .name{
  margin: 0;
  font-weight: 950;
  letter-spacing: -.01em;
  font-size: .98rem;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.dl-conv .time{
  color: var(--muted2);
  font-weight: 900;
  font-size: .82rem;
  flex: 0 0 auto;
}
.dl-conv .sub{
  margin: 4px 0 0;
  color: var(--muted2);
  font-size: .88rem;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.dl-conv .meta{
  margin-top: 8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.dl-conv .tags{
  display:flex;
  gap: 6px;
  flex-wrap:wrap;
}
.dl-tag{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 900;
  font-size: .78rem;
  color: rgba(11,18,32,.78);
}
.dl-tag.pinned{
  border-color: rgba(48,77,161,.22);
  background: rgba(48,77,161,.08);
}
.dl-unread{
  border-radius: 999px;
  background: rgba(48,77,161,.95);
  color: #fff;
  font-weight: 950;
  font-size: .78rem;
  padding: 5px 8px;
}

/* =========================================================
   Thread header
   ========================================================= */
.dl-chatkit-thread{
  background: var(--dl-chat-thread);
  display:flex;
  flex-direction:column;
  min-width:0;
}

.dl-thread-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--dl-chat-head);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.dl-thread-title{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width:0;
}
.dl-thread-title .av{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  display:grid;
  place-items:center;
  font-weight: 950;
  color: rgba(11,18,32,.78);
  flex: 0 0 auto;
}
.dl-thread-title .meta{
  min-width:0;
}
.dl-thread-title .name{
  margin: 0;
  font-weight: 950;
  letter-spacing: -.01em;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.dl-thread-title .sub{
  margin: 2px 0 0;
  color: var(--muted2);
  font-size: .90rem;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.dl-thread-actions{
  display:flex;
  gap: 8px;
  align-items:center;
  flex: 0 0 auto;
}
.dl-thread-actions .dl-btn{
  padding: 10px 12px;
}

/* =========================================================
   Thread body (messages)
   ========================================================= */
.dl-thread-body{
  position: relative;
  flex: 1 1 auto;
  overflow:auto;
  padding: 14px;
  background:
    radial-gradient(900px 360px at 8% 0%, rgba(48,77,161,.06), transparent 60%),
    radial-gradient(900px 360px at 92% 0%, rgba(128,160,208,.06), transparent 70%),
    rgba(255,255,255,.86);
}

/* scroll-to-bottom */
.dl-scrollbtn{
  position:absolute;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display:none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  box-shadow: 0 14px 40px rgba(11,18,32,.10);
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 950;
  cursor:pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.dl-scrollbtn:hover{ transform: translateY(-1px); border-color: var(--border2); background:#fff; }

/* separators */
.dl-sep{
  display:flex;
  justify-content:center;
  margin: 12px 0;
}
.dl-sep span{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted2);
  font-size: .85rem;
  font-weight: 900;
}

/* unread divider */
.dl-unreadline{
  display:flex;
  align-items:center;
  gap: 10px;
  margin: 12px 0;
}
.dl-unreadline::before,
.dl-unreadline::after{
  content:"";
  height: 1px;
  background: linear-gradient(90deg, rgba(48,77,161,.22), rgba(11,18,32,.08));
  flex: 1 1 auto;
  opacity: .9;
}
.dl-unreadline span{
  border: 1px solid rgba(48,77,161,.22);
  background: rgba(48,77,161,.08);
  color: rgba(11,18,32,.84);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 950;
  font-size: .85rem;
}

/* system message */
.dl-system{
  display:flex;
  justify-content:center;
  margin: 10px 0;
}
.dl-system .box{
  max-width: 720px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--border));
  background: rgba(48,77,161,.06);
  padding: 10px 12px;
  color: rgba(11,18,32,.78);
  font-weight: 850;
}

/* message group */
.dl-group{
  display:flex;
  gap: 10px;
  margin: 12px 0;
  align-items:flex-end;
}
.dl-group.me{ justify-content:flex-end; }
.dl-group .av{
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  display:grid;
  place-items:center;
  font-weight: 950;
  color: rgba(11,18,32,.70);
  flex: 0 0 auto;
}
.dl-group.me .av{ display:none; }

.dl-stack{ display:flex; flex-direction:column; gap: 8px; min-width:0; }

/* bubble */
.dl-bubble{
  max-width: min(78%, 760px);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.94);
  padding: 10px 12px;
  box-shadow: 0 14px 36px rgba(11,18,32,.06);
  position: relative;
}
.dl-group.me .dl-bubble{
  background: rgba(48,77,161,.08);
  border-color: rgba(48,77,161,.22);
}
.dl-bubble .top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.dl-bubble .who{
  margin: 0;
  font-weight: 950;
  font-size: .92rem;
  color: rgba(11,18,32,.86);
}
.dl-bubble .meta{
  display:flex;
  align-items:center;
  gap: 8px;
  color: var(--muted2);
  font-weight: 900;
  font-size: .82rem;
}
.dl-pill-mini{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 950;
  font-size: .76rem;
  color: rgba(11,18,32,.74);
}
.dl-pill-mini.success{ border-color: rgba(32,201,151,.25); background: var(--dl-success-soft); }
.dl-pill-mini.warning{ border-color: rgba(255,193,7,.25); background: var(--dl-warning-soft); }
.dl-pill-mini.danger{ border-color: rgba(255,77,77,.25); background: var(--dl-danger-soft); }
.dl-pill-mini.info{ border-color: rgba(13,110,253,.25); background: var(--dl-info-soft); }

.dl-bubble .text{
  margin: 8px 0 0;
  color: rgba(11,18,32,.78);
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.dl-bubble .text a{ text-decoration: underline; text-underline-offset: 3px; }
.dl-bubble .text code{
  background: rgba(11,18,32,.06);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 900;
}
.dl-bubble pre{
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: rgba(255,255,255,.92);
  overflow:auto;
  font-size: .92rem;
  line-height: 1.55;
}

/* Reply preview */
.dl-reply{
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.88);
  padding: 8px 10px;
  color: rgba(11,18,32,.76);
  font-weight: 900;
  font-size: .86rem;
}
.dl-group.me .dl-reply{
  border-color: rgba(48,77,161,.22);
  background: rgba(255,255,255,.78);
}
.dl-reply .k{ color: var(--muted2); font-weight: 950; margin-right: 6px; }
.dl-reply .q{ opacity: .9; }

/* Attachments */
.dl-attach{
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  overflow:hidden;
}
.dl-attach .thumb{
  aspect-ratio: 16/9;
  background:
    radial-gradient(520px 180px at 20% 20%, rgba(48,77,161,.10), transparent 60%),
    rgba(255,255,255,.92);
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 950;
  color: rgba(11,18,32,.70);
  position:relative;
}
.dl-attach .thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dl-attach .thumb .badge{
  position:absolute;
  left: 10px;
  bottom: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 950;
  font-size: .78rem;
}
.dl-attach .meta{ padding: 10px 12px; }
.dl-attach .meta .fn{ margin: 0; font-weight: 950; }
.dl-attach .meta .sz{ margin: 6px 0 0; color: var(--muted2); font-size: .88rem; }

/* Link preview */
.dl-linkprev{
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  overflow:hidden;
  display:grid;
  grid-template-columns: 140px 1fr;
}
@media (max-width: 575px){
  .dl-linkprev{ grid-template-columns: 1fr; }
}
.dl-linkprev .img{
  background:
    radial-gradient(520px 180px at 20% 20%, rgba(48,77,161,.10), transparent 60%),
    rgba(255,255,255,.92);
  border-right: 1px solid var(--border);
  min-height: 92px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 950;
  color: rgba(11,18,32,.68);
}
@media (max-width: 575px){
  .dl-linkprev .img{ border-right:0; border-bottom:1px solid var(--border); }
}
.dl-linkprev .m{
  padding: 10px 12px;
}
.dl-linkprev .m .t{ margin:0; font-weight: 950; }
.dl-linkprev .m .d{ margin:6px 0 0; color: var(--muted2); font-size:.88rem; line-height:1.4; }
.dl-linkprev .m .u{ margin:8px 0 0; color: rgba(48,77,161,.88); font-weight: 950; font-size:.86rem; }

/* Bubble footer: time + ticks + actions */
.dl-bubble .foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted2);
  font-size: .82rem;
  font-weight: 900;
}
.dl-status{
  display:flex;
  align-items:center;
  gap: 6px;
}
.dl-tick{
  width: 18px;
  height: 18px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  display:grid;
  place-items:center;
  font-size: .72rem;
}

/* actions button + dropdown */
.dl-msg-actions{
  position: relative;
}
.dl-actions-btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  border-radius: 12px;
  padding: 6px 9px;
  font-weight: 950;
  cursor:pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.dl-actions-btn:hover{ transform: translateY(-1px); border-color: var(--border2); background:#fff; }
.dl-actions-menu{
  position:absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 18px 60px rgba(11,18,32,.12);
  padding: 8px;
  display:none;
  z-index: 10;
}
.dl-actions-menu button{
  width: 100%;
  text-align:left;
  border: 0;
  background: transparent;
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 900;
  color: rgba(11,18,32,.84);
  cursor:pointer;
}
.dl-actions-menu button:hover{ background: rgba(48,77,161,.08); }
.dl-actions-menu .danger{ color: rgba(255,77,77,.95); }
.dl-msg-actions.is-open .dl-actions-menu{ display:block; }

/* typing indicator */
.dl-typing{
  display:flex;
  gap: 10px;
  align-items:flex-end;
  margin: 10px 0 0;
}
.dl-typing .av{
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.92);
  display:grid;
  place-items:center;
  font-weight: 950;
  color: rgba(11,18,32,.70);
}
.dl-typing .dots{
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.94);
  padding: 10px 12px;
  display:flex;
  gap: 6px;
  align-items:center;
}
.dl-typing .dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(11,18,32,.55);
  animation: dlTyping 1.05s infinite ease-in-out;
  opacity: .65;
}
.dl-typing .dot:nth-child(2){ animation-delay: .12s; }
.dl-typing .dot:nth-child(3){ animation-delay: .24s; }
@keyframes dlTyping{
  0%,100%{ transform: translateY(0); opacity:.55; }
  50%{ transform: translateY(-4px); opacity: 1; }
}

/* =========================================================
   Composer
   ========================================================= */
.dl-thread-foot{
  border-top: 1px solid var(--border);
  background: var(--dl-chat-head);
  padding: 12px 14px;
}

.dl-replybar{
  display:none;
  margin-bottom: 10px;
  border-radius: 16px;
  border: 1px solid rgba(48,77,161,.22);
  background: rgba(48,77,161,.06);
  padding: 10px 12px;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.dl-replybar .l{
  min-width:0;
}
.dl-replybar .t{
  margin: 0;
  font-weight: 950;
}
.dl-replybar .q{
  margin: 4px 0 0;
  color: var(--muted2);
  font-weight: 900;
  font-size: .86rem;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.dl-replybar .x{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.86);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 950;
  cursor:pointer;
}

.dl-composer{
  display:flex;
  gap: 10px;
  align-items:flex-end;
}
.dl-composer .left{
  flex: 1 1 auto;
  display:flex;
  gap: 10px;
  align-items:flex-end;
}
.dl-composer textarea{
  resize: none;
  min-height: 44px;
  max-height: 140px;
  padding-top: 10px;
}
.dl-composer .actions{
  display:flex;
  gap: 8px;
  flex: 0 0 auto;
}

/* quick replies */
.dl-quick{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin-top: 10px;
}
.dl-quick .q{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.86);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 950;
  cursor:pointer;
  color: rgba(11,18,32,.82);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.dl-quick .q:hover{
  transform: translateY(-1px);
  background: #fff;
  border-color: var(--border2);
}

/* dropzone */
.dl-drop{
  margin-top: 10px;
  border-radius: 18px;
  border: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--border));
  background: rgba(48,77,161,.05);
  padding: 12px;
  display:none;
  font-weight: 950;
  color: rgba(11,18,32,.78);
}
.dl-drop.is-on{ display:block; }

/* empty + loading */
.dl-empty{
  padding: 18px;
  border-radius: var(--r2);
  border: 1px dashed var(--border);
  background: rgba(255,255,255,.82);
  color: rgba(11,18,32,.78);
}
.dl-skel{
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.78);
  padding: 12px;
}
.dl-skel .bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(11,18,32,.08);
  margin: 8px 0;
}
.dl-skel .bar.w1{ width: 70%; }
.dl-skel .bar.w2{ width: 44%; }
.dl-skel .bar.w3{ width: 82%; }
