/* Notificação toast - GLOBAL (estilo Dynamic Island) */

:root {
    --ilha-topo: 56px;
    --ilha-altura: 42px;
    --ilha-fundo: #111;
    --ilha-texto: #f3f3f3;
    --ilha-mola: cubic-bezier(.34, 1.25, .64, 1);
    --ilha-recolher: cubic-bezier(.6, 0, .3, 1);
}

.bth-ilha {
    position: fixed;
    top: var(--ilha-topo);
    left: 50%;
    z-index: 2000; /* acima das modais do Bootstrap (1055) */
    width: var(--ilha-altura);
    height: var(--ilha-altura);
    border-radius: calc(var(--ilha-altura) / 2);
    background: var(--ilha-fundo);
    color: var(--ilha-texto);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-50%) scale(.3);
    pointer-events: none;
    /*box-shadow: 0 8px 24px rgba(0, 0, 0, .18);*/
    box-shadow: var(--ilha-sombra, 0 8px 24px rgba(0, 0, 0, .18));
    font-family: 'Open Sans', sans-serif;
    transition: transform 260ms var(--ilha-mola), opacity 160ms ease, width 440ms var(--ilha-mola), height 440ms var(--ilha-mola);
}

    .bth-ilha.is-visivel {
        opacity: 1;
        transform: translateX(-50%) scale(1);
        pointer-events: auto;
    }

    .bth-ilha.is-recolhendo {
        transition: transform 220ms cubic-bezier(.5, 0, .75, 0), opacity 200ms ease, width 320ms var(--ilha-recolher), height 320ms var(--ilha-recolher);
    }

    .bth-ilha.sem-transicao,
    .bth-ilha.sem-transicao * {
        transition: none !important;
    }

/* Cor por tipo */
.bth-ilha--success {
    --ilha-cor: #22c55e;
}

.bth-ilha--warning {
    --ilha-cor: #f59e0b;
}

.bth-ilha--error {
    --ilha-cor: #ef4444;
}

.bth-ilha--info {
    --ilha-cor: #3761FA;
}

/* Tema claro */
.bth-ilha.bth-ilha--light {
    --ilha-fundo: #fff;
    --ilha-texto: #1f2937;
    --ilha-sombra: 0 0 0 1px rgba(0, 0, 0, .08), 0 8px 24px rgba(0, 0, 0, .12);
    --ilha-fechar: #6b7280;
    --ilha-fechar-fundo-hover: rgba(0, 0, 0, .06);
    --ilha-fechar-hover: #111;
}

/* Tons mais escuros: os do tema escuro ficam fracos sobre branco */
.bth-ilha--light.bth-ilha--success {
    --ilha-cor: #16a34a;
}

.bth-ilha--light.bth-ilha--warning {
    --ilha-cor: #d97706;
}

.bth-ilha--light.bth-ilha--error {
    --ilha-cor: #dc2626;
}

.bth-ilha--light.bth-ilha--info {
    --ilha-cor: #3761FA;
}

/* Logo no círculo */
.bth-ilha-logo {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    opacity: 0;
    transform: scale(.5);
    pointer-events: none;
    transition: opacity 160ms ease, transform 220ms var(--ilha-mola);
}

    .bth-ilha-logo.is-visivel {
        opacity: 1;
        transform: scale(1);
    }

/* Conteúdo */
.bth-ilha-conteudo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 0 8px 0 12px;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1.35;
    opacity: 0;
    transition: opacity 140ms ease;
}

    .bth-ilha-conteudo.is-visivel {
        opacity: 1;
    }

    .bth-ilha-conteudo.is-multilinha {
        white-space: normal;
        padding-top: 10px;
        padding-bottom: 10px;
    }

.bth-ilha-icone {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    font-size: 20px;
    line-height: 1;
    color: var(--ilha-cor);
}

    .bth-ilha-icone.is-pop {
        animation: bthIlhaPop 340ms ease-out;
    }

.bth-ilha-mensagem {
    flex: 1 1 auto;
    min-width: 0;
}

.bth-ilha-fechar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ilha-fechar, #9a9a9a);
    font-size: 14px;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

    .bth-ilha-fechar:hover {
        background: var(--ilha-fechar-fundo-hover, rgba(255, 255, 255, .1));
        color: var(--ilha-fechar-hover, #fff);
    }

    .bth-ilha-fechar:focus-visible {
        outline: 2px solid var(--ilha-cor);
        outline-offset: 1px;
    }

/* Barra de tempo: encolhe em direção ao centro */
.bth-ilha-barra {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 0;
    height: 2px;
    border-radius: 1px;
    background: var(--ilha-cor);
    transform: scaleX(0);
    transform-origin: center;
}

    .bth-ilha-barra.is-correndo {
        animation: bthIlhaBarra var(--ilha-duracao, 4000ms) linear forwards;
    }

@keyframes bthIlhaPop {
    0% {
        transform: scale(.3);
    }

    60% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes bthIlhaBarra {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Movimento reduzido: só fade, sem expansão nem logo */
@media (prefers-reduced-motion: reduce) {
    .bth-ilha,
    .bth-ilha.is-recolhendo {
        transform: translateX(-50%) scale(1);
        transition: opacity 160ms ease !important;
    }

    .bth-ilha-icone.is-pop {
        animation: none;
    }

    .bth-ilha-logo {
        display: none;
    }
}

.bth-ilha-mensagem {
    transition: opacity 130ms ease;
}

.bth-ilha-conteudo.is-trocando .bth-ilha-mensagem {
    opacity: 0;
}


.bth-ilha.bth-ilha--cartao .bth-ilha-conteudo,
.bth-ilha:not(.bth-ilha--cartao) .bth-ilha-cartao {
    display: none;
}

.bth-ilha-cartao {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 12px 14px 14px 12px;
    text-align: left;
    opacity: 0;
    transition: opacity 140ms ease;
}

    .bth-ilha-cartao.is-visivel {
        opacity: 1;
    }

    .bth-ilha-cartao.is-trocando {
        opacity: 0;
    }

    .bth-ilha-cartao.is-clicavel {
        cursor: pointer;
    }

.bth-ilha--cartao.bth-ilha--info {
    --ilha-cor: var(--chat-bolha-minha, #3762fc);
}

    .bth-ilha-cartao [hidden] {
        display: none !important;
    }

.bth-ilha-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(127, 127, 127, .18);
    background: color-mix(in srgb, var(--ilha-cor) 22%, var(--ilha-fundo));
    color: var(--ilha-cor);
    font-size: 20px;
}

    .bth-ilha-avatar img {
        display: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        object-fit: cover;
        background: #fff;
    }

    .bth-ilha-avatar.com-imagem {
        background: transparent;
    }

        .bth-ilha-avatar.com-imagem img {
            display: block;
        }

        .bth-ilha-avatar.com-imagem .bth-ilha-avatar-icone {
            display: none;
        }

    .bth-ilha-avatar.is-pop {
        animation: bthIlhaPop 340ms ease-out;
    }

.bth-ilha-selo {
    position: absolute;
    right: -3px;
    bottom: -3px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ilha-cor);
    color: #fff;
    font-size: 11px;
    box-shadow: 0 0 0 2.5px var(--ilha-fundo);
}

.bth-ilha-cartao-corpo {
    flex: 1 1 auto;
    min-width: 0;
}

.bth-ilha-cartao-topo {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    line-height: 1.35;
}

.bth-ilha-cartao-titulo {
    overflow: hidden;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.bth-ilha-cartao-quando {
    flex-shrink: 0;
    font-size: 11.5px;
    opacity: .55;
}

.bth-ilha-cartao-contador {
    flex-shrink: 0;
    align-self: center;
    min-width: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(127, 127, 127, .25);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
}

    .bth-ilha-cartao-contador.is-pop {
        animation: bthIlhaPop 340ms ease-out;
    }

.bth-ilha-cartao-texto {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
    font-size: 12.5px;
    line-height: 1.4;
    opacity: .78;
    transition: opacity 130ms ease;
}

.bth-ilha-cartao-acao {
    flex-shrink: 0;
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--ilha-texto);
    color: var(--ilha-fundo);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease;
}

    .bth-ilha-cartao-acao:hover {
        opacity: .9;
    }

    .bth-ilha-cartao-acao:active {
        transform: scale(.96);
    }

    .bth-ilha-cartao-acao.is-secundaria {
        background: rgba(127, 127, 127, .22);
        color: var(--ilha-texto);
    }

    .bth-ilha-cartao-acao:focus-visible {
        outline: 2px solid var(--ilha-cor);
        outline-offset: 2px;
    }

.bth-ilha-cartao-fechar {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
}

.bth-ilha-cartao:hover .bth-ilha-cartao-fechar,
.bth-ilha-cartao:focus-within .bth-ilha-cartao-fechar {
    opacity: 1;
}

.bth-ilha--cartao .bth-ilha-barra {
    left: 22px;
    right: 22px;
}

/* SVG próprio no avatar (showToastBoasVindas) e avatar sem o círculo de fundo */
.bth-ilha-avatar-svg {
    display: none;
}

.bth-ilha-avatar.com-svg .bth-ilha-avatar-svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.bth-ilha-avatar.com-svg img,
.bth-ilha-avatar.com-svg .bth-ilha-avatar-icone {
    display: none;
}

.bth-ilha-avatar-svg svg {
    width: 26px;
    height: 26px;
    overflow: visible;
}

.bth-ilha-avatar.sem-fundo {
    background: transparent;
}

    .bth-ilha-avatar.sem-fundo .bth-ilha-avatar-svg svg {
        width: 36px;
        height: 36px;
    }

@media (prefers-reduced-motion: reduce) {
    .bth-ilha-avatar.is-pop,
    .bth-ilha-cartao-contador.is-pop {
        animation: none;
    }
}


.bth-ilha.is-pulsando {
    animation: bthIlhaPulso 900ms ease-out;
}

@keyframes bthIlhaPulso {
    0% {
        box-shadow: var(--ilha-sombra, 0 8px 24px rgba(0, 0, 0, .18)), inset 0 0 0 0 transparent, inset 0 0 0 0 transparent;
    }

    30% {
        box-shadow: var(--ilha-sombra, 0 8px 24px rgba(0, 0, 0, .18)),
                    inset 0 0 22px 2px color-mix(in srgb, var(--ilha-cor) 50%, transparent),
                    inset 0 0 0 1px color-mix(in srgb, var(--ilha-cor) 45%, transparent);
    }

    100% {
        box-shadow: var(--ilha-sombra, 0 8px 24px rgba(0, 0, 0, .18)), inset 0 0 30px 6px transparent, inset 0 0 0 1px transparent;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bth-ilha.is-pulsando {
        animation: none;
    }
}
