/* chatbot.v4.css - Assistant (chatbot v4) : bulle flottante, fenêtre, messages. Chargé seulement si le chatbot est activé (widget_chatbot). */
/* ============================================
   CHATBOT WIDGET - Elegant Design v2
   ============================================ */

/* Overlay for click-outside-to-close */
.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.15);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.chatbot-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Floating Bubble Button with Label */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 10px 12px;
    background: linear-gradient(145deg, var(--default-color) 0%, var(--default-color-dark, #1565c0) 100%);
    color: white;
    border-radius: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.chatbot-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 12px 40px rgba(0, 0, 0, 0.2);
}

.chatbot-fab:active {
    transform: translateY(0);
}

.chatbot-fab-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
}

.chatbot-fab-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Hide FAB when chat is open */
.chatbot-widget:not(.chatbot-minimize) ~ .chatbot-fab {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(20px);
}

/* Main Widget Container */
.chatbot-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 340px;
    max-height: 480px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 
                0 16px 48px rgba(0, 0, 0, 0.08),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    z-index: 1000;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom left;
}

/* Minimized State */
.chatbot-widget.chatbot-minimize {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

/* Header - Compact single row */
.chatbot-header {
    background: linear-gradient(145deg, var(--default-color) 0%, var(--default-color-dark, #1565c0) 100%);
    color: white;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

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

.chatbot-header-content i {
    font-size: 16px;
    opacity: 0.9;
}

.chatbot-header-title {
    font-size: 15px;
    font-weight: 600;
}

.chatbot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.9); }
}

/* Close button */
.chatbot-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 320px;
}

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

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

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

/* Welcome Message */
.chatbot-welcome {
    text-align: center;
    padding: 20px 14px;
    color: #6b7280;
}

.welcome-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: linear-gradient(145deg, #e0f2fe 0%, #bfdbfe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--default-color);
}

.chatbot-welcome p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    animation: messageIn 0.2s ease-out;
}

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

.bot-message, .recall-message {
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.user-message {
    background: var(--default-color);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Choice buttons - compact and obvious */
.bot-action, .recall-action {
    display: block;
    width: 100%;
    padding: 9px 12px;
    margin-top: 4px;
    background: #f0f7ff;
    color: var(--default-color);
    border: 1px solid var(--default-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    text-decoration: none;
}

.bot-action:first-of-type {
    margin-top: 8px;
}

.bot-action:hover, .recall-action:hover {
    background: var(--default-color);
    color: white !important;
    transform: translateX(3px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.bot-action::before, .recall-action::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free', 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 9px;
    margin-right: 8px;
    opacity: 0.6;
}

.bot-action:hover::before, .recall-action:hover::before {
    opacity: 1;
}

/* Go home link */
.chatbot-go-home {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.chatbot-go-home small {
    font-size: 11px;
    cursor: pointer;
}

.chatbot-go-home small:hover {
    color: var(--default-color) !important;
}

/* Input Area */
.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    background: white;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.chatbot-input-area.chatbot-input-hidden {
    opacity: 0;
    max-height: 0;
    padding: 0 14px;
    overflow: hidden;
    border-top: none;
}

.chatbot-input-area.chatbot-input-visible {
    opacity: 1;
    max-height: 80px;
    animation: fadeInInput 0.3s ease;
}

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

.chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.chatbot-input:focus {
    border-color: var(--default-color);
    box-shadow: 0 0 0 3px rgba(var(--default-color-rgb, 59, 130, 246), 0.1);
    background: white;
}

.chatbot-input::placeholder {
    color: #9ca3af;
}

.chatbot-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--default-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: var(--default-color-dark, #1565c0);
    transform: scale(1.05);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    background: white;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chatbot-widget {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 100px);
        bottom: 8px;
        left: 8px;
        right: 8px;
    }

    .chatbot-fab {
        bottom: 16px;
        left: 16px;
    }
    
    .chatbot-messages {
        max-height: calc(100vh - 220px);
    }
}
