/* ============================================================
   Cafezinho — assistente em áudio (balão + FAB + modal)
   Clone visual do Nelo (Pecuária 360) com os tokens do Café.
   ============================================================ */

/* ---------- Balão flutuante ---------- */

.cafezinho-balao {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 84px; /* acima da bottom nav */
    z-index: 9500;
    background: var(--branco, #fff);
    border: 1.5px solid var(--dourado-suave, #E2CFA0);
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
    padding: 14px 14px 12px 74px;
    animation: cafezinho-entrar 0.28s ease-out;
    max-width: 480px;
    margin: 0 auto;
}

@keyframes cafezinho-entrar {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cafezinho-balao--saindo {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.cafezinho-balao__avatar {
    position: absolute;
    left: 10px;
    top: -18px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bege-papel, #FAF6EB) url('../images/cafezinho.png') center/cover no-repeat;
    border: 2.5px solid var(--dourado, #C8A24B);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.cafezinho-balao--falando .cafezinho-balao__avatar {
    animation: cafezinho-balanco 1.1s ease-in-out infinite;
}

@keyframes cafezinho-balanco {
    0%, 100% { transform: rotate(-3deg); }
    50%      { transform: rotate(3deg); }
}

.cafezinho-balao__cabecalho {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.cafezinho-balao__nome {
    flex: 1;
    font-weight: 800;
    color: var(--verde-escuro, #3E5638);
    font-size: 14px;
    letter-spacing: 0.02em;
}

.cafezinho-balao__config,
.cafezinho-balao__fechar {
    background: none;
    border: none;
    color: var(--texto-claro, #999);
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

.cafezinho-balao__config {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--verde-medio, #5a7a4e);
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.cafezinho-balao__config:active { transform: rotate(40deg); opacity: 1; }
.cafezinho-balao__fechar { font-size: 22px; }

.cafezinho-balao__legenda {
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--texto-principal, #333);
    max-height: 130px;
    overflow-y: auto;
}

.cafezinho-balao__progresso {
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.08);
    margin: 10px 0 8px;
    overflow: hidden;
}

.cafezinho-balao__progresso-barra {
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: var(--dourado, #C8A24B);
    transition: width 0.25s linear;
}

.cafezinho-balao__controles {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.cafezinho-balao__botao {
    border: none;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    background: var(--verde-escuro, #3E5638);
    color: #fff;
}

.cafezinho-balao__botao--secundario {
    background: var(--bege-papel, #F3EDDE);
    color: var(--verde-escuro, #3E5638);
}

/* ---------- FAB (ícone flutuante pra chamar o Cafezinho) ---------- */

.cafezinho-fab {
    position: fixed;
    right: 14px;
    bottom: 150px; /* acima do FAB padrão das telas (+) e da nav */
    z-index: 9400;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2.5px solid var(--dourado, #C8A24B);
    background: var(--bege-papel, #FAF6EB) url('../images/cafezinho.png') center/cover no-repeat;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    padding: 0;
}

.cafezinho-fab--pulsando {
    animation: cafezinho-pulso 2s ease-in-out infinite;
}

@keyframes cafezinho-pulso {
    0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28); transform: scale(1); }
    50%      { box-shadow: 0 4px 20px rgba(200, 162, 75, 0.55); transform: scale(1.06); }
}

.cafezinho-fab--escondido { display: none; }

/* Zona de fechar (estilo bolha do YouTube): aparece na base enquanto a
   bolha é arrastada; soltar nela guarda o Cafezinho (oculta + silencia). */
.cafezinho-drop {
    position: fixed;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%) scale(0.6);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.78);
    color: #fff;
    font-size: 26px;
    line-height: 64px;
    text-align: center;
    z-index: 9450;
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s ease;
    pointer-events: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.cafezinho-drop--ativa {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.cafezinho-drop--alvo {
    background: #C62828;
    transform: translateX(-50%) scale(1.25);
}

/* ---------- Modal de boas-vindas ---------- */

.cafezinho-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9600;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: cafezinho-fade 0.25s ease-out;
}

@keyframes cafezinho-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cafezinho-modal {
    background: var(--branco, #fff);
    border-radius: 18px;
    padding: 64px 20px 20px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.cafezinho-modal__avatar {
    position: absolute;
    top: -44px;
    left: 50%;
    transform: translateX(-50%);
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: var(--bege-papel, #FAF6EB) url('../images/cafezinho.png') center/cover no-repeat;
    border: 3px solid var(--dourado, #C8A24B);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.cafezinho-modal__titulo {
    color: var(--verde-escuro, #3E5638);
    font-size: 19px;
    margin: 0 0 8px;
}

.cafezinho-modal__texto {
    font-size: 14px;
    line-height: 1.5;
    color: var(--texto-secundario, #666);
    margin: 0 0 18px;
}

.cafezinho-modal__acoes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cafezinho-modal__botao {
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
}

.cafezinho-modal__botao--primario {
    background: var(--verde-escuro, #3E5638);
    color: #fff;
}

.cafezinho-modal__botao--secundario {
    background: var(--bege-papel, #F3EDDE);
    color: var(--verde-escuro, #3E5638);
}

.cafezinho-modal__botao--terciario {
    background: none;
    color: var(--texto-claro, #999);
    font-weight: 600;
}

/* ---------- Dark mode (tokens já mudam; ajustes pontuais) ---------- */

body.dark .cafezinho-balao,
body.dark .cafezinho-modal {
    background: var(--fundo-card, #2a2a26);
}

body.dark .cafezinho-balao__progresso {
    background: rgba(255, 255, 255, 0.12);
}
