/* Essipit Chatbot Styles */

/* Bouton flottant */
#essipit-chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #E87722 0%, #ff9547 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(232, 119, 34, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#essipit-chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(232, 119, 34, 0.6);
    background: linear-gradient(135deg, #ff9547 0%, #E87722 100%);
}

#essipit-chatbot-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Conteneur principal du chatbot */
#essipit-chatbot-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#essipit-chatbot-container.active {
    display: flex;
}

/* Header */
.essipit-chatbot-header {
    background: linear-gradient(135deg, #E87722 0%, #ff9547 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.essipit-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.essipit-chatbot-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.essipit-chatbot-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.essipit-chatbot-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.essipit-chatbot-title p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.essipit-chatbot-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.essipit-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.essipit-chatbot-close svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Messages container */
.essipit-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #e0f2fe 100%);
}

/* Message bubble */
.essipit-chatbot-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

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

.essipit-chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.essipit-chatbot-message.assistant .essipit-chatbot-message-avatar {
    background: linear-gradient(135deg, #E87722 0%, #ff9547 100%);
}

.essipit-chatbot-message.user .essipit-chatbot-message-avatar {
    background: linear-gradient(135deg, #E87722 0%, #ff9547 100%);
}

.essipit-chatbot-message-avatar svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.essipit-chatbot-message.user {
    flex-direction: row-reverse;
}

.essipit-chatbot-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.essipit-chatbot-message-content ul {
    margin: 2px 0 12px 0;
    padding-left: 20px;
}

.essipit-chatbot-message-content ul + ul {
    margin-top: 0;
}

.essipit-chatbot-message-content li {
    margin: 0;
}

.essipit-chatbot-message-content strong {
    font-weight: 600;
}

.essipit-chatbot-message-content a {
    color: inherit;
    text-decoration: underline;
}

.essipit-chatbot-message.assistant .essipit-chatbot-message-content {
    background: #F5F5F5;
    color: #0A1628;
    border-top-left-radius: 4px;
    border-left: 3px solid #E87722;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.essipit-chatbot-message.user .essipit-chatbot-message-content {
    background: linear-gradient(135deg, #E87722 0%, #ff9547 100%);
    color: white;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(232, 119, 34, 0.2);
}

/* Typing indicator */
.essipit-chatbot-typing {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.essipit-chatbot-typing.active {
    display: flex;
}

.essipit-chatbot-typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.essipit-chatbot-typing-avatar svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.essipit-chatbot-typing-dots {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-top-left-radius: 4px;
    display: flex;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.essipit-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.essipit-chatbot-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.essipit-chatbot-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Quick questions */
.essipit-chatbot-quick-questions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

.essipit-chatbot-quick-question {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.essipit-chatbot-quick-question:hover {
    background: #f1f5f9;
    border-color: #E87722;
    color: #E87722;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(232, 119, 34, 0.1);
}

/* Input container */
.essipit-chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.essipit-chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.essipit-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.essipit-chatbot-input:focus {
    outline: none;
    border-color: #E87722;
    box-shadow: 0 0 0 3px rgba(232, 119, 34, 0.1);
}

.essipit-chatbot-input::placeholder {
    color: #94a3b8;
}

.essipit-chatbot-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #E87722;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.essipit-chatbot-send-btn:hover:not(:disabled) {
    background: #ff9547;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(232, 119, 34, 0.3);
}

.essipit-chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.essipit-chatbot-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Contact agent button */
.essipit-chatbot-contact-agent {
    margin-top: 12px;
    text-align: center;
}

.essipit-chatbot-contact-btn {
    background: #2d5f5d;
    border: 2px solid #2d5f5d;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.essipit-chatbot-contact-btn:hover {
    background: #3a7673;
    border-color: #3a7673;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 95, 93, 0.3);
}

.essipit-chatbot-contact-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Responsive */
@media (max-width: 480px) {
    #essipit-chatbot-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #essipit-chatbot-toggle {
        bottom: 15px;
        right: 15px;
    }
}

/* Scrollbar */
.essipit-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.essipit-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.essipit-chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

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

/* Message metadata badges */
.essipit-chatbot-message-meta {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.essipit-meta-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.85;
}

.essipit-meta-badge.model {
    background-color: #E87722;
    color: white;
}

.essipit-meta-badge.version {
    background-color: #2d5f5d;
    color: white;
}