/**
 * Styles pour le widget de chat
 */

.chat-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-lighter) 100%);
    border: 2px solid var(--primary);
    color: var(--primary);
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26, 26, 46, 0.4);
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(26, 26, 46, 0.6);
    background: linear-gradient(135deg, var(--dark-lighter) 0%, var(--dark) 100%);
}

.chat-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.chat-widget.chat-open {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-widget-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-lighter) 100%);
    color: var(--white);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
    overflow: hidden;
}

.chat-avatar::before {
    content: '🐝';
    font-size: 1.5rem;
}

.chat-header-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.chat-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-widget-body {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f9f9f9;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    min-width: 0; /* Permet au contenu de se rétrécir si nécessaire */
    animation: fadeIn 0.3s ease-out;
}

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

.chat-message-user {
    align-self: flex-end;
}

.chat-message-admin {
    align-self: flex-start;
}

.chat-message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-message-user .chat-message-content {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-lighter) 100%);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-message-admin .chat-message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

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

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: var(--dark);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

.chat-emoji-btn,
.chat-attach-btn,
.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s ease, transform 0.2s ease;
}

.chat-emoji-btn:hover,
.chat-attach-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-lighter) 100%);
    color: var(--white);
}

.chat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(26, 26, 46, 0.4);
    background: linear-gradient(135deg, var(--dark-lighter) 0%, var(--dark) 100%);
}

/* Styles pour les images dans les messages */
.chat-message-image {
    margin-bottom: 0.5rem;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
    min-width: 0; /* Permet à l'image de se rétrécir */
    cursor: pointer;
    transition: transform 0.2s ease;
    align-self: flex-start; /* Aligner à gauche par défaut */
}

.chat-message-image:hover {
    transform: scale(1.02);
}

.chat-message-image img {
    width: 100%;
    max-width: 100%;
    max-height: 400px;
    height: auto;
    min-width: 200px; /* Largeur minimale pour garantir la visibilité */
    display: block;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.chat-message-image img.chat-image-expanded {
    max-width: 500px;
    cursor: zoom-out;
}

.chat-message-user .chat-message-image {
    align-self: flex-end;
    max-width: 100%;
}

.chat-message-admin .chat-message-image {
    align-self: flex-start;
    max-width: 100%;
}

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

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

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

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

/* Notification au-dessus du chat */
.chat-notification {
    position: fixed;
    bottom: 90px; /* Au-dessus du chat toggle (60px + 20px bottom + 10px espace) */
    left: 20px;
    width: 320px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10001; /* Au-dessus du chat toggle (9999) et du widget (10000) */
    display: none;
    flex-direction: column;
    animation: slideUpNotification 0.4s ease-out;
    overflow: hidden;
}

.chat-notification.show {
    display: flex;
}

@keyframes slideUpNotification {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}

.chat-notification-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a2e;
    margin: 0;
}

.chat-notification-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.chat-notification-close:hover {
    background: #f0f0f0;
    color: #333;
}

.chat-notification-logo {
    display: flex;
    gap: -8px; /* Chevauchement des cercles */
    margin-left: 0.5rem;
    position: relative;
}

.chat-notification-logo-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1a1a2e;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}

.chat-notification-logo-circle:first-child {
    z-index: 2;
}

.chat-notification-logo-circle:last-child {
    margin-left: -10px; /* Chevauchement */
    z-index: 1;
}

.chat-notification-content {
    padding: 1rem 1.25rem;
}

.chat-notification-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #333;
}

.chat-notification-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 2s infinite;
}

.chat-notification-button {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-notification-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 26, 46, 0.3);
}

.chat-notification-button-icon {
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
        max-height: calc(100vh - 40px);
    }

    .chat-widget-body {
        height: calc(100vh - 200px);
    }
    
    .chat-notification {
        width: calc(100vw - 40px);
        left: 20px;
    }
}

