/* Camada de polimento UX — transitions, micro-animacoes, focus states.
   Carregado depois do admin.css/public.css pra sobrescrever pontualmente. */

/* ----------------------------- Transitions globais ----------------------- */
.btn,
button:not(.modal-close),
.nav-link,
.settings-tab,
.tab,
.stat-card,
.card,
.method-icon,
.thumb-product,
.invoice-card {
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

/* Botoes — efeito tatil ao clicar */
.btn:not(:disabled):active,
button.btn-pub:not(:disabled):active,
button[type="submit"]:not(:disabled):active {
    transform: scale(0.97);
}
.btn:not(:disabled):hover { box-shadow: 0 1px 2px 0 rgba(15,23,42,0.06); }
.btn-primary:not(:disabled):hover { box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--brand-primary, var(--primary)) 35%, transparent); }

/* Cards — leve lift no hover */
.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px rgba(15,23,42,0.06);
}
.invoice-card:hover { transform: translateY(-1px); }

/* Inputs / selects — focus mais suave */
input:focus, select:focus, textarea:focus { transition: box-shadow 0.15s ease, border-color 0.15s ease; }

/* Tabs — underline animado */
.settings-tab { position: relative; }
.settings-tab::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%; right: 50%;
    height: 2px;
    background: var(--brand-primary, var(--primary, #6366f1));
    transition: left 0.2s ease, right 0.2s ease;
}
.settings-tab.active::after { left: 0; right: 0; }

/* Tabs pill (login universal) */
.tabs-pill .tab { transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease; }
.tabs-pill .tab:not(.active):active { transform: scale(0.96); }

/* ----------------------------- Modal animation --------------------------- */
.modal-overlay {
    transition: opacity 0.2s ease, backdrop-filter 0.2s ease;
}
.modal-overlay:not(.open) { opacity: 0; pointer-events: none; }
.modal-overlay.open { opacity: 1; }
.modal-card {
    transform: translateY(8px) scale(0.98);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
}
.modal-overlay.open .modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ----------------------------- Page first-load fade ---------------------- */
/* IMPORTANTE: nao usar transform aqui - quebra position:fixed de modais filhos. */
.main, .auth-shell, .portal-shell {
    animation: page-fade-in 0.28s ease-out both;
}
@keyframes page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ----------------------------- Top progress bar -------------------------- */
#nav-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px; width: 0%;
    background: linear-gradient(90deg, var(--brand-primary, #6366f1), var(--brand-secondary, #8b5cf6));
    /* Acima de modal-overlay (99990) e toast (100000) — sempre visível */
    z-index: 100001;
    box-shadow: 0 0 8px color-mix(in srgb, var(--brand-primary, #6366f1) 70%, transparent);
    opacity: 0;
    transition: width 0.25s ease, opacity 0.18s ease;
    pointer-events: none;
}
#nav-progress.visible { opacity: 1; }

/* ----------------------------- Toast notifications ----------------------- */
#toast-container {
    position: fixed;
    top: 20px; right: 20px;
    /* Acima de modal-overlay (99990) — toast precisa aparecer mesmo se modal ainda estiver aberto */
    z-index: 100000;
    display: flex; flex-direction: column; gap: 10px;
    max-width: calc(100vw - 40px);
}
.toast {
    background: #fff;
    color: #111827;
    border-radius: 10px;
    padding: 12px 14px 12px 14px;
    box-shadow: 0 10px 30px -10px rgba(15,23,42,0.25), 0 4px 6px -2px rgba(15,23,42,0.05);
    border-left: 4px solid #6b7280;
    min-width: 280px; max-width: 380px;
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 14px; line-height: 1.4;
    transform: translateX(110%);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
    cursor: pointer;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { border-left-color: #16a34a; }
.toast.error   { border-left-color: #dc2626; }
.toast.warning { border-left-color: #d97706; }
.toast.info    { border-left-color: #2563eb; }
.toast-icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success .toast-icon { color: #16a34a; }
.toast.error   .toast-icon { color: #dc2626; }
.toast.warning .toast-icon { color: #d97706; }
.toast.info    .toast-icon { color: #2563eb; }
.toast-body { flex: 1; }
.toast-close {
    background: none; border: none; color: #9ca3af; font-size: 18px; line-height: 1;
    cursor: pointer; padding: 0 0 0 4px;
}
.toast-close:hover { color: #374151; }

/* Bolinha pulsante removida — status-badge fica consistente entre os 3 status. */

/* ----------------------------- Reduce motion respeito -------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
