/* ==================================================
   AVISO RÁPIDO (flash)
   Faixa fina no topo da página, ACIMA do header (empurra o header
   um pouco para baixo). Depois de 4 segundos ela recolhe e o
   header sobe de volta. O "X" fecha na hora (assets/js/site.js).

   Uso: só para avisos de passagem ("Login realizado", "Você saiu").
   Erros de formulário (senha errada...) aparecem no próprio formulário.
================================================== */

.flash {
    --flash-cor: #2ECC71;                       /* muda conforme o tipo, lá embaixo */

    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 38px;
    max-height: 80px;
    padding: 7px 52px;                          /* espaço dos lados para o X não cobrir o texto */
    overflow: hidden;
    background: color-mix(in srgb, var(--flash-cor) 13%, #0B1019);
    border-bottom: 1px solid color-mix(in srgb, var(--flash-cor) 35%, transparent);
    color: #E6EAF0;
    font-family: 'Montserrat', system-ui, sans-serif;
    font-size: .84rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;

    /* abre descendo; depois de 4s recolhe */
    animation:
        flash-abre     .35s ease-out,
        flash-recolhe  .4s  ease-in 4s forwards;
}

/* Mouse em cima: pausa o recolher e a barrinha (dá tempo de ler).
   "running, paused" = a abertura continua, só o recolher pausa.
   Só em telas com mouse: no celular o toque podia "travar" o aviso. */
@media (hover: hover) {
    .flash:hover {
        animation-play-state: running, paused;
    }
    .flash:hover .flash-tempo {
        animation-play-state: paused;
    }
}

/* Clicou no X: recolhe rápido (o site.js remove depois) */
.flash.flash-fechando {
    animation: flash-recolhe .25s ease-in forwards;
}

/* ---------- Cores por tipo ---------- */
.flash-sucesso { --flash-cor: #2ECC71; }
.flash-erro    { --flash-cor: #FF5A5F; }
.flash-alerta  { --flash-cor: #FFB020; }

/* ---------- Ícone ---------- */
.flash-icone {
    flex: none;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--flash-cor) 22%, transparent);
    color: var(--flash-cor);
}

.flash-icone svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Texto ---------- */
.flash-texto {
    margin: 0;
}

/* ---------- Botão fechar (preso no canto direito) ---------- */
.flash-fechar {
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8B95A5;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color .2s ease, color .2s ease;
}

.flash-fechar svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.flash-fechar:hover {
    background: rgba(255, 255, 255, .08);
    color: #FFFFFF;
}

.flash-fechar:focus-visible {
    outline: 2px solid #F4F6FA;
    outline-offset: 1px;
}

/* ---------- Barrinha do tempo (encolhe em 4s) ---------- */
.flash-tempo {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--flash-cor);
    transform-origin: left;
    animation: flash-tempo 4s linear forwards;
}

/* ---------- Animações ---------- */
@keyframes flash-abre {
    from { max-height: 0; min-height: 0; padding-block: 0; opacity: 0; }
}

@keyframes flash-recolhe {
    to {
        max-height: 0;
        min-height: 0;
        padding-block: 0;
        border-bottom-width: 0;
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes flash-tempo {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}

/* ---------- Celular ---------- */
@media (max-width: 560px) {
    .flash {
        padding: 7px 44px 7px 14px;
        justify-content: flex-start;
        text-align: left;
        font-size: .78rem;
    }
    .flash-fechar {
        right: 8px;
    }
}

/* Quem pediu "menos movimento" no sistema: sem deslizar, só some no tempo */
@media (prefers-reduced-motion: reduce) {
    .flash,
    .flash.flash-fechando {
        animation: flash-recolhe 0s linear 4s forwards;
    }
    .flash.flash-fechando {
        animation-delay: 0s;
    }
}
