/* =========================================================
   Artefato (painel ao lado do chat) + cartões no chat
   ========================================================= */

.chat-area { transition: opacity .3s var(--ease-out); }

.artifact {
  --aw: 56%;
  position: relative; flex: 0 1 0px; min-width: 0; overflow: hidden;
  background: #fff; border-left: 1px solid transparent;
  transition: flex-basis .55s var(--ease-out), border-color .3s;
}
.dark .artifact { background: #1b1b1b; }
.artifact.open { flex-basis: var(--aw); border-left-color: rgb(0 0 0 / .08); }
.dark .artifact.open { border-left-color: rgb(255 255 255 / .07); }
.artifact.full { flex-basis: 100%; border-left-color: transparent; }
body.artifact-full .chat-area { flex: 0 0 0px; opacity: 0; pointer-events: none; overflow: hidden; }

.artifact-inner {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  opacity: 0; transform: translateX(24px);
  transition: opacity .25s, transform .5s var(--ease-out);
}
.artifact.open .artifact-inner { opacity: 1; transform: none; transition-delay: .08s; }

.artifact-header {
  display: flex; align-items: center; gap: 10px; height: 56px; flex-shrink: 0; padding: 0 10px 0 16px;
  border-bottom: 1px solid rgb(0 0 0 / .07);
}
.dark .artifact-header { border-color: rgb(255 255 255 / .07); }
.artifact-icon {
  display: grid; place-items: center; height: 32px; width: 32px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, rgb(139 92 246 / .14), rgb(14 165 233 / .14)); color: rgb(109 40 217);
}
.dark .artifact-icon { color: rgb(196 181 253); }
.artifact-body { position: relative; flex: 1; min-height: 0; }
.artifact-mount { position: absolute; inset: 0; }

/* Borda de redimensionar */
.artifact-resizer { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; z-index: 20; cursor: col-resize; display: none; }
.artifact.open:not(.full) .artifact-resizer { display: block; }
.artifact-resizer::after {
  content: ''; position: absolute; left: 2px; top: 50%; height: 40px; width: 4px; border-radius: 4px; transform: translateY(-50%);
  background: rgb(0 0 0 / .15); opacity: 0; transition: opacity .2s, height .25s var(--ease-out);
}
.dark .artifact-resizer::after { background: rgb(255 255 255 / .2); }
.artifact-resizer:hover::after, .artifact-resizing .artifact-resizer::after { opacity: 1; height: 72px; }
body.artifact-resizing, body.artifact-resizing * { cursor: col-resize !important; user-select: none; }
body.artifact-resizing .artifact { transition: none; }

/* Botão "voltar ao chat" (aparece no modo tela cheia) */
.artifact [data-artifact-action="chat"] { display: none; }
.artifact.full [data-artifact-action="chat"] { display: inline-flex; }

/* Tablet: o painel se comporta como tela cheia */
@media (max-width: 1023px) {
  .artifact.open { flex-basis: 100%; }
  body.artifact-open .chat-area { flex: 0 0 0px; opacity: 0; pointer-events: none; overflow: hidden; }
  .artifact-resizer, #artifactExpand { display: none !important; }
  .artifact [data-artifact-action="chat"] { display: inline-flex; }
}

/* Mobile: tela deslizante por cima do chat */
@media (max-width: 767px) {
  .artifact {
    position: absolute; inset: 0; z-index: 25; flex: none; width: 100%;
    transform: translateX(100%); transition: transform .45s var(--ease-out);
  }
  .artifact.open { transform: none; }
  body.artifact-open .chat-area { opacity: 1; flex: 1 1 0%; }
  .artifact-inner { transform: none; }
}

/* =========================================================
   Cartões de módulo dentro das respostas do Liloo
   ========================================================= */
.mod-card {
  margin-top: 14px; border: 1px solid rgb(0 0 0 / .09); border-radius: 18px; overflow: hidden; background: #fff;
  animation: fade-up .45s var(--ease-out) both;
}
.dark .mod-card { border-color: rgb(255 255 255 / .09); background: rgb(255 255 255 / .03); }
.mod-card-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; font-size: 13px; font-weight: 500;
  border-bottom: 1px solid rgb(0 0 0 / .06);
}
.dark .mod-card-head { border-color: rgb(255 255 255 / .06); }
.mod-card-head .artifact-icon { height: 26px; width: 26px; border-radius: 8px; }
.mod-card-head .open-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; border: 1px solid rgb(0 0 0 / .1); transition: background-color .2s;
}
.mod-card-head .open-btn:hover { background: rgb(0 0 0 / .04); }
.dark .mod-card-head .open-btn { border-color: rgb(255 255 255 / .12); }
.dark .mod-card-head .open-btn:hover { background: rgb(255 255 255 / .06); }

.mod-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; text-align: left;
  transition: background-color .18s;
}
.mod-row + .mod-row { border-top: 1px solid rgb(0 0 0 / .05); }
.dark .mod-row + .mod-row { border-color: rgb(255 255 255 / .05); }
.mod-row:hover { background: rgb(0 0 0 / .03); }
.dark .mod-row:hover { background: rgb(255 255 255 / .04); }
.mod-row .name { font-size: 14px; font-weight: 500; }
.mod-row .preview { font-size: 13px; color: rgb(115 115 115); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dark .mod-row .preview { color: rgb(163 163 163); }
.mod-row .wa-avatar.sm { height: 38px; width: 38px; font-size: 13px; }
.mod-row .wa-avatar.group { background: rgb(0 0 0 / .06); color: rgb(115 115 115); }
.dark .mod-row .wa-avatar.group { background: rgb(255 255 255 / .08); color: rgb(163 163 163); }
.mod-row .badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  font-size: 11px; font-weight: 600; background: rgb(124 58 237); color: #fff;
}

.mod-draft { padding: 12px 14px 14px; }
.mod-draft blockquote {
  margin: 0; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.55;
  background: rgb(139 92 246 / .07); border-left: 3px solid rgb(139 92 246 / .6);
}
.dark .mod-draft blockquote { background: rgb(139 92 246 / .12); }
.mod-draft .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mod-draft .actions .btn { height: 34px; padding: 0 14px; font-size: 13px; }
.mod-draft .sent { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: rgb(22 163 74); }
.dark .mod-draft .sent { color: rgb(74 222 128); }

/* Item de módulo ativo na lateral */
.nav-sub-item.is-open { background: rgb(0 0 0 / .06); color: rgb(23 23 23); font-weight: 500; }
.dark .nav-sub-item.is-open { background: rgb(255 255 255 / .07); color: #fff; }
.nav-sub-item.is-open::after {
  content: ''; margin-left: auto; height: 6px; width: 6px; border-radius: 999px; background: rgb(124 58 237);
  box-shadow: 0 0 0 3px rgb(124 58 237 / .15);
}
