/* DoliPlus Chat Widget — v1.1.0 */

/* ── FAB ─────────────────────────────────────────────────────────────── */
#doliplus-chat-fab {
    position: fixed;
    bottom: 110px;
    right: 28px;
    width: 56px;
    height: 56px;
    background: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37,99,235,0.4);
    z-index: 9999;
    transition: transform .2s, box-shadow .2s;
}
#doliplus-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(37,99,235,0.5); }
#doliplus-chat-fab svg { width: 26px; height: 26px; color: #fff; }

/* ── Panel ───────────────────────────────────────────────────────────── */
#doliplus-chat-panel {
    position: fixed;
    bottom: 96px;
    right: 28px;
    width: 360px;
    height: 500px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
}

#doliplus-chat-header {
    background: #2563eb;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}
#doliplus-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

/* ── Messages ────────────────────────────────────────────────────────── */
#doliplus-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}

.doliplus-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    line-height: 1.5;
    word-break: break-word;
}
.doliplus-msg-bot {
    background: #fff;
    border: 1px solid #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.doliplus-msg-user {
    background: #2563eb;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.doliplus-msg-sources {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}
.doliplus-msg-sources a { color: #2563eb; text-decoration: none; }
.doliplus-msg-sources a:hover { text-decoration: underline; }

/* ── Typing ──────────────────────────────────────────────────────────── */
.doliplus-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: 52px;
}
.doliplus-typing span {
    width: 8px; height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: doliplus-bounce .9s infinite;
}
.doliplus-typing span:nth-child(2) { animation-delay: .15s; }
.doliplus-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes doliplus-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ── Input area ──────────────────────────────────────────────────────── */
#doliplus-chat-input-area {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}
#doliplus-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
#doliplus-chat-input:focus { border-color: #2563eb; }
#doliplus-chat-send {
    background: #2563eb;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
#doliplus-chat-send svg { width: 18px; height: 18px; fill: #fff; }
#doliplus-chat-send:disabled { opacity: .5; cursor: not-allowed; }

/* ── Feedback bar ────────────────────────────────────────────────────── */
.doliplus-feedback-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}
.doliplus-feedback-label {
    font-size: 11px;
    color: #94a3b8;
    flex: 1;
}
.doliplus-feedback-btn {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 14px;
    cursor: pointer;
    line-height: 1;
    transition: background .15s, border-color .15s;
}
.doliplus-feedback-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.doliplus-feedback-btn:disabled { opacity: .4; cursor: not-allowed; }
.doliplus-feedback-thanks {
    font-size: 11px;
    color: #64748b;
    font-style: italic;
}

/* ── Feedback modal ──────────────────────────────────────────────────── */
#doliplus-feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.doliplus-feedback-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}
.doliplus-feedback-dialog {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    width: 320px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.doliplus-feedback-title {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 14px;
}
.doliplus-feedback-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.doliplus-feedback-cats button {
    border: 1px solid #e2e8f0!important;
    background: #f8fafc!important;
    color: #374151!important;
    border-radius: 20px!important;
    padding: 5px 12px!important;
    font-size: 12px!important;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.doliplus-feedback-cats button:hover { border-color: #2563eb!important; color: #2563eb!important; }
.doliplus-feedback-cats button.selected {
    background: #2563eb!important;
    border-color: #2563eb!important;
    color: #fff!important;
}
#doliplus-feedback-comment {
    width: 100%;
    box-sizing: border-box;
    height: 72px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    resize: none;
    outline: none;
    font-family: inherit;
    margin-bottom: 14px;
}
#doliplus-feedback-comment:focus { border-color: #2563eb; }
.doliplus-feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
#doliplus-feedback-cancel {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
}
#doliplus-feedback-cancel:hover { background: #f8fafc; }
#doliplus-feedback-submit {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}
#doliplus-feedback-submit:hover { background: #1d4ed8; }

/* ── Widget inline (shortcode) ───────────────────────────────────────── */
.doliplus-chat-inline {
    display: flex;
    flex-direction: column;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
}
.doliplus-chat-messages-inline {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
}
.doliplus-chat-input-area {
    display: flex;
    padding: 10px 12px;
    gap: 8px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}
.doliplus-chat-input-inline {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
.doliplus-chat-send-inline {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}

/* ── Cohabitation reCAPTCHA / 3CX / chat ─────────────────────────────
   reCAPTCHA v3 injecte un badge + un iframe bframe en position:fixed.
   On les neutralise entièrement (pointer-events:none + z-index bas).
   reCAPTCHA v3 fonctionne toujours en arrière-plan sans interaction UI.
   3CX call-us-selector forcé au-dessus pour rester cliquable.
   ─────────────────────────────────────────────────────────────────── */
.grecaptcha-badge {
    left: 14px!important;
    right: auto!important;
    bottom: 14px!important;
    pointer-events: none!important;
    z-index: 1!important;
}

[class*="grecaptcha"]:not(.grecaptcha-badge),
iframe[title="reCAPTCHA"],
iframe[src*="recaptcha"],
iframe[src*="google.com/recaptcha"] {
    pointer-events: none!important;
    z-index: 1!important;
}

call-us-selector {
    z-index: 9997!important;
    pointer-events: auto!important;
}

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    #doliplus-chat-panel { width: calc(100vw - 20px); right: 10px; bottom: 80px; }
    .doliplus-feedback-dialog { width: calc(100vw - 40px); }
}

/* === Section "Pour aller plus loin" (DoliPlus related posts) === */
.doliplus-related-posts {
    margin: 2em 0 1em;
    padding: 1.2em 1.5em;
    background: #f8f9fa;
    border-left: 4px solid #2e6da4;
    border-radius: 0 6px 6px 0;
}
.doliplus-related-title {
    margin: 0 0 0.7em;
    font-size: 1em;
    font-weight: 600;
    color: #2e6da4;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.doliplus-related-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.doliplus-related-item {
    margin: 0.3em 0;
    padding-left: 1.2em;
    position: relative;
}
.doliplus-related-item::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #2e6da4;
}
.doliplus-related-item a {
    color: #2e6da4;
    text-decoration: none;
}
.doliplus-related-item a:hover {
    text-decoration: underline;
}
