/**
 * [CRM-Exchanges] Styles pour l'onglet Historique des Échanges
 * NautiSphere Pro - Module CRM
 */

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] TIMELINE DES ÉCHANGES
   ═══════════════════════════════════════════════════════════════ */

/* Item d'échange dans la timeline */
.exchange-item {
    position: relative;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.exchange-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

/* Point sur la timeline */
.exchange-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: 3px solid #0891b2;
    z-index: 1;
}

/* Couleurs par type d'échange */
.exchange-item.type-email_sent::before,
.exchange-item.type-email_received::before {
    border-color: #3b82f6;
}

.exchange-item.type-whatsapp_sent::before,
.exchange-item.type-whatsapp_received::before {
    border-color: #25d366;
}

.exchange-item.type-sms_sent::before,
.exchange-item.type-sms_received::before {
    border-color: #8b5cf6;
}

.exchange-item.type-phone_call::before {
    border-color: #f59e0b;
}

.exchange-item.type-internal_note::before {
    border-color: #64748b;
    background: #64748b;
}

.exchange-item.type-meeting::before {
    border-color: #ec4899;
}

.exchange-item.type-document_sent::before,
.exchange-item.type-document_signed::before {
    border-color: #0891b2;
}

/* Direction inbound (message reçu) */
.exchange-item.direction-inbound {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-color: #bbf7d0;
}

.exchange-item.direction-inbound::before {
    background: #22c55e;
    border-color: #22c55e;
}

/* Direction interne (note) */
.exchange-item.direction-internal {
    background: #f8fafc;
    border-style: dashed;
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] BADGES DE TYPE
   ═══════════════════════════════════════════════════════════════ */

.exchange-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.exchange-type-badge.email {
    background: #dbeafe;
    color: #1d4ed8;
}

.exchange-type-badge.whatsapp {
    background: #dcfce7;
    color: #15803d;
}

.exchange-type-badge.sms {
    background: #ede9fe;
    color: #6d28d9;
}

.exchange-type-badge.call {
    background: #fef3c7;
    color: #b45309;
}

.exchange-type-badge.note {
    background: #f1f5f9;
    color: #475569;
}

.exchange-type-badge.meeting {
    background: #fce7f3;
    color: #be185d;
}

.exchange-type-badge.document {
    background: #cffafe;
    color: #0e7490;
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] INDICATEURS DE STATUT
   ═══════════════════════════════════════════════════════════════ */

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
}

.status-indicator.sent {
    color: #94a3b8;
}

.status-indicator.delivered {
    color: #3b82f6;
}

.status-indicator.opened {
    color: #22c55e;
}

.status-indicator.clicked {
    color: #8b5cf6;
}

.status-indicator.replied {
    color: #0891b2;
}

.status-indicator.failed {
    color: #ef4444;
}

.status-indicator.bounced {
    color: #f97316;
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] DOCUMENT LIÉ
   ═══════════════════════════════════════════════════════════════ */

.exchange-document {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 11px;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s ease;
}

.exchange-document:hover {
    background: #e2e8f0;
}

.exchange-document-icon {
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] PIÈCES JOINTES
   ═══════════════════════════════════════════════════════════════ */

.exchange-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 10px;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s ease;
}

.attachment-chip:hover {
    background: #e2e8f0;
}

.attachment-chip i {
    font-size: 11px;
    color: #64748b;
}

.attachment-chip.pdf i { color: #ef4444; }
.attachment-chip.image i { color: #3b82f6; }
.attachment-chip.doc i { color: #2563eb; }

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] ACTIONS SUR UN ÉCHANGE
   ═══════════════════════════════════════════════════════════════ */

.exchange-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.exchange-item:hover .exchange-actions {
    opacity: 1;
}

.exchange-action-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.exchange-action-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.exchange-action-btn.danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] ANIMATION SPINNER
   ═══════════════════════════════════════════════════════════════ */

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .exchanges-header {
        flex-direction: column;
        align-items: stretch;
    }

    .exchanges-stats-mini {
        justify-content: space-between;
    }

    .stat-mini {
        flex: 1;
        min-width: 60px;
        padding: 8px;
    }

    .exchanges-actions {
        justify-content: stretch;
    }

    .exchanges-actions button {
        flex: 1;
        justify-content: center;
    }

    .exchanges-filters {
        flex-direction: column;
    }

    .exchanges-filters select {
        width: 100%;
    }

    .exchange-item {
        padding: 10px 12px;
    }

    .exchange-actions {
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   [CRM-Exchanges] SCROLLBAR PERSONNALISÉE
   ═══════════════════════════════════════════════════════════════ */

.exchanges-timeline::-webkit-scrollbar {
    width: 6px;
}

.exchanges-timeline::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.exchanges-timeline::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.exchanges-timeline::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
