/* =====================================================================
   11 — Ajustes finais (bottom nav centralizado, spacing mobile, avatar,
   pulse story/memórias, nome animado em comentários, PNG placeholders).
   Este arquivo é carregado por último pra ganhar dos outros.
   ===================================================================== */

/* ---------------------------------------------------------------
   1) BOTTOM NAV — botão "+" flutuando ACIMA do footer no celular.
   Ele sai do fluxo e não cobre Bazar/Mensagens.
   --------------------------------------------------------------- */
@media (max-width: 900px) {
    .bottom-nav {
        position: fixed !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-end !important;
        justify-content: space-between !important;
        min-height: calc(68px + env(safe-area-inset-bottom)) !important;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom)) !important;
        overflow: visible !important;
    }
    .bottom-nav .nav-item {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }
    .bottom-nav .nav-item-create {
        position: absolute !important;
        left: 50% !important;
        bottom: calc(54px + env(safe-area-inset-bottom)) !important;
        transform: translateX(-50%) !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
        width: 66px !important;
        height: 66px !important;
        padding: 0 !important;
        z-index: 8;
        pointer-events: auto;
    }
    .bottom-nav .nav-item-create .create-circle {
        width: 62px !important; height: 62px !important;
        border: 1px solid rgba(255,255,255,0.22);
        box-shadow: 0 14px 30px rgba(59,130,246,0.45), 0 0 0 8px rgba(13,11,20,0.74);
    }
    .bottom-nav .nav-item:nth-child(3),
    .bottom-nav .nav-item:nth-child(5) { max-width: none !important; }
    .bottom-nav .nav-item:nth-child(4) { visibility: visible; }
    .bottom-nav .nav-item-create > span:not(.create-circle) { display: none; }
    .app-main.with-nav { padding-bottom: 128px !important; }
}

/* Editar perfil: título ao lado da foto no mobile, sem ficar atrás do avatar. */
.edit-profile-head {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center !important;
    gap: 16px !important;
    margin-bottom: 4px;
}
.edit-profile-title-box {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.edit-profile-title-box h1 {
    margin: 0 !important;
    line-height: 1.1;
    overflow-wrap: anywhere;
}
.edit-profile-title-box .upload-box.small {
    min-height: 38px;
    padding: 9px 16px !important;
}
@media (max-width: 420px) {
    .edit-profile-head { gap: 14px !important; }
    .edit-profile-head .profile-avatar {
        width: 88px !important;
        height: 88px !important;
    }
    .edit-profile-title-box h1 { font-size: 19px; }
}

/* ---------------------------------------------------------------
   2) PERFIL MOBILE — respirar nas laterais (não encostar na parede)
   --------------------------------------------------------------- */
@media (max-width: 900px) {
    .profile-page,
    .profile-v3 {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
    .profile-hero { margin-left: 0 !important; margin-right: 0 !important; }
    .profile-me-actions,
    .profile-stats,
    .profile-stats-v3,
    .profile-buttons {
        margin-left: 4px !important;
        margin-right: 4px !important;
        padding-left: 8px;
        padding-right: 8px;
        box-sizing: border-box;
    }
    /* stories/memórias não encostam */
    .stories-bar,
    .memories-bar {
        padding-left: 10px !important;
        padding-right: 10px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ---------------------------------------------------------------
   3) "Editar perfil" mobile — nome do botão fica ATRÁS da foto de perfil.
   Ajusta pra ficar do lado (empilha os dois botões com gap).
   --------------------------------------------------------------- */
.profile-me-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 2;
    margin-top: 14px;
}
.profile-me-actions .btn-secondary.full {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}
@media (max-width: 600px) {
    .profile-me-actions {
        flex-direction: column;
        margin-top: 18px;
    }
    .profile-me-actions .btn-secondary.full {
        font-size: 14px;
        padding: 13px 14px;
    }
}

/* ---------------------------------------------------------------
   4) FOTO DE PERFIL — mobile parece "achatada" (ovalada).
   Força proporção 1:1 e desliga qualquer flex-shrink.
   --------------------------------------------------------------- */
.profile-avatar,
.profile-hero .profile-avatar,
.profile-v3 .profile-avatar {
    aspect-ratio: 1 / 1 !important;
    width: 96px !important;
    height: 96px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    flex-shrink: 0 !important;
    display: block;
}
.profile-avatar-wrap-lg,
.profile-hero .profile-avatar-wrap {
    aspect-ratio: 1 / 1 !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}
.profile-avatar-wrap-lg .profile-avatar {
    width: 104px !important;
    height: 104px !important;
}
@media (max-width: 600px) {
    .profile-avatar-wrap-lg .profile-avatar {
        width: 88px !important;
        height: 88px !important;
    }
}

/* ---------------------------------------------------------------
   5) STORY / MEMÓRIAS — linha "cortando" durante o pulse
   Origem: o <img> tem border sólida do bg contra o ring pulsante.
   Solução: substitui border por padding+background sólido do bg,
   e desativa o filter drop-shadow durante a escala.
   --------------------------------------------------------------- */
.story-ring,
.memory-ring {
    box-shadow: 0 0 0 0 rgba(0,0,0,0);
    animation: storyPulse 2.6s ease-in-out infinite !important;
    will-change: transform, box-shadow;
    overflow: visible;
}
.story-ring img,
.memory-ring img {
    border: none !important;
    box-shadow: 0 0 0 2px var(--bg) inset;
}
.story-ring-add,
.story-ring-add.memory-ring {
    animation: none !important;
}
@keyframes storyPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(236,72,153,0.0),
                    0 0 12px rgba(124,58,237,0.35);
    }
    50% {
        transform: scale(1.045);
        box-shadow: 0 0 0 3px rgba(236,72,153,0.15),
                    0 0 22px rgba(124,58,237,0.75);
    }
}

/* ---------------------------------------------------------------
   6) NOME COLORIDO/ANIMADO em COMENTÁRIOS e RESPOSTAS
   Reforça a especificidade pra vencer .comment-item strong.
   --------------------------------------------------------------- */
.comment-item .uname,
.comment-item strong .uname,
.comment-reply .uname,
.chat-bubble .uname,
.chat-header-user .uname {
    display: inline-block !important;
    line-height: 1.2;
}
.comment-item .uname-fx-gradiente,
.comment-reply .uname-fx-gradiente,
.chat-bubble .uname-fx-gradiente {
    background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--gold)) !important;
    background-size: 250% auto !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    animation: shine 4s linear infinite !important;
}
.comment-item .uname-fx-arcoiris,
.comment-reply .uname-fx-arcoiris,
.chat-bubble .uname-fx-arcoiris {
    background: linear-gradient(90deg, #f87171, #fb923c, #f5d90a, #34d399, #38bdf8, #a855f7, #f87171) !important;
    background-size: 300% auto !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
    animation: rainbowMove 3s linear infinite !important;
}
.comment-item .uname-fx-brilho,
.comment-reply .uname-fx-brilho,
.chat-bubble .uname-fx-brilho {
    color: #38bdf8 !important;
    animation: nameGlow 1.8s ease-in-out infinite !important;
}
.comment-item .uname-fx-fogo,
.comment-reply .uname-fx-fogo,
.chat-bubble .uname-fx-fogo {
    color: #fb923c !important;
    animation: nameFire 1.1s ease-in-out infinite !important;
}

/* ---------------------------------------------------------------
   7) PNG placeholders — categorias do bazar, temas, cores e efeitos
   Coloque as imagens em assets/img/ conforme AJUSTES.md.
   --------------------------------------------------------------- */
.cat-icon-img,
.theme-icon-img,
.color-icon-img,
.effect-icon-img,
.mood-icon-img {
    display: inline-block;
    vertical-align: middle;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}
.cat-icon-img   { width: 22px; height: 22px; margin-right: 4px; }
.theme-icon-img { width: 40px; height: 40px; margin-bottom: 4px; }
.color-icon-img { width: 28px; height: 28px; border-radius: 50%; }
.effect-icon-img{ width: 34px; height: 34px; }

/* ---------------------------------------------------------------
   8) CHAT — indicador "digitando", "online agora" e mensagem apagada
   --------------------------------------------------------------- */
.chat-online-dot {
    display: inline-block;
    width: 9px; height: 9px; border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16,185,129,0.7);
    margin-left: 6px;
    vertical-align: middle;
    animation: onlinePulse 1.6s ease-in-out infinite;
}
@keyframes onlinePulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
    50%     { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.chat-online-label {
    font-size: 11px; color: #10b981; font-weight: 600;
    margin-left: 6px; letter-spacing: .3px;
}

.chat-typing-bubble {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.10);
    padding: 10px 14px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 4px 12px;
    font-size: 12px;
    color: var(--text);
    min-height: 34px;
    min-width: 54px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.22);
}
.chat-typing-bubble .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
    animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing-bubble .dot:nth-child(2) { animation-delay: .15s; }
.chat-typing-bubble .dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
    0%,60%,100% { transform: translateY(0); opacity: .5; }
    30%         { transform: translateY(-4px); opacity: 1; }
}

.chat-bubble.deleted .wz-msg-body {
    font-style: italic;
    opacity: .65;
    background: transparent !important;
    border: 1px dashed rgba(255,255,255,0.18);
    padding: 8px 12px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.chat-bubble.deleted .wz-msg-body::before {
    content: "🚫";
    font-size: 12px;
    filter: grayscale(1);
}
.chat-bubble .wz-msg-body { position: relative; }
.chat-msg-delete-btn {
    position: absolute;
    top: -10px;
    right: -6px;
    width: 24px; height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
    display: flex; align-items: center; justify-content: center;
}
.chat-bubble.mine:hover .chat-msg-delete-btn,
.chat-bubble.mine .wz-msg-body:hover .chat-msg-delete-btn { opacity: 1; }
@media (max-width: 900px) {
    .chat-msg-delete-btn { display: none !important; }
}

.chat-header-name-wrap {
    min-width: 0;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 2px !important;
}
.chat-header-status {
    min-height: 15px;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
}
.chat-typing-status {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: #38bdf8;
}
.chat-typing-status i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    animation: typingBounce 1.2s ease-in-out infinite;
}
.chat-typing-status i:nth-child(3) { animation-delay: .15s; }
.chat-typing-status i:nth-child(4) { animation-delay: .3s; }

.chat-action-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 18px;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0);
    transition: background .18s ease, backdrop-filter .18s ease;
}
.chat-action-overlay.open {
    background: rgba(0,0,0,0.54);
    backdrop-filter: blur(8px);
}
.chat-action-sheet {
    width: min(100%, 420px);
    transform: translateY(18px);
    opacity: 0;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(30,27,43,0.98), rgba(16,14,24,0.98));
    box-shadow: 0 22px 60px rgba(0,0,0,0.48);
    padding: 10px;
    transition: transform .2s ease, opacity .2s ease;
}
.chat-action-overlay.open .chat-action-sheet {
    transform: translateY(0);
    opacity: 1;
}
.chat-action-handle {
    width: 38px;
    height: 4px;
    border-radius: 999px;
    margin: 4px auto 10px;
    background: rgba(255,255,255,0.22);
}
.chat-action-sheet h3 {
    margin: 0 8px 10px;
    font-size: 15px;
}
.chat-action-option,
.chat-action-cancel,
.chat-edit-save {
    width: 100%;
    border: 0;
    color: var(--text);
    font: inherit;
}
.chat-action-option {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    text-align: left;
    margin-bottom: 8px;
}
.chat-action-option:disabled {
    opacity: .45;
}
.chat-action-option.danger { color: #fda4af; }
.chat-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.08);
}
.chat-action-option b,
.chat-action-option small {
    display: block;
    min-width: 0;
}
.chat-action-option b { font-size: 14px; }
.chat-action-option small {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}
.chat-action-cancel,
.chat-edit-save {
    min-height: 44px;
    border-radius: 15px;
    background: rgba(255,255,255,0.08);
    font-weight: 700;
}
.chat-edit-textarea {
    width: 100%;
    min-height: 104px;
    resize: none;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    background: rgba(0,0,0,0.22);
    color: var(--text);
    padding: 12px;
    outline: none;
    font-size: 15px;
}
.chat-edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}
.chat-edit-save {
    background: var(--gradient);
    color: #fff;
}
