/* ---------------------------------------------------
   ESTAD PREMIUM CHATBOT - STANDARD CONFORME
--------------------------------------------------- */

#estad-chatbot-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', 'Source Sans 3', sans-serif;
}

/* --- Floating Button (Avatar) --- */
.chatbot-toggler {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(255, 122, 0, 0.3);
    border: 3px solid #ff7a00;
    transition: width 0.4s ease, height 0.4s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 10000;
    background-size: cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    animation: pulseOrange 2s infinite;
}

@keyframes pulseOrange {
    0% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.8); }
    70% { box-shadow: 0 0 0 20px rgba(255, 122, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0); }
}

/* Avatar réduit quand le chat est ouvert */
.chatbot-toggler.active {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: none;
}

.chatbot-toggler:hover {
    transform: scale(1.05);
}

.chatbot-toggler::before {
    display: none;
}


.chatbot-toggler .ri-close-line {
    font-size: 2rem;
    color: white;
}
.chatbot-toggler.active .ri-close-line {
    opacity: 1 !important;
    transform: rotate(90deg);
}

/* --- Chat Window --- */
.chatbot-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom right;
    border: 1px solid rgba(0,0,0,0.05);
}

.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* --- Header --- */
.chatbot-header {
    background: linear-gradient(135deg, #111827, #1f2937);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    border-bottom: 3px solid #ff7a00;
}

.chatbot-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid #ff7a00;
    background-color: #fff;
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.chatbot-header-info p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
}

/* --- Body (Messages Area) --- */
.chatbot-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat */
.chatbot-body::-webkit-scrollbar {
    width: 6px;
}
.chatbot-body::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* --- Messages --- */
.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeInMsg 0.3s ease-out forwards;
}

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

.chat-msg.bot {
    align-self: flex-start;
}

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

.msg-bubble {
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.chat-msg.bot .msg-bubble {
    background: #ffffff;
    color: #1f2937;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid #e5e7eb;
}

.chat-msg.bot .msg-bubble a {
    color: #ff7a00;
    text-decoration: underline;
    font-weight: 600;
}

.chat-msg.user .msg-bubble {
    background: #ff7a00;
    color: white;
    border-radius: 16px 16px 4px 16px;
}

/* --- Options / Buttons --- */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.chat-option-btn {
    background: #ffffff;
    border: 1px solid #ff7a00;
    color: #ff7a00;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(255,122,0,0.05);
}

.chat-option-btn:hover:not(:disabled) {
    background: #fff5eb;
    transform: translateY(-1px);
}

.chat-option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #d1d5db;
    color: #6b7280;
}

/* --- Typing Indicator --- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 5px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

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

/* --- Chat Footer (Input Area) --- */
.chatbot-footer {
    padding: 15px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 0.9rem;
    color: #111827;
    border: 1px solid #e5e7eb;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: #ff7a00;
}

.chatbot-send-btn {
    width: 35px;
    height: 35px;
    background: #ff7a00;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: 65vh;
        right: -10px;
        bottom: 75px;
    }
}
