/* =========================================================
   STAR — Chat (mensagens diretas, estilo Direct)
   Usa as mesmas cores, fonte e cantos do resto do app (variáveis de style.css).
   ========================================================= */

/* ---------- Caixa de entrada ---------- */
.chat-page .page-head { margin-bottom: 16px; }
.chat-search { margin: 0 0 18px; }
.chat-search .input-icon { min-height: 48px; border-radius: 999px; background: var(--bg-soft); border-color: var(--line-2); padding: 0 16px; gap: 10px; }
.chat-search .input-icon > .icon { width: 20px; height: 20px; }
.chat-search .input-icon input { height: 46px; font-size: 1rem; }
.chat-search input::-webkit-search-cancel-button { cursor: pointer; }
.chat-section-title { font-size: .95rem; font-weight: 600; color: var(--ink); margin: 6px 0 10px; }
.chat-none { margin: 4px 0 16px; }

/* Atalhos: pessoas que você segue, em fila que rola para o lado */
.chat-people { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 18px; padding: 2px 16px 4px; }
.chat-people::-webkit-scrollbar { display: none; }
.chat-people a { flex: none; width: 66px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .74rem; color: var(--text); text-align: center; }
.chat-people .avatar { width: 62px; height: 62px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue-100); }
.chat-people span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-list { list-style: none; margin: 0 -10px; padding: 0; }
.chat-list a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; transition: background .15s; }
.chat-list a:hover { background: var(--bg-soft); }
.chat-list a:active { background: var(--line-2); }
.chat-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item-text strong { font-weight: 500; color: var(--ink); display: flex; align-items: center; min-width: 0; }
.chat-item-text strong .verified-star { width: 15px; height: 15px; margin-left: 4px; }
.chat-item-last { display: flex; min-width: 0; color: var(--muted); font-size: .85rem; white-space: nowrap; gap: 4px; }
.chat-item-preview { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chat-list a.is-unread strong { font-weight: 600; }
.chat-list a.is-unread .chat-item-last { color: var(--ink); font-weight: 500; }
.chat-unread { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.chat-people-list .btn { flex: none; }

.chat-empty { text-align: center; padding: 34px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.chat-empty h2 { font-size: 1.15rem; }
.chat-empty .empty-icon { width: 54px; height: 54px; padding: 12px; border-radius: 50%; border: 2px solid var(--ink); color: var(--ink); }

/* Pontinho de mensagem não lida no item "Chat" da barra inferior */
.bottom-nav a.has-dot { position: relative; }
.bottom-nav a.has-dot::after { content: ""; position: absolute; top: 9px; left: calc(50% + 7px); width: 10px; height: 10px; border-radius: 50%; background: #ff3b5c; border: 2px solid #fff; }
body.theme-dark .bottom-nav a.has-dot::after { border-color: #0d1322; }

/* Perfil: Seguir + Mensagem */
.profile-cta { display: flex; flex-direction: column; gap: 8px; flex: none; }
.profile-id .profile-cta .btn-outline-blue { margin-top: 0; }
.profile-cta .btn-message .icon { width: 18px; height: 18px; }
.profile-cta .btn-message { gap: 6px; }

/* ---------- Conversa (tela cheia, por cima do topo e da barra inferior) ---------- */
body:has(.chat-thread) { overflow: hidden; }
.chat-thread {
  position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 45;
  width: 100%; max-width: var(--shell); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; background: #fff;
  box-shadow: 0 0 0 1px var(--line-2);
}
.chat-head {
  flex: none; display: flex; align-items: center; gap: 4px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px 6px; border-bottom: 1px solid var(--line-2); background: #fff;
}
.chat-head .icon-btn .icon { width: 26px; height: 26px; }
.chat-head-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.chat-head-user span { min-width: 0; display: flex; flex-direction: column; }
.chat-head-user strong { font-weight: 600; color: var(--ink); display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-user strong .verified-star { width: 15px; height: 15px; margin-left: 4px; }
.chat-head-user small { color: var(--muted); font-size: .78rem; }

.chat-msgs {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 8px;
}
.chat-intro { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 18px 10px 26px; margin-top: auto; }
.chat-intro strong { font-size: 1.1rem; color: var(--ink); font-weight: 600; }
.chat-intro .btn { margin-top: 6px; }

.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; align-self: flex-start; }
.msg-mine { align-self: flex-end; align-items: flex-end; }
.msg-bubble {
  padding: 9px 14px; border-radius: 20px; background: var(--bg-soft); border: 1px solid var(--line-2);
  color: var(--text); font-size: .95rem; line-height: 1.4; overflow-wrap: anywhere; max-width: 100%;
}
.msg-mine .msg-bubble { background: linear-gradient(145deg, #3b82ff, #1a5fd6); border-color: transparent; color: #fff; }
.msg-bubble a { text-decoration: underline; color: inherit; }
.msg-theirs .msg-bubble a { color: var(--blue-600); }
.msg-bubble.has-media { padding: 4px; }
.msg-bubble.has-media p { padding: 6px 10px 5px; }
.msg-bubble.only-media { padding: 0; background: none; border: 0; }
.msg-photo { display: block; text-decoration: none; }
.msg-photo img, .msg-video { display: block; max-width: 100%; max-height: 340px; border-radius: 16px; background: var(--line-2); }
.msg-photo img { min-width: 80px; min-height: 80px; object-fit: cover; cursor: zoom-in; }
.msg-video { width: 260px; background: #000; }
.msg time { font-size: .68rem; color: var(--muted-2); margin: 3px 8px 8px; }
.msg.is-sending { opacity: .6; }
.msg.is-sending time::after { content: " · enviando…"; }
.chat-seen { align-self: flex-end; font-size: .72rem; color: var(--muted); margin: -4px 8px 6px; }

/* Barra de escrever (câmera · texto · galeria · enviar) */
.chat-composer { flex: none; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); background: #fff; margin: 0; }
.chat-bar { display: flex; align-items: flex-end; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 26px; background: var(--bg-soft); }
.chat-bar textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none;
  padding: 9px 4px; font-size: 1rem; line-height: 1.35; max-height: 120px; color: var(--text);
}
.chat-cam, .chat-tool, .chat-send { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat-cam { color: #fff; background: linear-gradient(145deg, #3b82ff, #1a5fd6); box-shadow: 0 4px 12px rgba(31, 111, 235, .35); }
.chat-cam .icon { width: 22px; height: 22px; }
.chat-tool { color: var(--ink); }
.chat-tool .icon { width: 24px; height: 24px; }
.chat-cam:active, .chat-tool:active, .chat-send:active { transform: scale(.92); }
.chat-send { color: var(--blue); }
.chat-send .icon { width: 24px; height: 24px; stroke-width: 2; }
.chat-send:disabled { opacity: .35; cursor: default; }

.chat-attach { position: relative; display: inline-block; margin: 0 0 8px 4px; }
.chat-attach-preview img, .chat-attach-preview video { display: block; width: 84px; height: 84px; object-fit: cover; border-radius: 14px; background: var(--line-2); }
.chat-attach-remove {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.chat-attach-remove .icon { width: 14px; height: 14px; stroke-width: 2.6; }

/* O aviso (toast) aparece por cima da conversa */
body:has(.chat-thread) .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
