/* ── Component: Chat compose box, file attachments, mentions, drop zone ──
 * Class prefix: compose-
 */

/* ══════════════════════════════════════════════
   Rich Compose Box
══════════════════════════════════════════════ */
.compose {
  background: rgba(20,21,31,1);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
  position: relative;
}
.compose:focus-within {
  border-color: rgba(var(--agent-color-rgb, 124,111,247), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--agent-color-rgb, 124,111,247), 0.07), 0 8px 32px rgba(0,0,0,.35);
}

/* DROP ZONE overlay — shown when dragging */
.drop-overlay {
  position: absolute; inset: 0; z-index: 100;
  border-radius: 18px;
  background: rgba(10, 11, 18, 0.88);
  border: 2px dashed rgba(var(--agent-color-rgb, 124,111,247), 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  backdrop-filter: blur(2px);
}
.drop-overlay.active { display: flex; }
.drop-overlay svg { opacity: .5; }
.drop-label { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: #fff; opacity: .6; }
.drop-sub { font-size: 12px; color: var(--color-text-secondary); }

/* Attachments preview strip */
.compose .attachments {
  display: flex;
  gap: 8px;
  padding: 10px 14px 0;
  flex-wrap: wrap;
  min-height: 0;
  transition: all .2s;
}
.compose .attachments:empty { display: none; }

/* attachment thumbnail */
.att {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(26,27,40,1);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: default;
  animation: attIn .2s ease;
}
@keyframes attIn {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* image attachment */
.att.img-att {
  width: 70px; height: 70px;
}
.att.img-att img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* doc attachment */
.att.doc-att {
  padding: 8px 10px;
  gap: 7px;
  max-width: 180px;
}
.doc-icon { font-size: 20px; flex-shrink: 0; }
.doc-info { min-width: 0; }
.doc-name {
  font-size: 11px; font-weight: 600; color: var(--color-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-meta { font-size: 9px; color: var(--color-text-secondary); margin-top: 1px; }

/* VIDEO attachment */
.att.video-att {
  padding: 0;
  width: 120px; height: 72px;
  position: relative;
}
.att.video-att .video-thumb {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1a0a3a, #0a1a2e);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.att.video-att .video-duration {
  position: absolute; bottom: 4px; right: 5px;
  font-size: 9px; font-weight: 600; color: white;
  background: rgba(0,0,0,.65); padding: 1px 5px; border-radius: 3px;
}
.att.video-att .yt-badge {
  position: absolute; top: 4px; left: 4px;
  background: #FF0000;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 9px; font-weight: 700; color: white;
  display: flex; align-items: center; gap: 3px;
}

/* remove button on attachment */
.att-remove {
  position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,.75);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 10px; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.att:hover .att-remove { opacity: 1; }

/* YouTube post options — appears when video attached */
.yt-options {
  margin: 8px 14px 0;
  padding: 10px 12px;
  background: rgba(255,0,0,.06);
  border: 1px solid rgba(255,0,0,.15);
  border-radius: 10px;
  display: none;
  gap: 10px;
  align-items: center;
  animation: attIn .2s ease;
}
.yt-options.visible { display: flex; }
.yt-icon { font-size: 18px; flex-shrink: 0; }
.yt-label { font-size: 11px; font-weight: 600; color: var(--color-text-primary); flex: 1; }
.yt-sub { font-size: 10px; color: var(--color-text-secondary); margin-top: 1px; }
.yt-toggle {
  display: flex; gap: 4px;
}
.yt-opt {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(26,27,40,1);
  font-size: 10px; font-weight: 600; color: var(--color-text-secondary);
  cursor: pointer; transition: all .12s;
  font-family: 'DM Sans', 'Inter', sans-serif;
}
.yt-opt.active {
  background: rgba(255,0,0,.12);
  border-color: rgba(255,0,0,.3);
  color: #f87171;
}

/* Text area */
.compose-input-row {
  display: flex;
  align-items: flex-end;
  padding: 10px 10px 10px 14px;
  gap: 8px;
}
.compose-textarea {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  font-family: 'DM Sans', 'Inter', sans-serif;
  font-size: 14px; color: var(--color-text-primary);
  line-height: 1.6;
  resize: none;
  min-height: 24px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px 0;
}
.compose-textarea::placeholder { color: var(--color-text-muted); }
.compose-textarea::-webkit-scrollbar { width: 3px; }
.compose-textarea::-webkit-scrollbar-thumb { background: rgba(32,34,58,1); border-radius: 2px; }

/* Action buttons row */
.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.action-left { display: flex; gap: 2px; align-items: center; }
.action-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-secondary);
  transition: all .15s;
  position: relative;
}
.action-btn:hover { background: rgba(26,27,40,1); color: var(--color-text-primary); }
.action-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.action-btn .tooltip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: rgba(32,34,58,1); border: 1px solid rgba(255,255,255,0.12);
  padding: 4px 8px; border-radius: 6px;
  font-size: 10px; color: var(--color-text-primary); white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.action-btn:hover .tooltip { opacity: 1; }

/* send button */
.compose .send-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--agent-color, #7C6FF7);
  border: none; border-radius: 10px;
  font-family: 'Syne', sans-serif;
  font-size: 12px; font-weight: 700; color: white;
  cursor: pointer;
  transition: all .15s;
}
.compose .send-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.compose .send-btn:active { transform: translateY(0); }
.compose .send-btn:disabled { opacity: 0.4; cursor: default; transform: none; filter: none; }
.compose .send-btn svg { width: 13px; height: 13px; stroke: white; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.compose .send-btn.has-video {
  background: linear-gradient(135deg, var(--agent-color, #7c6ff7), #e53e3e);
}

/* stop button (replaces send while streaming) */
.compose .send-btn.send-btn--stop {
  background: #ef4444;
  animation: stop-pulse 2s ease-in-out infinite;
}
.compose .send-btn.send-btn--stop:hover { filter: brightness(1.15); }
.compose .send-btn.send-btn--stop:disabled { opacity: 0.4; animation: none; }
.compose .send-btn.send-btn--stop svg { width: 13px; height: 13px; stroke: none; fill: white; }
@keyframes stop-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* paste hint */
.paste-hint {
  text-align: center;
  font-size: 10px; color: var(--color-text-muted);
  padding: 0 0 8px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.paste-hint kbd {
  background: rgba(26,27,40,1); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px; padding: 1px 6px;
  font-size: 9px; font-family: 'DM Sans', 'Inter', sans-serif; color: var(--color-text-secondary);
}

/* Divider in toolbar */
.compose-divider {
  width: 1px; height: 18px;
  background: rgba(255,255,255,0.06);
  margin: 0 4px;
  align-self: center;
}

/* Compose wrapper — needed so mention dropdown can overflow above compose */
.compose-wrap {
  position: relative;
  flex-shrink: 0;
}

/* ── Mention Autocomplete Dropdown ── */
.mention-dropdown {
  position: fixed;
  background: rgba(20,21,31,1);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
  z-index: 9999;
  display: none;
}
.mention-dropdown.visible { display: block; }
.mention-dropdown::-webkit-scrollbar { width: 4px; }
.mention-dropdown::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .1s;
}
.mention-item:first-child { border-radius: 12px 12px 0 0; }
.mention-item:last-child { border-radius: 0 0 12px 12px; }
.mention-item:only-child { border-radius: 12px; }
.mention-item:hover,
.mention-item.active {
  background: rgba(255,255,255,0.06);
}

.mention-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.mention-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.mention-role {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-left: auto;
}

/* ── Dictation (speech-to-text) button ── */
.dictate-btn.dictate-active {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
  animation: dictate-pulse 1.5s ease-in-out infinite;
}
@keyframes dictate-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.3); }
  50%      { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* Mobile overrides */
@media (max-width: 480px) {
  .action-btn { width: 36px; height: 36px; }
  .compose .send-btn { padding: 8px 12px; }
  .compose-textarea { font-size: 16px; }
  .paste-hint { display: none; }
}
