/* Système de messagerie - Floating Button et Popup */

/* Bouton flottant en bas à droite */
.message-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a84d 0%, #00c45d 100%);
    border: 2px solid rgba(0, 168, 77, 0.3);
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 168, 77, 0.4), 0 0 30px rgba(0, 168, 77, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: all 0.3s ease;
    color: white;
    font-size: 20px;
    backdrop-filter: blur(10px);
}

.message-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 168, 77, 0.6), 0 0 40px rgba(0, 168, 77, 0.3);
    border-color: rgba(0, 196, 93, 0.5);
    background: linear-gradient(135deg, #00c45d 0%, #00e86d 100%);
}

.message-button:active {
    transform: scale(0.95);
}

/* Badge de notification (nombre de messages non lus) */
.message-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.message-badge.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    transform: scale(0);
    pointer-events: none;
}

/* Overlay de la popup */
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message-overlay.active {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

/* Popup principale */
.message-popup {
    background: #1a1a2e;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* En-tête de la popup */
.message-popup-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px 16px 0 0;
}

.message-popup-header h2 {
    margin: 0;
    color: #f5f6fa;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-popup-header h2 i {
    color: #667eea;
}

.message-popup-close {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.message-popup-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Corps de la popup */
.message-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 200px;
    max-height: calc(80vh - 150px);
}

.message-popup-body::-webkit-scrollbar {
    width: 8px;
}

.message-popup-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.message-popup-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.message-popup-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* État vide */
.message-empty {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
}

.message-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.message-empty p {
    font-size: 1.1rem;
}

/* Liste des messages */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Item de message */
.message-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.message-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.message-item.unread {
    border-left: 4px solid #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.message-item.unread::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
}

/* Types de messages */
.message-item.message-info {
    border-left-color: #3498db;
}

.message-item.message-warning {
    border-left-color: #f39c12;
}

.message-item.message-ban {
    border-left-color: #e74c3c;
}

.message-item.message-thank {
    border-left-color: #2ecc71;
}

.message-item.message-global {
    border-left-color: #9b59b6;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.message-title {
    font-weight: 600;
    color: #f5f6fa;
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-title i {
    font-size: 0.9rem;
}

.message-date {
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
}

.message-content {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.message-type-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 8px;
}

.message-type-badge.type-info {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
}

.message-type-badge.type-warning {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

.message-type-badge.type-ban {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.message-type-badge.type-thank {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.message-type-badge.type-global {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
}

/* Détail d'un message */
.message-detail {
    display: none;
}

.message-detail.active {
    display: block;
}

.message-detail-content {
    padding: 20px;
}

.message-detail-header {
    margin-bottom: 20px;
}

.message-detail-title {
    font-size: 1.5rem;
    color: #f5f6fa;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-detail-meta {
    color: #888;
    font-size: 0.9rem;
}

.message-detail-body {
    color: #ccc;
    line-height: 1.8;
    font-size: 1rem;
    margin-bottom: 20px;
}

.message-detail-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message-delete-btn {
    padding: 6px 12px;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: 6px;
    color: #e74c3c;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.message-delete-btn:hover {
    background: rgba(231, 76, 60, 0.25);
    border-color: rgba(231, 76, 60, 0.4);
    transform: translateY(-1px);
}

.message-delete-btn i {
    font-size: 0.75rem;
}

/* Boutons d'action */
.message-actions {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 0 16px 16px;
}

.message-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-btn-primary {
    background: #667eea;
    color: white;
}

.message-btn-primary:hover {
    background: #5568d3;
}

.message-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.message-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

/* Bouton "Marquer tout comme lu" */
.message-mark-all-read {
    padding: 10px 20px;
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin: 0 20px 15px 20px;
    width: calc(100% - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.message-mark-all-read:hover {
    background: rgba(102, 126, 234, 0.3);
}

/* Modal de confirmation de suppression */
.message-delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.message-delete-modal-overlay.active {
    opacity: 1;
}

.message-delete-modal {
    background: #1a1a2e;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.message-delete-modal-overlay.active .message-delete-modal {
    transform: scale(1);
}

.message-delete-modal-header {
    padding: 25px 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.message-delete-modal-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(231, 76, 60, 0.1));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #e74c3c;
    border: 2px solid rgba(231, 76, 60, 0.3);
}

.message-delete-modal-title {
    margin: 0;
    color: #f5f6fa;
    font-size: 1.4rem;
    font-weight: 600;
}

.message-delete-modal-body {
    padding: 20px 25px;
    text-align: center;
    color: #ccc;
    line-height: 1.6;
}

.message-delete-modal-warning {
    color: #e74c3c;
    font-size: 0.9rem;
    margin-top: 10px;
    font-weight: 500;
}

.message-delete-modal-actions {
    padding: 20px 25px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.message-delete-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-delete-modal-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.message-delete-modal-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.message-delete-modal-btn.confirm {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.message-delete-modal-btn.confirm:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .message-button {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }

    .message-popup {
        width: 95%;
        max-height: 90vh;
    }

    .message-popup-header {
        padding: 15px;
    }

    .message-popup-header h2 {
        font-size: 1.2rem;
    }

    .message-popup-body {
        padding: 15px;
    }
}

