/* ============================================ */
/* TOP CARNES - SISTEMA DE TOAST NOTIFICATIONS   */
/* ============================================ */
/* Autor: Wellmax Solution                       */
/* Versão: 1.0.0                                 */
/* ============================================ */

/* ============================================ */
/* CONTAINER PRINCIPAL                           */
/* ============================================ */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-altura, 72px) + 16px);
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: auto;
}

/* ============================================ */
/* TOAST BASE                                    */
/* ============================================ */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: var(--cor-branca, #FFFFFF);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 
                0 2px 8px rgba(0, 0, 0, 0.06);
    pointer-events: all;
    min-width: 320px;
    max-width: 420px;
    position: relative;
    overflow: hidden;
    animation: toastSlideIn 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
    transition: all 0.3s cubic-bezier(0.21, 1.02, 0.73, 1);
    border-left: 5px solid var(--cor-sucesso, #2E7D32);
}

/* Barra de progresso */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 3px 0;
    animation: toastProgress 4s linear forwards;
}

/* ============================================ */
/* TIPOS DE TOAST                                */
/* ============================================ */

/* Sucesso */
.toast.toast-sucesso {
    border-left-color: #2E7D32;
    background: linear-gradient(135deg, #FFFFFF 0%, #F1F8E9 100%);
}

.toast.toast-sucesso .toast-icone {
    color: #2E7D32;
    background: rgba(46, 125, 50, 0.1);
}

.toast.toast-sucesso::after {
    background: #2E7D32;
}

/* Erro */
.toast.toast-erro {
    border-left-color: #C62828;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF3F0 100%);
}

.toast.toast-erro .toast-icone {
    color: #C62828;
    background: rgba(198, 40, 40, 0.1);
}

.toast.toast-erro::after {
    background: #C62828;
}

/* Atenção / Aviso */
.toast.toast-atencao {
    border-left-color: #F57C00;
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF8E1 100%);
}

.toast.toast-atencao .toast-icone {
    color: #F57C00;
    background: rgba(245, 124, 0, 0.1);
}

.toast.toast-atencao::after {
    background: #F57C00;
}

/* Informação */
.toast.toast-info {
    border-left-color: #1976D2;
    background: linear-gradient(135deg, #FFFFFF 0%, #E3F2FD 100%);
}

.toast.toast-info .toast-icone {
    color: #1976D2;
    background: rgba(25, 118, 210, 0.1);
}

.toast.toast-info::after {
    background: #1976D2;
}

/* Promoção / Especial */
.toast.toast-promocao {
    border-left-color: #7B1FA2;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3E5F5 100%);
}

.toast.toast-promocao .toast-icone {
    color: #7B1FA2;
    background: rgba(123, 31, 162, 0.1);
}

.toast.toast-promocao::after {
    background: #7B1FA2;
}

/* ============================================ */
/* ELEMENTOS DO TOAST                            */
/* ============================================ */

/* Ícone */
.toast-icone {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    font-weight: 700;
}

/* Conteúdo */
.toast-conteudo {
    flex: 1;
    min-width: 0;
}

.toast-titulo {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--cor-terciaria, #4E342E);
    margin-bottom: 2px;
    line-height: 1.3;
}

.toast-mensagem {
    font-size: 0.85rem;
    color: var(--cor-cinza, #757575);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Botão fechar */
.toast-fechar {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.04);
    color: var(--cor-cinza, #757575);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    line-height: 1;
}

.toast:hover .toast-fechar {
    opacity: 1;
}

.toast-fechar:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--cor-preta, #1A1A1A);
    transform: scale(1.1);
}

/* Botão de ação */
.toast-acao {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    margin-top: 8px;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--fonte-principal, 'Montserrat', sans-serif);
    transition: all 0.2s ease;
    text-decoration: none;
}

.toast-sucesso .toast-acao {
    background: rgba(46, 125, 50, 0.12);
    color: #2E7D32;
}

.toast-sucesso .toast-acao:hover {
    background: rgba(46, 125, 50, 0.22);
}

.toast-erro .toast-acao {
    background: rgba(198, 40, 40, 0.12);
    color: #C62828;
}

.toast-erro .toast-acao:hover {
    background: rgba(198, 40, 40, 0.22);
}

.toast-atencao .toast-acao {
    background: rgba(245, 124, 0, 0.12);
    color: #F57C00;
}

.toast-atencao .toast-acao:hover {
    background: rgba(245, 124, 0, 0.22);
}

.toast-info .toast-acao {
    background: rgba(25, 118, 210, 0.12);
    color: #1976D2;
}

.toast-info .toast-acao:hover {
    background: rgba(25, 118, 210, 0.22);
}

/* Toast com botão desfazer */
.toast-desfazer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-desfazer .toast-conteudo {
    flex: 1;
}

.btn-desfazer {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid currentColor;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--fonte-principal, 'Montserrat', sans-serif);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    color: inherit;
}

.btn-desfazer:hover {
    background: currentColor;
}

.toast-sucesso .btn-desfazer:hover {
    color: #FFFFFF;
}

.toast-erro .btn-desfazer:hover {
    color: #FFFFFF;
}

.toast-atencao .btn-desfazer:hover {
    color: #FFFFFF;
}

.toast-info .btn-desfazer:hover {
    color: #FFFFFF;
}

/* ============================================ */
/* ANIMAÇÕES                                     */
/* ============================================ */

/* Entrada */
@keyframes toastSlideIn {
    0% {
        transform: translateX(120%);
        opacity: 0;
    }
    60% {
        transform: translateX(-5%);
        opacity: 1;
    }
    80% {
        transform: translateX(2%);
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Saída */
@keyframes toastSlideOut {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* Barra de progresso */
@keyframes toastProgress {
    0% {
        width: 100%;
    }
    100% {
        width: 0%;
    }
}

/* Animação de bounce para o ícone */
.toast-icone {
    animation: toastIconBounce 0.6s cubic-bezier(0.21, 1.02, 0.73, 1) 0.2s both;
}

@keyframes toastIconBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Toast saindo */
.toast.toast-saindo {
    animation: toastSlideOut 0.3s ease forwards;
}

/* ============================================ */
/* VARIAÇÕES DE POSIÇÃO                          */
/* ============================================ */

/* Topo Esquerdo */
.toast-container.toast-topo-esquerdo {
    right: auto;
    left: 20px;
}

.toast-container.toast-topo-esquerdo .toast {
    animation: toastSlideInLeft 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes toastSlideInLeft {
    0% {
        transform: translateX(-120%);
        opacity: 0;
    }
    60% {
        transform: translateX(5%);
        opacity: 1;
    }
    80% {
        transform: translateX(-2%);
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Topo Centralizado */
.toast-container.toast-topo-centro {
    right: 50%;
    transform: translateX(50%);
    align-items: center;
}

.toast-container.toast-topo-centro .toast {
    animation: toastSlideInDown 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes toastSlideInDown {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    60% {
        transform: translateY(10%);
        opacity: 1;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Inferior Direito */
.toast-container.toast-inferior-direito {
    top: auto;
    bottom: 20px;
    flex-direction: column-reverse;
}

.toast-container.toast-inferior-direito .toast {
    animation: toastSlideInUp 0.4s cubic-bezier(0.21, 1.02, 0.73, 1);
}

@keyframes toastSlideInUp {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================ */
/* TAMANHOS                                       */
/* ============================================ */

/* Toast compacto */
.toast.toast-compacto {
    padding: 12px 14px;
    min-width: auto;
    gap: 8px;
}

.toast.toast-compacto .toast-icone {
    width: 30px;
    height: 30px;
    font-size: 1rem;
    border-radius: 8px;
}

.toast.toast-compacto .toast-mensagem {
    font-size: 0.8rem;
}

/* Toast grande */
.toast.toast-grande {
    padding: 20px 24px;
    min-width: 380px;
    border-radius: 18px;
}

.toast.toast-grande .toast-icone {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    border-radius: 14px;
}

.toast.toast-grande .toast-titulo {
    font-size: 1rem;
}

.toast.toast-grande .toast-mensagem {
    font-size: 0.9rem;
}

/* ============================================ */
/* RESPONSIVO                                    */
/* ============================================ */

@media (max-width: 767px) {
    .toast-container {
        right: 8px;
        left: 8px;
        top: calc(var(--navbar-altura, 60px) + 8px);
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        padding: 14px 16px;
        border-radius: 12px;
        gap: 10px;
        font-size: 0.85rem;
    }
    
    .toast-icone {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        border-radius: 10px;
    }
    
    .toast-titulo {
        font-size: 0.85rem;
    }
    
    .toast-mensagem {
        font-size: 0.8rem;
    }
    
    .toast-fechar {
        opacity: 1;
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    .toast.toast-grande {
        min-width: auto;
        padding: 16px 18px;
    }
    
    .toast.toast-grande .toast-icone {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .toast-container.toast-topo-centro {
        right: 8px;
        left: 8px;
        transform: none;
    }
}

@media (max-width: 479px) {
    .toast-container {
        right: 4px;
        left: 4px;
        top: calc(var(--navbar-altura, 56px) + 4px);
        gap: 6px;
    }
    
    .toast {
        padding: 12px 14px;
        border-radius: 10px;
    }
    
    .toast-icone {
        width: 30px;
        height: 30px;
        border-radius: 8px;
    }
    
    .toast-desfazer {
        flex-wrap: wrap;
    }
    
    .btn-desfazer {
        width: 100%;
        text-align: center;
    }
}

/* ============================================ */
/* MÚLTIPLOS TOASTS                              */
/* ============================================ */

/* Empilhar toasts com leve overlap */
.toast + .toast {
    margin-top: -4px;
}

/* Limitar número de toasts visíveis */
.toast:nth-child(n+6) {
    display: none;
}

/* Toast com delay de entrada escalonado */
.toast:nth-child(1) { animation-delay: 0s; }
.toast:nth-child(2) { animation-delay: 0.05s; }
.toast:nth-child(3) { animation-delay: 0.1s; }
.toast:nth-child(4) { animation-delay: 0.15s; }
.toast:nth-child(5) { animation-delay: 0.2s; }

/* ============================================ */
/* EFEITOS ESPECIAIS                             */
/* ============================================ */

/* Toast com shimmer (promoções) */
.toast.toast-promocao::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: toastShimmer 2s infinite;
}

@keyframes toastShimmer {
    100% {
        left: 100%;
    }
}

/* Toast com pulsação suave (para ações importantes) */
.toast.toast-importante {
    animation: toastSlideIn 0.4s cubic-bezier(0.21, 1.02, 0.73, 1),
               toastPulse 2s ease-in-out 0.5s 3;
}

@keyframes toastPulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    }
    50% {
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12),
                    0 0 0 8px rgba(211, 47, 47, 0.1);
    }
}

/* ============================================ */
/* ACESSIBILIDADE                                */
/* ============================================ */

/* Reduzir animações para usuários que preferem */
@media (prefers-reduced-motion: reduce) {
    .toast {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    
    .toast::after {
        animation: none !important;
    }
    
    .toast-icone {
        animation: none !important;
    }
    
    .toast.toast-promocao::before {
        animation: none !important;
    }
}