/* Styles pour le chatbot Matrix */
:root {
    --chatbot-accent: #007C37;
    --chatbot-bg: rgba(255, 255, 255, 0.95);
    --chatbot-text: #333;
    --chatbot-border: rgba(0, 124, 55, 0.4);
    --chatbot-shadow: 0 0 15px rgba(0, 124, 55, 0.3);
    --chatbot-hover: rgba(0, 124, 55, 0.1);
    --chatbot-message-bg: rgba(240, 248, 245, 0.7);
    --chatbot-user-message-bg: rgba(232, 245, 240, 0.8);
    --chatbot-width: 360px;
    --chatbot-height: 520px;
    --chatbot-image-border: rgba(0, 124, 55, 0.6);
    --chatbot-image-bg: rgba(232, 245, 240, 0.5);
}

/* Container principal */
.matrix-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Roboto Mono', monospace;
    color: var(--chatbot-text);
}

/* Bouton d'activation du chatbot */
.chatbot-toggle {
    display: flex;
    align-items: center;
    background: var(--chatbot-bg);
    padding: 8px 20px 8px 12px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--chatbot-shadow);
    border: 1px solid var(--chatbot-border);
    transition: all 0.3s ease;
}

.chatbot-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(0, 124, 55, 0.3);
}

.chatbot-icon {
    background: linear-gradient(to right, var(--chatbot-accent), rgba(0, 163, 74, 0.7));
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    box-shadow: 0 0 10px rgba(0, 124, 55, 0.5);
}

.chatbot-icon i {
    color: #000;
    font-size: 18px;
}

.chatbot-status {
    display: flex;
    align-items: center;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--chatbot-accent);
    border-radius: 50%;
    margin-right: 6px;
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 124, 55, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(0, 124, 55, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 124, 55, 0);
    }
}

.status-text {
    font-size: 14px;
    font-weight: 500;
}

/* Conteneur de la fenêtre de chat */
.chatbot-container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: var(--chatbot-width);
    height: var(--chatbot-height);
    background: var(--chatbot-bg);
    border-radius: 10px;
    border: 1px solid var(--chatbot-border);
    box-shadow: var(--chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    pointer-events: none;
}

.chatbot-container.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* En-tête du chatbot */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: linear-gradient(to right, rgba(232, 245, 240, 0.9), rgba(240, 248, 245, 0.9));
    border-bottom: 1px solid var(--chatbot-border);
}

.chatbot-title {
    display: flex;
    align-items: center;
}

.chatbot-title i {
    color: var(--chatbot-accent);
    font-size: 20px;
    margin-right: 10px;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    color: var(--chatbot-accent);
    font-weight: 500;
}

.chatbot-controls button {
    background: none;
    border: none;
    color: var(--chatbot-text);
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    padding: 5px;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.chatbot-controls button:hover {
    opacity: 1;
    color: var(--chatbot-accent);
}

/* Zone des messages */
.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--chatbot-accent) var(--chatbot-bg);
}

.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--chatbot-bg);
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background-color: var(--chatbot-accent);
    border-radius: 6px;
}

/* Messages */
.message {
    display: flex;
    max-width: 85%;
}

.bot-message {
    align-self: flex-start;
}

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

.message-content {
    padding: 10px 15px;
    border-radius: 12px;
    position: relative;
    line-height: 1.5;
}

.bot-message .message-content {
    background: var(--chatbot-message-bg);
    border-top-left-radius: 0;
    border-left: 2px solid var(--chatbot-accent);
}

.user-message .message-content {
    background: var(--chatbot-user-message-bg);
    border-top-right-radius: 0;
    border-right: 2px solid var(--chatbot-accent);
}

.message-content p {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-time {
    display: block;
    font-size: 11px;
    margin-top: 5px;
    opacity: 0.7;
    text-align: right;
}

/* Styles pour les images dans les messages */
.chatbot-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid var(--chatbot-image-border);
    background-color: var(--chatbot-image-bg);
    transition: all 0.3s ease;
    cursor: pointer;
}

.chatbot-img:hover {
    transform: scale(1.03);
    box-shadow: 0 0 10px rgba(0, 124, 55, 0.4);
}

/* Image en plein écran */
.chatbot-img-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chatbot-img-fullscreen.active {
    opacity: 1;
    pointer-events: all;
}

.chatbot-img-fullscreen img {
    max-width: 90%;
    max-height: 90%;
    border: 2px solid var(--chatbot-image-border);
    border-radius: 5px;
}

.chatbot-img-fullscreen .close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: var(--chatbot-text);
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.5);
}

.chatbot-img-fullscreen .close-fullscreen:hover {
    background-color: rgba(0, 124, 55, 0.2);
    color: var(--chatbot-accent);
}

/* Image envoyée par l'utilisateur */
.user-img-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
    max-width: 150px;
    max-height: 150px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--chatbot-image-border);
}

.user-img-preview img {
    width: 100%;
    height: auto;
}

.user-img-preview .remove-img {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    background-color: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.user-img-preview .remove-img:hover {
    background-color: rgba(255, 0, 0, 0.7);
}

/* Upload d'image */
.image-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--chatbot-message-bg);
    border: 1px solid var(--chatbot-border);
    color: var(--chatbot-text);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    margin-right: 10px;
}

.image-upload:hover {
    background-color: var(--chatbot-hover);
    color: var(--chatbot-accent);
}

.image-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.image-upload i {
    font-size: 14px;
}

/* Quick replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-btn {
    background: rgba(0, 124, 55, 0.15);
    border: 1px solid var(--chatbot-border);
    color: var(--chatbot-accent);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-reply-btn:hover {
    background: rgba(0, 124, 55, 0.3);
    transform: translateY(-2px);
}

/* Indicateur de saisie */
.chatbot-typing {
    display: none;
    padding: 10px 15px;
}

.chatbot-typing.active {
    display: block;
}

.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: var(--chatbot-accent);
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
    animation: typing 1s infinite;
}

.typing-indicator span:nth-of-type(2) {
    animation: typing 1s 0.33s infinite;
}

.typing-indicator span:nth-of-type(3) {
    animation: typing 1s 0.66s infinite;
}

@keyframes typing {
    0% {
        transform: translateY(0px);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-5px);
        opacity: 1;
    }
    100% {
        transform: translateY(0px);
        opacity: 0.4;
    }
}

/* Zone de saisie */
.chatbot-input {
    padding: 12px 15px;
    display: flex;
    border-top: 1px solid var(--chatbot-border);
    background: rgba(240, 248, 245, 0.7);
}

.chatbot-input-wrapper {
    flex: 1;
    display: flex;
    position: relative;
}

.chatbot-input input {
    flex: 1;
    border: none;
    background: var(--chatbot-message-bg);
    padding: 10px 15px;
    border-radius: 20px;
    color: var(--chatbot-text);
    font-family: inherit;
    border: 1px solid var(--chatbot-border);
}

.chatbot-input input:focus {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: 0 0 5px rgba(0, 124, 55, 0.3);
}

.chatbot-input input::placeholder {
    color: rgba(51, 51, 51, 0.5);
}

.send-btn {
    background: linear-gradient(to right, var(--chatbot-accent), rgba(0, 163, 74, 0.8));
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn i {
    color: #000;
    font-size: 14px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(0, 124, 55, 0.5);
}

/* Pied de page du chatbot */
.chatbot-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    font-size: 11px;
    opacity: 0.7;
    background: rgba(240, 248, 245, 0.5);
}

.chatbot-features {
    display: flex;
    gap: 10px;
}

.feature-btn {
    background: none;
    border: none;
    color: var(--chatbot-text);
    font-size: 12px;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.feature-btn:hover {
    color: var(--chatbot-accent);
    opacity: 1;
}

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

.message {
    animation: messageIn 0.3s ease forwards;
}

/* Responsive design */
@media (max-width: 576px) {
    :root {
        --chatbot-width: 300px;
        --chatbot-height: 450px;
    }

    .chatbot-container {
        bottom: 60px;
        right: 0;
    }

    .chatbot-toggle {
        padding: 8px 15px 8px 10px;
    }

    .chatbot-icon {
        width: 32px;
        height: 32px;
    }

    .status-text {
        font-size: 12px;
    }

    .chatbot-img-fullscreen img {
        max-width: 95%;
        max-height: 80%;
    }
}
