/* =========================================================
   Fichier de styles commun pour les messages
   Utilisé par pool.php, my-messages.php et my-data.php
   ========================================================= */

/* Styles pour les messages */
.message-card {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    border-left: 5px solid #3498db;
}

.message-card.urgent {
    border-left-color: #e74c3c;
}

.message-card.read {
    opacity: 0.75;
    border-left-color: #95a5a6;
}

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

.message-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.message-date {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.message-body {
    margin-bottom: 15px;
    line-height: 1.5;
}

.message-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Badges de statut */
.message-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    margin-bottom: 5px;
    margin-left: 5px;
}

.badge-urgent, .status-urgent {
    background-color: #e74c3c;
}

.badge-read {
    background-color: #95a5a6;
}

.badge-new, .status-nouveau {
    background-color: #3498db;
}

.message-badge-small {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    height: auto;
    padding: 2px 6px;
    background-color: #3498db;
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: normal;
}

.message-badge-small.urgent {
    background-color: #e74c3c;
}

/* Modal pour les messages */

.modal, .message-modal {
    display: none;
}

.message-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: auto;
    animation: fadeIn 0.3s;
}

.message-modal-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow: auto;
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 10% auto;
    padding: 20px;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

.message-modal-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.message-modal-title {
    margin: 0;
    padding-right: 30px;
    color: #333;
    font-size: 1.4rem;
}

.message-modal-date {
    margin-top: 5px;
    color: #777;
    font-size: 0.9rem;
}

.message-modal-body {
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 20px;
    line-height: 1.6;
}

.message-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Boutons d'action */
.action-button, 
.mark-read-btn,
.modal-footer button,
button[type="submit"],
#sendReplyBtn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    background-color: #3498db;
    margin: 2px;
}

.action-button:hover,
.mark-read-btn:hover,
.modal-footer button:hover,
button[type="submit"]:hover,
#sendReplyBtn:hover {
    opacity: 0.9;
}

.view-button,
.mark-read-btn {
    background-color: #3498db;
}

.mark-read-button {
    background-color: #2ecc71;
}

.reply-button {
    background-color: #9b59b6;
}

button[type="submit"].mark-read-button,
.mark-read-btn.green {
    background-color: #2ecc71;
}

/* Styles pour la section des réponses */
.replies-section {
    margin-top: 20px;
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.replies-section h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.replies-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}

.loading-replies {
    text-align: center;
    color: #777;
    font-style: italic;
    padding: 10px;
}

.no-replies {
    text-align: center;
    color: #777;
    padding: 10px;
    font-style: italic;
}

.reply-item {
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 3px solid #9b59b6;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.reply-user {
    font-weight: bold;
    color: #333;
}

.reply-date {
    color: #777;
}

.reply-content {
    line-height: 1.4;
}

/* Styles pour le formulaire de réponse */
.reply-form {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.reply-form h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.reply-form textarea {
    width: 94%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.form-actions {
    text-align: right;
}

/* Animation pour les nouvelles réponses */
@keyframes highlightNew {
    from { background-color: #d4edda; }
    to { background-color: #f5f5f5; }
}

.reply-item.new {
    animation: highlightNew 2s;
}

/* Message preview dans pool.php */
.message-preview {
    padding: 12px;
    margin: 10px 0;
    background-color: #ffffff;
    border-left: 4px solid #3498db;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-preview:hover {
    background-color: #f5f9ff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.message-preview.urgent {
    border-left-color: #e74c3c;
    background-color: #fff5f5;
}

.message-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.message-preview-title {
    font-weight: bold;
    color: #333;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-preview-date {
    font-size: 0.8rem;
    color: #777;
}

.message-preview-content {
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .message-header {
        flex-direction: column;
    }
    
    .message-date {
        margin-top: 5px;
    }
    
    .message-footer {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-button {
        width: 100%;
        text-align: center;
    }
    
    .message-modal-content {
        margin: 20% auto;
        width: 95%;
        padding: 15px;
    }
    
    .message-modal-footer {
        flex-direction: column;
    }
    
    .modal-footer button {
        width: 100%;
        margin-bottom: 5px;
    }
}