/* Chat Widget */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 180px; /* Encore plus compact */
    background: #fff;
    border-radius: 25px; /* Plus arrondi */
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
}

/* État initial - seulement le header visible */
.chat-widget:not(.expanded) {
    height: 45px; /* Plus petit en hauteur */
    background: linear-gradient(135deg, #c17f59 0%, #a0603d 100%);
}

/* État développé - chat complet visible */
.chat-widget.expanded {
    width: 320px;
    height: 500px; /* Hauteur quand ouvert */
}

.chat-header {
    color: #fff;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    min-height: 45px;
    border-radius: 25px;
    white-space: nowrap;
}

/* Le header perd son border-radius en bas quand le chat est ouvert */
.chat-widget.expanded .chat-header {
    border-radius: 15px 15px 0 0;
}

.chat-header i {
    font-size: 1.1em;
}

.chat-header-text {
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 0.9em;
}

.chat-widget.expanded .chat-header-text {
    font-size: 1em;
}

/* Container pour le statut en ligne */
.online-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

/* Point de statut en ligne avec animation */
.status-dot {
    width: 6px;
    height: 6px;
    background-color: #4CAF50;
    border-radius: 50%;
    position: relative;
    animation: pulse 1.5s infinite;
}

/* Point de statut plus gros quand le chat est ouvert */
.chat-widget.expanded .status-dot {
    width: 8px;
    height: 8px;
}

.status-dot::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: rgba(76, 175, 80, 0.3);
    border-radius: 50%;
    top: -2px;
    left: -2px;
    animation: pulse 1.5s infinite;
}

.chat-widget.expanded .status-dot::after {
    width: 14px;
    height: 14px;
    top: -3px;
    left: -3px;
}

.online-text {
    font-size: 0.8em;
    opacity: 0.9;
    display: none;
}

/* Afficher et agrandir le texte "En ligne" quand le chat est ouvert */
.chat-widget.expanded .online-text {
    display: inline-block;
    font-size: 0.95em;
    font-weight: 500;
}

/* Masquer certains éléments quand le chat n'est pas développé */
.chat-widget:not(.expanded) .online-text {
    display: none;
}

/* Corps du chat */
.chat-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    position: relative;
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease;
}

.chat-widget.expanded .chat-body {
    height: 400px;
}

.chat-messages {
    padding: 20px !important;
    overflow-y: auto !important;
}

/* Personnalisation de la scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

/* Style des messages */
.message {
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: 20px !important;
    max-width: 85% !important;
    animation: fadeIn 0.3s ease-in-out !important;
}

.message.sent {
    align-self: flex-end !important;
}

.message.received {
    align-self: flex-start !important;
}

.message-content {
    padding: 12px 16px !important;
    border-radius: 15px !important;
    font-size: 15px !important;
    line-height: 1.6 !important;
    position: relative !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.message-content br {
    line-height: 1.8 !important;
}

.message-content .highlight {
    color: #c17f59 !important;
    font-weight: 600 !important;
    font-size: 1.05em !important;
}

.message.received .message-content {
    background-color: #f8f9fa !important;
    color: #333 !important;
    border-bottom-left-radius: 5px !important;
}

.message.sent .message-content {
    background-color: #c17f59 !important;
    color: white !important;
    border-bottom-right-radius: 5px !important;
}

.message.sent .message-content .highlight {
    color: #fff !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
}

.message-time {
    font-size: 12px !important;
    color: #999 !important;
    margin-top: 5px !important;
    margin-left: 5px !important;
}

.message.sent .message-time {
    align-self: flex-end !important;
    margin-right: 5px !important;
}

/* Zone de saisie */
.chat-input {
    padding: 15px !important;
    background: white !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
}

.chat-input input {
    flex: 1 !important;
    padding: 10px 15px !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 20px !important;
    margin-right: 10px !important;
    font-size: 14px !important;
    transition: all 0.3s ease !important;
}

.chat-input input:focus {
    outline: none !important;
    border-color: #c17f59 !important;
    box-shadow: 0 0 0 2px rgba(193, 127, 89, 0.1) !important;
}

.chat-input button {
    background: #c17f59 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.chat-input button:hover {
    background: #a0603d !important;
    transform: translateY(-1px) !important;
}

.chat-input button i {
    font-size: 16px !important;
}

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

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.25;
    }
    100% {
        transform: scale(1);
        opacity: 0.5;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: 180px;
    }
}

/* Styles pour les images dans le chat */
.message-content img {
    max-width: 100%;
    border-radius: 8px;
    margin: 5px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.message-content img:hover {
    transform: scale(1.02);
}

/* Style pour le groupe d'images */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 10px 0;
}

.image-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.image-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* Style pour les suggestions rapides */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
    padding: 0 15px;
}

.suggestion-btn {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9em;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.suggestion-btn:hover {
    background: #c17f59;
    color: white;
    border-color: #c17f59;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(193, 127, 89, 0.2);
}

/* Style pour le texte mis en évidence */
.highlight {
    color: #c17f59;
    font-weight: 600;
}

/* Style pour les listes à puces */
.message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-content li {
    margin: 4px 0;
}

/* Style pour les emojis */
.message-content .emoji {
    font-size: 1.2em;
    margin-right: 5px;
}

/* Style pour le bouton de localisation */
.location-btn {
    background: #c17f59;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    margin: 5px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.location-btn i {
    font-size: 1.1em;
}

.location-btn:hover {
    background: #a06847;
}

/* Style pour l'historique des messages */
.chat-history-search {
    padding: 10px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.chat-history-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9em;
}
