/* ========================================
   SYSTÈME DE MESSAGERIE - CSS
   ======================================== */

/* Container principal */
.conversations-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Liste des conversations */
.conversations-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.conversation-item:hover {
    background: #f9fafb;
    transform: translateX(4px);
}

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

/* Image de l'annonce */
.conversation-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 1rem;
}

.conversation-image-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 1rem;
}

.conversation-image-placeholder svg {
    width: 32px;
    height: 32px;
    color: #9ca3af;
}

/* Contenu de la conversation */
.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.conversation-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-badge {
    background: #2563eb;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
}

.conversation-user {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.conversation-user strong {
    color: #374151;
}

.conversation-last-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.conversation-message {
    font-size: 0.875rem;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conversation-message strong {
    color: #374151;
}

.conversation-time {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
}

.conversation-price {
    font-size: 0.875rem;
    font-weight: 700;
    color: #2563eb;
    margin-top: 0.5rem;
}

/* Flèche */
.conversation-arrow {
    margin-left: 1rem;
    flex-shrink: 0;
}

.conversation-arrow svg {
    width: 20px;
    height: 20px;
    color: #9ca3af;
}

/* ========================================
   VUE CONVERSATION (CHAT)
   ======================================== */

/* Header de la conversation */
.chat-header {
    background: white;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-back-button {
    color: #6b7280;
    transition: color 0.2s;
}

.chat-back-button:hover {
    color: #111827;
}

.chat-back-button svg {
    width: 24px;
    height: 24px;
}

.chat-user-info h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.25rem 0;
}

.chat-listing-link {
    font-size: 0.875rem;
    color: #2563eb;
    text-decoration: none;
}

.chat-listing-link:hover {
    text-decoration: underline;
}

.chat-header-right {
    text-align: right;
}

.chat-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: #2563eb;
}

.chat-listing-image {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    margin-top: 0.5rem;
}

/* Zone des messages */
.chat-messages {
    background: #f9fafb;
    padding: 1.5rem;
    height: 500px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.message-wrapper {
    margin-bottom: 1rem;
}

.message-wrapper.message-right {
    text-align: right;
}

.message-wrapper.message-left {
    text-align: left;
}

.message-bubble {
    display: inline-block;
    max-width: 60%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-right .message-bubble {
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-left .message-bubble {
    background: white;
    color: #111827;
    border-bottom-left-radius: 4px;
}

.message-text {
    font-size: 0.875rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

/* Formulaire d'envoi */
.chat-input {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.chat-form {
    display: flex;
    gap: 1rem;
}

.chat-textarea {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.875rem;
    resize: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chat-submit-button {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-submit-button:hover {
    background: #1d4ed8;
}

.chat-submit-button svg {
    width: 20px;
    height: 20px;
}

.chat-help-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Messages d'alerte */
.chat-alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.chat-alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.chat-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* État vide */
.empty-state {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: #9ca3af;
    margin: 0 auto 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.5rem 0;
}

.empty-state-button {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.empty-state-button:hover {
    background: #1d4ed8;
}

/* Scrollbar personnalisée */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive */
@media (max-width: 768px) {
    .conversations-container {
        padding: 1rem 0.5rem;
    }
    
    .conversation-item {
        padding: 1rem;
    }
    
    .conversation-image,
    .conversation-image-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .conversation-title {
        font-size: 1rem;
    }
    
    .message-bubble {
        max-width: 80%;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .chat-messages {
        height: 400px;
        padding: 1rem;
    }
    
    .chat-input {
        padding: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.conversation-item,
.message-wrapper {
    animation: fadeIn 0.3s ease;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.loading::after {
    content: '...';
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}
