/* === ROOT CONTAINER ===================================================== */

#askthechefzac-widget-root,
.askthechefzac-widget-root {
    position: fixed !important;
    LEFT: 20px !important;
    bottom: 146px !important;
    z-index: 99999 !important;
    pointer-events: none; /* panel & button will restore pointer-events */
    width: auto !important;
    max-width: none !important;
}

/* === TOGGLE BUTTON ====================================================== */

.askthechefzac-toggle-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    outline: none;
    border: 2px solid rgba(15, 23, 42, 0.08);
    background: linear-gradient(135deg, #f97316, #fb923c); /* orange vif par défaut */
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        opacity 0.2s ease,
        background-color 0.2s ease;
}

/* Label & icône */
.askthechefzac-btn-label {
    white-space: nowrap;
    color: inherit;
}

.askthechefzac-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.askthechefzac-btn-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
}

/* États bouton */
.askthechefzac-toggle-btn:hover,
.askthechefzac-toggle-btn:focus-visible {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.30);
    opacity: 1;
}

.askthechefzac-toggle-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* Masqué avant le seuil de scroll */
.askthechefzac-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px);
}

/* Petite animation pour attirer l’œil une fois visible */
.askthechefzac-animate {
    animation: askthechefzac-pulse 2.2s ease-in-out infinite;
}

@keyframes askthechefzac-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.35);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(249, 115, 22, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

/* === PANEL (POPUP) ====================================================== */

.askthechefzac-panel {
    pointer-events: auto;
    position: fixed;
    right: 20px;
    bottom: 80px;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    border-radius: 14px;
    border: 2px solid #ffb347; /* peut être overridé en inline */
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    pointer-events: none;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

/* Panel ouvert */
.askthechefzac-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: askthechefzac-panel-pulse 1.4s ease-in-out infinite;
}

/* Aura autour de la fenêtre */
@keyframes askthechefzac-panel-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.25);
    }
    100% {
        box-shadow: 0 0 0 12px rgba(249, 115, 22, 0);
    }
}

/* Header */
.askthechefzac-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: #ff6b6b; /* peut être overridé en inline */
    color: #ffffff;
}

.askthechefzac-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.askthechefzac-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.askthechefzac-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.askthechefzac-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

/* === MESSAGES =========================================================== */

.askthechefzac-messages {
    padding: 10px 10px 8px;
    background: #f8f9fb;
    max-height: 280px;
    min-height: 100px;
    overflow-y: auto;
    font-size: 13px;
}

.askthechefzac-msg {
    display: flex;
    margin-bottom: 6px;
}

.askthechefzac-msg-user {
    justify-content: flex-end;
}

.askthechefzac-msg-assistant {
    justify-content: flex-start;
}

.askthechefzac-msg-bubble {
    max-width: 80%;
    padding: 8px 10px;
    border-radius: 12px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-line;
}

/* Couleurs bulles (utilisateur / assistant) */
.askthechefzac-msg-user .askthechefzac-msg-bubble {
    background: #4f46e5;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.askthechefzac-msg-assistant .askthechefzac-msg-bubble {
    background: #ffffff;
    color: #111827;
    border-bottom-left-radius: 2px;
    border: 1px solid #e5e7eb;
}

/* === INPUT ROW ========================================================== */

.askthechefzac-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 10px 10px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.askthechefzac-input {
    flex: 1;
    resize: none;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    padding: 6px 8px;
    font-size: 13px;
    min-height: 32px;
    max-height: 80px;
    line-height: 1.3;
}

.askthechefzac-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.askthechefzac-send {
    flex-shrink: 0;
    border-radius: 999px;
    border: none;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: #4b5563;
    color: #ffffff;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.askthechefzac-send:hover {
    background: #111827;
    transform: translateY(-1px);
}

.askthechefzac-send:active {
    transform: translateY(1px);
}

/* État loading côté input */
.askthechefzac-panel.askthechefzac-loading .askthechefzac-send {
    opacity: 0.7;
    cursor: wait;
}

.askthechefzac-panel.askthechefzac-loading .askthechefzac-input-row {
    opacity: 0.6;
    pointer-events: none;
}

/* === LOADER "TYPING..." ================================================ */

.askthechefzac-msg.askthechefzac-typing .askthechefzac-msg-bubble {
    opacity: 0.9;
}

.askthechefzac-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.askthechefzac-dots span {
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background-color: currentColor; /* même couleur que le texte assistant */
    opacity: 0.4;
    animation: askthechefzac-dot-bounce 0.8s infinite alternate;
}

.askthechefzac-dots span:nth-child(2) {
    animation-delay: 0.12s;
}

.askthechefzac-dots span:nth-child(3) {
    animation-delay: 0.24s;
}

@keyframes askthechefzac-dot-bounce {
    from {
        transform: translateY(0);
        opacity: 0.3;
    }
    to {
        transform: translateY(-3px);
        opacity: 1;
    }
}

/* === RESPONSIVE ========================================================= */

@media (max-width: 480px) {
    .askthechefzac-panel {
        right: 10px;
        bottom: 70px;
        width: calc(100vw - 20px);
    }

    #askthechefzac-widget-root,
    .askthechefzac-widget-root {
        right: 10px;
        bottom: 10px;
    }
}


/* === ASK THE CHEF – RESPONSIVE POSITIONING === */

/* MOBILE & TABLET (default) – bottom-right but above ads */
.askthechefzac-widget-root {
    position: fixed;
    right: 1rem;        /* a bit tighter on small screens */
    bottom: 6rem !important;       /* lifted above Ezoic footer/video */
    z-index: 99999;
}

.askthechefzac-widget-root .askthechefzac-panel {
    position: fixed;
    left: 1rem;
    /*bottom: 15rem !important; */      /* same offset as button */
    z-index: 100000;
}

/* DESKTOP – move to mid-right, never hidden by footer or sticky video */
@media (min-width: 1024px) {
    .askthechefzac-widget-root {
        right: 1.5rem;
        /*top: 50% !important;*/                    /* middle of screen */
        transform: translateY(-50%);
    }

    .askthechefzac-widget-root .askthechefzac-panel {
        right: 1.5rem;
        bottom: -3rem !important;
        /*top: 50% !important;*/                    /* align panel with button */
        transform: translateY(-50%);
    }
}
