/**
 * Sistema de Notificações Toast para Jogo Colaborativo
 * 
 * Estilos para notificações tipo toast que aparecem no canto superior direito
 *
 * @package Teia_Intersetorialidade
 * @since 1.0.0
 */

/* Container principal das notificações */
#teia-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
    max-width: 90%;
    width: 400px;
}

/* Notificação individual */
.teia-toast {
    background: #ffffff;
    color: #333333;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
    min-width: 300px;
    max-width: 400px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Estados de entrada e saída */
.teia-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.teia-toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

/* Tipos de notificação */
.teia-toast-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.teia-toast-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.teia-toast-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.teia-toast-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.teia-toast-invite {
    background: #e8f4ff;
    color: #004085;
    border-color: #b8d4ff;
}

.teia-toast-waiting {
    background: #fff8e1;
    color: #8d6e63;
    border-color: #ffecb3;
}

/* Botão de fechar */
.teia-toast .close-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: opacity 0.2s ease;
}

.teia-toast .close-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

/* Conteúdo da notificação */
.teia-toast .toast-content {
    margin-right: 30px;
    word-wrap: break-word;
}

.teia-toast .toast-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 16px;
}

.teia-toast .toast-message {
    margin-bottom: 0;
}

/* Estilos específicos para convites */
.teia-toast-invite .invite-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #007cba;
    font-size: 16px;
}

.teia-toast-invite .invite-message {
    margin-bottom: 12px;
    line-height: 1.5;
}

.teia-toast-invite .invite-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.teia-toast-invite .invite-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    flex: 1;
    text-align: center;
}

.teia-toast-invite .invite-btn.accept {
    background: #28a745;
}

.teia-toast-invite .invite-btn.accept:hover {
    background: #218838;
}

.teia-toast-invite .invite-btn.decline {
    background: #dc3545;
}

.teia-toast-invite .invite-btn.decline:hover {
    background: #c82333;
}

.teia-toast-invite .invite-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Estilos para notificação de espera */
.teia-toast-waiting .waiting-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.teia-toast-waiting .waiting-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    flex: 1;
    text-align: center;
}

.teia-toast-waiting .waiting-btn.join {
    background: #ff9800;
}

.teia-toast-waiting .waiting-btn.join:hover {
    background: #f57c00;
}

.teia-toast-waiting .waiting-btn.dismiss {
    background: #757575;
}

.teia-toast-waiting .waiting-btn.dismiss:hover {
    background: #616161;
}

.teia-toast-waiting .waiting-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Ícones */
.teia-toast .toast-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 16px;
}

.teia-toast-success .toast-icon::before {
    content: "✓";
    color: #28a745;
}

.teia-toast-error .toast-icon::before {
    content: "✕";
    color: #dc3545;
}

.teia-toast-warning .toast-icon::before {
    content: "⚠";
    color: #ffc107;
}

.teia-toast-info .toast-icon::before {
    content: "ℹ";
    color: #17a2b8;
}

.teia-toast-invite .toast-icon::before {
    content: "🎮";
    color: #007cba;
}

.teia-toast-waiting .toast-icon::before {
    content: "⏰";
    color: #ff9800;
}

/* Responsividade */
@media (max-width: 768px) {
    #teia-toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .teia-toast {
        min-width: auto;
        max-width: none;
        margin-bottom: 8px;
        padding: 12px 16px;
    }
    
    .teia-toast-invite .invite-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .teia-toast-invite .invite-btn {
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    #teia-toast-container {
        top: 5px;
        right: 5px;
        left: 5px;
    }
    
    .teia-toast {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .teia-toast .close-btn {
        top: 6px;
        right: 8px;
        font-size: 18px;
    }
}

/* Animações */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.teia-toast.slide-in {
    animation: slideInRight 0.3s ease forwards;
}

.teia-toast.slide-out {
    animation: slideOutRight 0.3s ease forwards;
}

/* Estados de loading */
.teia-toast.loading .invite-btn {
    position: relative;
    color: transparent;
}

.teia-toast.loading .invite-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Melhorias de acessibilidade */
.teia-toast:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.teia-toast .invite-btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Suporte para modo escuro (se implementado) */
@media (prefers-color-scheme: dark) {
    .teia-toast {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .teia-toast-success {
        background: #22543d;
        color: #9ae6b4;
        border-color: #38a169;
    }
    
    .teia-toast-error {
        background: #742a2a;
        color: #feb2b2;
        border-color: #e53e3e;
    }
    
    .teia-toast-warning {
        background: #744210;
        color: #faf089;
        border-color: #d69e2e;
    }
    
    .teia-toast-info {
        background: #2a4365;
        color: #90cdf4;
        border-color: #3182ce;
    }
    
    .teia-toast-invite {
        background: #2a4365;
        color: #90cdf4;
        border-color: #3182ce;
    }
    
    .teia-toast-waiting {
        background: #744210;
        color: #faf089;
        border-color: #d69e2e;
    }
}
