/* =====================================================================
   animacoes.css — camada de animações das telas do cliente
   (login, agendar, confirmação, histórico, avaliar)
   - Só entra em ação quando o animacoes.js coloca a classe .anim-on no <html>
     (não é colocada se o aparelho pedir "reduzir movimento").
   - Não muda cores, fontes nem layout: só movimento e feedback.
   ===================================================================== */

:root {
    --anim-ease: cubic-bezier(.2, .7, .2, 1);
    --anim-ease-pop: cubic-bezier(.2, 1.5, .4, 1);
    --anim-cor: var(--primary, #000);
    --anim-sucesso: var(--success, rgb(0, 179, 255));
}

/* ---------- Entrada suave ao aparecer na tela ---------- */
.anim-on .anim-reveal {
    opacity: 0;
    transform: translateY(18px);
    animation: none !important;
    transition: opacity .5s ease, transform .55s var(--anim-ease);
    transition-delay: var(--anim-d, 0ms);
}
.anim-on .anim-reveal.anim-in {
    opacity: 1;
    transform: none;
}
/* depois de entrar, a animação antiga da página não roda de novo */
.anim-on .anim-done { animation: none; }

/* ---------- Saída suave ao trocar de tela ---------- */
html.anim-on body { transition: opacity .18s ease; }
html.anim-on.anim-saindo body { opacity: 0; }

/* ---------- Feedback de toque ---------- */
.anim-on span.anim-ripple-box {
    position: absolute;
    inset: 0;
    display: block;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
}
.anim-on span.anim-ripple {
    position: absolute;
    display: block;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: currentColor;
    opacity: .22;
    transform: scale(0);
    animation: anim-ripple .55s ease-out forwards;
    pointer-events: none;
}
@keyframes anim-ripple { to { transform: scale(1); opacity: 0; } }

.anim-on .btn:active:not(:disabled),
.anim-on .btn-submit:active:not(:disabled),
.anim-on .btn-avaliar:active:not(:disabled),
.anim-on .modal-btn:active,
.anim-on .btn-combo-usar:active,
.anim-on .btn-minhas-avaliacoes:active,
.anim-on .modal-confirmacao-btn:active,
.anim-on .time-toggle:active:not(:disabled) {
    transform: scale(.97);
    transition-duration: .08s;
}

/* "pulinho" no card escolhido (profissional, serviço, combo, horário) */
.anim-on .anim-pop { animation: anim-pop .42s var(--anim-ease-pop); }
@keyframes anim-pop {
    0% { transform: scale(.93); }
    55% { transform: scale(1.045); }
    /* sem 100%: termina no próprio transform do card (ex.: selecionado) */
}

/* ---------- Agendar: etapas ---------- */
.anim-on .anim-proxima {
    animation: anim-proxima 1.3s ease-out 1 !important;
}
@keyframes anim-proxima {
    0% { box-shadow: 0 0 0 0 rgba(0, 0, 0, .28); }
    35% { box-shadow: 0 0 0 7px rgba(0, 0, 0, .10); }
    100% { box-shadow: 0 0 0 14px rgba(0, 0, 0, 0); }
}

/* itens que chegam pelo servidor entram em cascata */
.anim-on .anim-cascata {
    animation: anim-subir .38s var(--anim-ease) both !important;
    animation-delay: calc(var(--anim-i, 0) * 35ms) !important;
}
@keyframes anim-subir {
    from { opacity: 0; transform: translateY(10px); }
    /* sem "to": termina no estado normal do elemento (ex.: horário ocupado fica apagado) */
}

/* lista de horários: abre deslizando */
.anim-on .time-dropdown.show { animation: anim-abrir .28s var(--anim-ease) both; }
@keyframes anim-abrir {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: none; }
}

/* ---------- Carregamento ---------- */
.anim-on .cortes-loading { animation: anim-respirar 1.4s ease-in-out infinite; }
@keyframes anim-respirar { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

.anim-carregando {
    position: relative;
    overflow: hidden;
}
.anim-carregando::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 45%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .28), transparent);
    animation: anim-brilho 1.1s linear infinite;
    pointer-events: none;
}
@keyframes anim-brilho { from { transform: translateX(-110%); } to { transform: translateX(330%); } }

.anim-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: anim-girar .7s linear infinite;
    vertical-align: -.15em;
}
@keyframes anim-girar { to { transform: rotate(360deg); } }

/* botão que acabou de ficar disponível */
.anim-on .anim-pronto { animation: anim-pronto .9s ease-out 1; }
@keyframes anim-pronto {
    0% { box-shadow: 0 0 0 0 rgba(0, 0, 0, .30); }
    100% { box-shadow: 0 0 0 12px rgba(0, 0, 0, 0); }
}

/* ---------- Login ---------- */
.anim-on #loginForm .btn:not(.hidden) { animation: anim-subir .35s var(--anim-ease) both; }
.anim-on .company-logo { animation: anim-logo .8s var(--anim-ease-pop) both; }
@keyframes anim-logo {
    from { opacity: 0; transform: translateX(-50%) scale(.6) translateY(14px); }
    to { opacity: 1; transform: translateX(-50%) scale(1); }
}
.anim-on #loginForm .form-control:focus { box-shadow: 0 0 0 4px rgba(0, 0, 0, .08); }

/* ---------- Sucesso (confirmação e modal da avaliação) ---------- */
.anim-on .confirmation-icon {
    position: relative;
    animation: anim-check .75s var(--anim-ease-pop) .5s both !important;
}
@keyframes anim-check {
    0% { opacity: 0; transform: scale(.3) rotate(-25deg); }
    60% { opacity: 1; transform: scale(1.12) rotate(4deg); }
    100% { opacity: 1; transform: none; }
}
.anim-explosao {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 0;
}
.anim-anel {
    position: absolute;
    left: -55px;
    top: -55px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 3px solid var(--anim-sucesso);
    opacity: 0;
    animation: anim-anel 1.1s ease-out .35s forwards;
}
@keyframes anim-anel {
    0% { opacity: .7; transform: scale(.7); }
    100% { opacity: 0; transform: scale(1.7); }
}
.anim-confete {
    position: absolute;
    left: -4px;
    top: -4px;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    opacity: 0;
    animation: anim-confete .9s var(--anim-ease) forwards;
    animation-delay: var(--anim-d, .4s);
}
@keyframes anim-confete {
    0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(.6); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--anim-x), var(--anim-y)) rotate(var(--anim-r, 180deg)) scale(1); }
}
.anim-on .confirmation-title { animation: anim-subir .5s var(--anim-ease) .7s both !important; }

.anim-on .modal-confirmacao.active .modal-confirmacao-icon {
    animation: anim-check .7s var(--anim-ease-pop) .05s both;
}

/* ---------- Avaliação: estrelas ---------- */
.anim-on .stars label i { will-change: auto; }
.anim-on .stars label.anim-estrela i { animation: anim-estrela .45s var(--anim-ease-pop) both; animation-delay: var(--anim-d, 0ms); }
@keyframes anim-estrela {
    0% { transform: scale(.6) rotate(-20deg); }
    60% { transform: scale(1.35) rotate(8deg); }
    100% { transform: scale(1) rotate(0); }
}
.anim-estrela-legenda {
    min-height: 1.5em;
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--dark, #212529);
}
.anim-on .anim-estrela-legenda.anim-troca { animation: anim-subir .3s var(--anim-ease) both; }
.stars { position: relative; }
.anim-brilhos { position: absolute; width: 0; height: 0; pointer-events: none; }
.anim-brilhos .anim-confete { background: #ffc107; border-radius: 50%; width: 6px; height: 6px; left: -3px; top: -3px; }

/* modal de cancelar (histórico) e modal de minhas avaliações */
.anim-on .confirm-modal .modal-content { animation: anim-modal .3s var(--anim-ease-pop) both; }
.anim-on .modal-avaliacoes.active .modal-avaliacoes-content { animation: anim-modal .32s var(--anim-ease-pop) both; }
@keyframes anim-modal {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to { opacity: 1; transform: none; }
}

/* ---------- Reduzir movimento: corta também as animações já existentes ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
