/**
 * Sistema de Mensagens Flash - Academia Eventos
 * Sistema completo de notificações com acessibilidade e UX aprimorada
 * Versão 2.0 - Outubro 2025
 */

/* ========================================
   CONTAINER DE MENSAGENS
   ======================================== */

.flash-messages-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    max-width: 500px;
    width: calc(100% - 40px);
    pointer-events: none;
}

/* Espaçamento entre mensagens empilhadas */
.flash-messages-container .flash-message {
    margin-bottom: 15px;
    pointer-events: all;
}

/* Para mobile - posicionar no topo centralizado */
@media (max-width: 768px) {
    .flash-messages-container {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: calc(100% - 20px);
    }
}

/* ========================================
   ESTRUTURA DA MENSAGEM
   ======================================== */

.flash-message {
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    min-height: 70px;
    overflow: hidden;
    
    /* Animações */
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: all 0.3s ease;
}

.flash-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2), 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Animação de saída */
.flash-message.flash-dismissing {
    animation: slideOutRight 0.4s cubic-bezier(0.55, 0.09, 0.68, 0.53) forwards;
    opacity: 0;
}

/* ========================================
   TIPOS DE MENSAGENS - CORES E CONTRASTES
   ======================================== */

/* SUCESSO - Verde */
.flash-message.alert-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #047857;
    color: #ffffff;
}

.flash-message.alert-success .flash-icon {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ERRO - Vermelho */
.flash-message.alert-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: #b91c1c;
    color: #ffffff;
}

.flash-message.alert-danger .flash-icon {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ATENÇÃO - Laranja/Amarelo */
.flash-message.alert-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #b45309;
    color: #ffffff;
}

.flash-message.alert-warning .flash-icon {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* INFORMAÇÃO - Azul */
.flash-message.alert-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #1d4ed8;
    color: #ffffff;
}

.flash-message.alert-info .flash-icon {
    background-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* ========================================
   ELEMENTOS DA MENSAGEM
   ======================================== */

/* Ícone */
.flash-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 20px;
    margin-right: 15px;
}

/* Conteúdo */
.flash-content {
    flex: 1;
    min-width: 0; /* Permite que o texto quebre corretamente */
}

.flash-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 4px 0;
    color: inherit;
    display: block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.flash-text {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    margin: 0;
    color: inherit;
    opacity: 0.95;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Botão de fechar */
.flash-close {
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.8;
    cursor: pointer;
    padding: 8px;
    margin: -4px -8px -4px 10px;
    font-size: 20px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.flash-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.flash-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ========================================
   BARRA DE PROGRESSO
   ======================================== */

.flash-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    transform-origin: left;
    transition: none;
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(120%) scale(0.95);
    }
}

@keyframes progressBar {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Animação de pulsação para mensagens importantes */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.08);
    }
    50% {
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.25), 0 2px 5px rgba(0, 0, 0, 0.15);
    }
}

.flash-message.flash-pulse {
    animation: pulse 2s infinite;
}

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

/* Foco para navegação por teclado */
.flash-message:focus-within {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Reduzir movimento para usuários com preferência */
@media (prefers-reduced-motion: reduce) {
    .flash-message {
        animation: none;
        transition: none;
    }
    
    .flash-message.flash-dismissing {
        animation: none;
        opacity: 0;
    }
    
    .flash-progress {
        transition: none;
        animation: none;
    }
}

/* Alto contraste */
@media (prefers-contrast: high) {
    .flash-message {
        border-width: 3px;
        font-weight: 600;
    }
    
    .flash-title {
        font-weight: 800;
    }
}

/* ========================================
   RESPONSIVIDADE
   ======================================== */

/* Tablets */
@media (max-width: 992px) {
    .flash-messages-container {
        max-width: 450px;
    }
    
    .flash-message {
        padding: 14px 18px;
    }
    
    .flash-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        margin-right: 12px;
    }
    
    .flash-title {
        font-size: 15px;
    }
    
    .flash-text {
        font-size: 13px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .flash-message {
        padding: 12px 16px;
        min-height: 60px;
    }
    
    .flash-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
        margin-right: 10px;
    }
    
    .flash-title {
        font-size: 14px;
    }
    
    .flash-text {
        font-size: 13px;
    }
    
    .flash-close {
        font-size: 18px;
        padding: 6px;
    }
}

/* Mobile pequeno */
@media (max-width: 480px) {
    .flash-messages-container {
        top: 60px;
    }
    
    .flash-message {
        border-radius: 8px;
    }
}

/* ========================================
   MODO ESCURO (opcional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .flash-message {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    
    .flash-message:hover {
        box-shadow: 0 6px 25px rgba(0, 0, 0, 0.5), 0 2px 5px rgba(0, 0, 0, 0.4);
    }
}

/* ========================================
   UTILITÁRIOS
   ======================================== */

/* Esconder elemento visualmente mas manter para leitores de tela */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Garantir que o texto nunca fique invisível */
.flash-message * {
    color: inherit !important;
    opacity: inherit !important;
}

/* Prevenir quebras indesejadas */
.flash-message .flash-content {
    overflow-wrap: anywhere;
}




