/* Styles du widget chatbot */

#bzhbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#bzhbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #b7d774;
    border: 2px solid #b7d774;
    color: white;
    cursor: pointer;
    box-shadow: 0px 0px 59px 0px rgba(0, 0, 0, 0.13);
    transition: all 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
}

#bzhbot-toggle svg {
    width: 28px;
    height: 28px;
    display: block;
}

#bzhbot-toggle:hover {
    transform: scale(1.1);
    background: #FFF;
    color: #b7d774;
    box-shadow: 0px 0px 59px 0px rgba(0, 0, 0, 0.13);
}

#bzhbot-toggle.active {
    background: #543727;
    border-color: #543727;
    color: white;
}

#bzhbot-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    min-height: 400px; /* Hauteur minimale pour une utilisation confortable */
    max-height: calc(100vh - 100px); /* Hauteur max = viewport - bouton toggle (60px) - marges (40px) */
    height: 600px; /* Hauteur par défaut, mais limitée par max-height */
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

/* Ajuster la hauteur pour les petits viewports */
@media (max-height: 700px) {
    #bzhbot-container {
        height: calc(100vh - 100px);
        min-height: 300px; /* Réduire la hauteur minimale sur petits écrans */
    }
}

#bzhbot-container.active {
    display: flex;
}

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

#bzhbot-header {
    background: #b7d774;
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#bzhbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

#bzhbot-header h3 .bzhbot-icon-chat {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

#bzhbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#bzhbot-close svg {
    width: 20px;
    height: 20px;
    display: block;
}

#bzhbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

#bzhbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
}

.bzhbot-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.bzhbot-message.user {
    align-self: flex-end;
    background: #b7d774;
    color: white;
    border-bottom-right-radius: 4px;
    font-size: 13px;
}

.bzhbot-message.bot {
    align-self: flex-start;
    background: white;
    color: #543727;
    border-bottom-left-radius: 4px;
    box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.13);
    font-size: 13px;
}

/* Styles pour le contenu Markdown dans les messages du bot */
.bzhbot-message.bot p {
    margin: 0 0 8px 0;
    line-height: 1.5;
    font-size: 13px;
}

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

.bzhbot-message.bot strong {
    font-weight: 700;
    color: #543727;
}

.bzhbot-message.bot em {
    font-style: italic;
}

.bzhbot-message.bot code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #543727;
}

.bzhbot-message.bot ul,
.bzhbot-message.bot ol {
    margin: 8px 0;
    padding-left: 20px;
}

.bzhbot-message.bot ul {
    list-style-type: disc;
}

.bzhbot-message.bot ol {
    list-style-type: decimal;
}

.bzhbot-message.bot li {
    margin: 4px 0;
    line-height: 1.5;
}

.bzhbot-message.bot a {
    color: #b7d774;
    text-decoration: underline;
    transition: color 0.2s;
}

.bzhbot-message.bot a:hover {
    color: #543727;
}

.bzhbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 60px;
}

.bzhbot-typing span {
    width: 8px;
    height: 8px;
    background: #b7d774;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.bzhbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.bzhbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

#bzhbot-form-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

#bzhbot-input-container {
    display: flex;
    gap: 10px;
}

#bzhbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    color: #543727;
    min-height: 44px;
    max-height: 120px;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.4;
}

#bzhbot-input::placeholder {
    color: #b7d774;
    opacity: 0.7;
}

#bzhbot-input:focus {
    border-color: #b7d774;
    box-shadow: none;
}

#bzhbot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #b7d774;
    border: 2px solid #b7d774;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s;
    flex-shrink: 0;
    padding: 0;
    box-shadow: 0px 0px 59px 0px rgba(0, 0, 0, 0.13);
}

#bzhbot-send svg {
    width: 20px;
    height: 20px;
    display: block;
}

#bzhbot-send:hover {
    transform: scale(1.1);
    background: #FFF;
    color: #b7d774;
    border-color: #b7d774;
}

#bzhbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

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

#bzhbot-messages::-webkit-scrollbar-thumb {
    background: #b7d774;
    border-radius: 3px;
}

#bzhbot-messages::-webkit-scrollbar-thumb:hover {
    background: #543727;
}

/* Suggestions de réponses */
.bzhbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
}

.bzhbot-suggestion {
    padding: 10px 16px;
    background: white;
    border: 2px solid #b7d774;
    color: #543727;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bzhbot-suggestion:hover {
    background: #b7d774;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(183, 215, 116, 0.3);
}

.bzhbot-suggestion:active {
    transform: translateY(0);
}

.bzhbot-suggestion-other {
    border-color: #543727;
    background: #543727;
    color: white;
}

.bzhbot-suggestion-other:hover {
    background: #543727;
    border-color: #b7d774;
    color: #b7d774;
}

/* Responsive */
@media (max-width: 480px) {
    #bzhbot-container {
        width: calc(100vw - 40px);
        max-height: calc(100vh - 100px);
        height: calc(100vh - 100px); /* Sur mobile, utiliser toute la hauteur disponible */
        right: 20px;
        bottom: 80px;
    }
    
    .bzhbot-suggestions {
        gap: 6px;
    }
    
    .bzhbot-suggestion {
        padding: 8px 12px;
        font-size: 13px;
    }
}
