/* =====================================================================
   22 — Fixes v10 (Julho/2026)
   - Chat: paleta alinhada com o feed (roxo/rosa, sem azul)
   - Mensagens longas quebram dentro da moldura
   - Confirmação (✓/✓✓) sempre alinhada embaixo, sem colar no texto
   - Dropdown "Trocar foto" (Foto/GIF Premium) no editar-perfil
   - Novo picker de música (busca iTunes) + card iTunes no perfil
   ===================================================================== */

/* ---------- 1) Chat: mesma paleta do feed (roxo/rosa) ---------- */
.chat-body {
    background:
        radial-gradient(ellipse at top, rgba(124, 58, 237, .28) 0%, transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(236, 72, 153, .12) 0%, transparent 60%),
        var(--bg) !important;
}
.chat-header {
    background: linear-gradient(180deg, rgba(13,11,20,.96), rgba(13,11,20,.72)) !important;
    border-bottom: 1px solid var(--border) !important;
    backdrop-filter: blur(14px);
}
.chat-header-name { color: #f5f3ff !important; }
.chat-header .icon-btn,
.chat-header .back-link { color: var(--primary-2) !important; }
.chat-header .icon-btn:hover,
.chat-header .back-link:hover {
    background: rgba(236,72,153,.10) !important;
    color: #fff !important;
}
.chat-side-list,
.chat-side-list-header {
    background: linear-gradient(180deg, rgba(22,19,31,.95), rgba(13,11,20,.95)) !important;
    border-color: var(--border) !important;
}
.conversation-item:hover,
.conversation-item.active {
    background: linear-gradient(90deg, rgba(124,58,237,.18), transparent) !important;
}
.conversation-badge {
    background: var(--gradient) !important;
    color: #fff !important;
}
.chat-bubble.mine,
.wz-msg.mine {
    background: var(--gradient) !important;
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(124,58,237,.35) !important;
}
.chat-bubble.theirs,
.wz-msg.theirs {
    background: var(--card) !important;
    color: #e9e6f5 !important;
    border: 1px solid var(--border) !important;
}
.chat-input-bar {
    background: linear-gradient(180deg, rgba(13,11,20,.85), rgba(13,11,20,.98)) !important;
    border-top: 1px solid var(--border) !important;
}
.chat-input-bar input[type="text"] {
    background: var(--bg-elevated) !important;
    color: #e9e6f5 !important;
    border: 1px solid var(--border) !important;
}
.chat-input-bar input[type="text"]:focus {
    border-color: var(--primary-2) !important;
    box-shadow: 0 0 0 3px rgba(236,72,153,.15) !important;
    outline: none !important;
}
.chat-send-btn {
    background: var(--gradient) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(124,58,237,.38) !important;
}
.chat-audio-btn,
.chat-attach { color: var(--primary-2) !important; }

/* ---------- 2) Mensagens longas ficam dentro da moldura ---------- */
.chat-bubble,
.wz-msg {
    /* garante que palavras enormes tipo "aaaaaaaaa..." quebrem */
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    width: fit-content;
    max-width: 72%;
    min-width: 40px;
}
@media (min-width: 768px) {
    .chat-bubble, .wz-msg { max-width: 60%; }
}
.chat-bubble .wz-msg-body,
.wz-msg .wz-msg-body { min-width: 0; word-break: break-word; overflow-wrap: anywhere; }
.chat-bubble .wz-msg-body p,
.wz-msg .wz-msg-body p { margin: 0; word-break: break-word; overflow-wrap: anywhere; }

/* ---------- 3) Confirmação de leitura sempre embaixo, alinhada à direita ---------- */
.chat-bubble.wz-msg { display: flex !important; flex-direction: column; }
.chat-bubble.wz-msg .wz-msg-status {
    display: inline-flex !important;
    align-self: flex-end;
    margin: 4px 0 -2px 8px;
    opacity: .9;
}
/* No modo texto, dar um respiro do lado esquerdo pra não colar nas letras */
.chat-bubble.wz-msg[data-msg-type="text"] .wz-msg-status { margin-left: 10px; }

/* ---------- 4) Dropdown de foto de perfil (mesmo estilo do cover) ---------- */
.avatar-change-btn {
    background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(236,72,153,.12));
    border: 1px solid var(--border);
    color: #f3f0ff;
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    margin: 6px 0 4px;
    transition: filter .15s ease, transform .15s ease;
}
.avatar-change-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.avatar-change-btn.is-open .cover-menu { display: block; }
.avatar-change-btn .cover-menu[hidden] { display: none !important; }
.avatar-change-btn.is-open .cover-menu[hidden] { display: block !important; }

/* ---------- 5) Novo picker de música ---------- */
.music-picker { display: flex; flex-direction: column; gap: 10px; }
.music-tabs { display: flex; gap: 6px; }
.music-tab {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: #cfc9e0;
    font-size: 12.5px;
    cursor: pointer;
    transition: all .15s ease;
}
.music-tab.active {
    background: var(--gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.music-panel input[type="search"],
.music-panel input[type="text"] {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: #f1eefc;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
}
.music-panel input:focus {
    outline: none;
    border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(236,72,153,.15);
}
.music-search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 6px;
}
.music-search-results:empty { margin: 0; }
.music-loading { color: rgba(203,199,222,.7); font-size: 13px; padding: 8px 4px; }
.music-result {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 10px;
    background: var(--bg-elevated); border: 1px solid var(--border);
    cursor: pointer; text-align: left;
    transition: all .15s ease; color: #f0edfc;
}
.music-result:hover {
    border-color: var(--primary-2);
    background: rgba(236,72,153,.08);
    transform: translateY(-1px);
}
.music-result img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.music-result-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.music-result-info strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-result-info em { font-size: 12px; font-style: normal; color: rgba(203,199,222,.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-result-play { color: var(--primary-2); font-size: 18px; }

.music-selected {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(236,72,153,.10));
    border: 1px solid var(--border);
    border-radius: 14px;
}
.music-selected img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.music-selected-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.music-selected-info strong { font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-selected-info span { font-size: 12.5px; color: rgba(203,199,222,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-selected audio { height: 36px; max-width: 200px; }
.music-clear {
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--border); background: rgba(0,0,0,.25);
    color: #fff; cursor: pointer; font-size: 14px;
}
.music-clear:hover { background: #ef4444; border-color: #ef4444; }

/* ---------- 6) Card da música iTunes no perfil visitado ---------- */
.profile-music-itunes {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; margin: 12px 0;
    background: linear-gradient(135deg, rgba(124,58,237,.15), rgba(236,72,153,.10));
    border: 1px solid var(--border);
    border-radius: 16px;
}
.profile-music-itunes .pm-art {
    width: 56px; height: 56px; border-radius: 12px; object-fit: cover;
    flex-shrink: 0; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.profile-music-itunes .pm-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.profile-music-itunes .pm-track { font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-music-itunes .pm-artist { font-size: 12.5px; color: rgba(203,199,222,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-music-itunes .pm-audio { height: 36px; flex-shrink: 0; max-width: 220px; }
@media (max-width: 480px) {
    .profile-music-itunes { flex-wrap: wrap; }
    .profile-music-itunes .pm-audio { width: 100%; max-width: 100%; }
}
