/* Variables de couleurs pour le thème vert sombre */
:root {
    --drc-primary: #2d5a3d;
    --drc-primary-dark: #1e3a29;
    --drc-primary-light: #3c7a54;
    --drc-secondary: #4a7c59;
    --drc-accent: #8db596;
    --drc-background: #f8faf9;
    --drc-surface: #ffffff;
    --drc-text: #1a1a1a;
    --drc-text-light: #6b7280;
    --drc-border: #e5e7eb;
    --drc-success: #10b981;
    --drc-warning: #f59e0b;
    --drc-error: #ef4444;
}

/* Styles généraux pour le module messagerie */
.messaging-integrated-container {
    height: 100%;
    background-color: var(--drc-background);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    border-radius: 20 px; /* Arrondis des bordures */
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.messaging-header-bar {
    background: linear-gradient(135deg, var(--drc-primary) 0%, var(--drc-primary-dark) 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.messaging-content-wrapper {
    height: calc(100vh - 80px);
    overflow: hidden;
}

.messaging-container {
    height: 100%;
}

/* Sidebar des conversations */
.messaging-sidebar {
    background-color: var(--drc-surface);
    border-right: 1px solid var(--drc-border);
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}

.conversation-item {
    transition: all 0.2s ease-in-out;
    border-bottom: 1px solid var(--drc-border);
}

.conversation-item:hover {
    background-color: rgba(45, 90, 61, 0.05);
}

.conversation-item.active {
    background-color: rgba(45, 90, 61, 0.1);
    border-right: 3px solid var(--drc-primary);
}

.conversation-item:last-child {
    border-bottom: none;
}

/* Zone principale de messagerie */
.messaging-main {
    background-color: var(--drc-background);
}

/* Bulles de message */
.message-bubble {
    max-width: 70%;
    word-wrap: break-word;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-bubble.own {
    background: linear-gradient(135deg, var(--drc-primary) 0%, var(--drc-secondary) 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-bubble.other {
    background-color: var(--drc-surface);
    color: var(--drc-text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--drc-border);
}

.message-bubble.own::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid var(--drc-secondary);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message-bubble.other::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--drc-surface);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message-bubble.other::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -9px;
    width: 0;
    height: 0;
    border-right: 8px solid var(--drc-border);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Zone de composition */
.message-composer {
    background-color: var(--drc-surface);
    border-top: 1px solid var(--drc-border);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* Boutons et contrôles */
.btn-primary {
    background-color: var(--drc-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-primary:hover {
    background-color: var(--drc-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: var(--drc-surface);
    color: var(--drc-text);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--drc-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: var(--drc-primary-light);
}

/* Indicateur de chargement */
.loading-spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--drc-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Badges et indicateurs */
.unread-badge {
    background-color: var(--drc-primary);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.project-badge {
    background-color: var(--drc-accent);
    color: var(--drc-primary-dark);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

/* Panneau latéral */
.conversation-sidebar {
    background-color: var(--drc-surface);
    border-left: 1px solid var(--drc-border);
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.05);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--drc-surface);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--drc-border);
    background-color: var(--drc-primary);
    color: white;
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--drc-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* États vides */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--drc-text-light);
}

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

/* Responsive */
@media (max-width: 768px) {
    .messaging-sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
    }

    .messaging-main {
        width: 100%;
    }

    .conversation-sidebar {
        width: 100%;
        position: absolute;
        z-index: 20;
    }

    .message-bubble {
        max-width: 85%;
    }
}

/* Animation pour les nouveaux messages */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-item {
    animation: messageSlideIn 0.3s ease-out;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--drc-primary-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--drc-primary);
}

/* Sélecteur multiple personnalisé */
select[multiple] {
    min-height: 120px;
}

select[multiple] option {
    padding: 8px 12px;
    border-bottom: 1px solid var(--drc-border);
}

select[multiple] option:checked {
    background-color: var(--drc-primary);
    color: white;
}

/* Prévisualisation des pièces jointes */
.attachment-preview {
    border: 1px solid var(--drc-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.attachment-preview:hover {
    border-color: var(--drc-primary-light);
    background-color: rgba(45, 90, 61, 0.05);
}

/* États de priorité */
.priority-high {
    border-left: 3px solid var(--drc-warning);
}

.priority-urgent {
    border-left: 3px solid var(--drc-error);
}

/* Amélioration de l'accessibilité */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour l'accessibilité */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--drc-primary);
    outline-offset: 2px;
}