/* Chatbot ESCA */
.chatbot-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 130px);
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(15, 45, 94, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1500;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.chatbot-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* En-tete */
.chatbot-header {
    background: linear-gradient(135deg, #173F8A, #0F2D5E);
    color: #FFFFFF;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.chatbot-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F39C12, #E67E22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #FFFFFF;
    flex-shrink: 0;
}
.chatbot-avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}
.chatbot-header-info strong {
    display: block;
    font-family: var(--font-titres);
    font-size: 0.98rem;
    font-weight: 800;
    margin-bottom: 2px;
}
.chatbot-header-info span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-corps);
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
}
.chatbot-header-info span i {
    font-size: 0.5rem;
    color: #25D366;
}
.chatbot-close {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #FFFFFF;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* Zone messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    background: var(--blanc-casse);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(23, 63, 138, 0.2);
    border-radius: 3px;
}

/* Lignes de messages */
.chatbot-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.chatbot-row-bot {
    justify-content: flex-start;
}
.chatbot-row-user {
    justify-content: flex-end;
}

/* Bulles */
.chatbot-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 16px;
    font-family: var(--font-corps);
    font-size: 0.92rem;
    line-height: 1.55;
}
.chatbot-bubble-bot {
    background: #FFFFFF;
    color: var(--noir);
    border: 1px solid #E4E7EC;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
}
.chatbot-bubble-user {
    background: var(--bleu-institutionnel);
    color: #FFFFFF;
    border-top-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(23, 63, 138, 0.25);
}

/* Chips */
.chatbot-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 0 42px;
}
.chatbot-chips-back {
    padding-left: 0;
    padding-top: 6px;
}
.chatbot-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    background: #FFFFFF;
    border: 1px solid #E4E7EC;
    border-radius: 50px;
    font-family: var(--font-titres);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bleu-institutionnel);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}
.chatbot-chip:hover {
    background: var(--bleu-institutionnel);
    color: #FFFFFF;
    border-color: var(--bleu-institutionnel);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(23, 63, 138, 0.25);
}
.chatbot-chip i { font-size: 0.75rem; }
.chatbot-chip-back {
    background: transparent;
    color: var(--orange-accent);
    border-color: var(--orange-accent);
    font-weight: 700;
}
.chatbot-chip-back:hover {
    background: var(--orange-accent);
    color: #FFFFFF;
    border-color: var(--orange-accent);
}

/* Bouton lien */
.chatbot-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-top: 6px;
    background: var(--orange-accent);
    color: #FFFFFF;
    border-radius: 10px;
    font-family: var(--font-titres);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}
.chatbot-link-btn:hover {
    background: #E67E22;
    transform: translateY(-2px);
    gap: 12px;
}

/* Zone saisie */
.chatbot-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #FFFFFF;
    border-top: 1px solid #E4E7EC;
    flex-shrink: 0;
}
.chatbot-input-row input {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid #E4E7EC;
    border-radius: 50px;
    font-family: var(--font-corps);
    font-size: 0.9rem;
    color: var(--noir);
    outline: none;
    transition: border-color 0.2s ease;
}
.chatbot-input-row input:focus {
    border-color: var(--bleu-institutionnel);
}
.chatbot-input-row input::placeholder {
    color: #98A2B3;
}
.chatbot-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--bleu-institutionnel);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.chatbot-send:hover {
    background: var(--bleu-fonce);
    transform: scale(1.06);
}

/* Lien fixe en bas */
.chatbot-footer-link {
    padding: 10px 16px 12px;
    background: var(--blanc-casse);
    border-top: 1px solid #E4E7EC;
    text-align: center;
    flex-shrink: 0;
}
.chatbot-footer-link a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #25D366;
    font-family: var(--font-titres);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}
.chatbot-footer-link a:hover {
    color: #1EA952;
    gap: 10px;
}

/* Mobile : fenetre centree avec fond assombri */
@media (max-width: 500px) {
    .chatbot-panel {
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: calc(100% - 32px);
        max-width: 420px;
        height: 72vh;
        max-height: 560px;
        border-radius: 20px;
        transform: translate(-50%, -50%) scale(0.94);
    }
    .chatbot-panel.open {
        transform: translate(-50%, -50%) scale(1);
        box-shadow:
            0 0 0 100vmax rgba(8, 12, 34, 0.55),
            0 20px 60px rgba(15, 45, 94, 0.35);
    }
}