/* ══════════════════════════════════════════════════════════════════════
   LibeRté by Suzanne — Conseiller Beauté Client (CSS isolé)
   Prefixe strict : .lcb- / #liberte-chat- (aucun conflit avec la page).
   ══════════════════════════════════════════════════════════════════════ */

#liberte-chat-btn {
    position: fixed;
    right: 20px;
    bottom: 122px;
    z-index: 3200;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    border-radius: 999px;
    border: 1.5px solid #00BCD4;
    background: linear-gradient(135deg, #006064 0%, #00838F 100%);
    color: #FFFFFF;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 26px rgba(0, 96, 100, 0.34);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

body.lcb-page-secondaire #liberte-chat-btn {
    bottom: 24px;
}

#liberte-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 188, 212, 0.42);
}

#liberte-chat-btn:focus-visible {
    outline: 3px solid #80DEEA;
    outline-offset: 2px;
}

#liberte-chat-btn .lcb-btn-ico {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #80DEEA;
}

#liberte-chat-btn .lcb-btn-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ADE80;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
}

/* Effacement propre si modale, panier ou panneau ouvert */
body.panier-ouvert #liberte-chat-btn,
body.verrou-defilement #liberte-chat-btn,
html.verrou-defilement #liberte-chat-btn,
body.lcb-ouvert #liberte-chat-btn,
body.lcb-ouvert #ptn-badge-rappel,
body.lcb-ouvert #fab,
body.lcb-ouvert #suzanne-acces-annonces {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Panneau principal */
#liberte-chat-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 3350;
    margin: 0;
    padding: 0;
    width: min(404px, calc(100vw - 24px));
    height: min(610px, calc(100dvh - 36px));
    max-height: calc(100dvh - 24px);
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border: 1px solid rgba(0, 188, 212, 0.35);
    border-radius: 22px;
    box-shadow: 0 22px 60px rgba(0, 48, 52, 0.28), 0 4px 16px rgba(0, 188, 212, 0.14);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #2C2C2C;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
    box-sizing: border-box;
}

#liberte-chat-panel *,
#liberte-chat-panel *::before,
#liberte-chat-panel *::after {
    box-sizing: border-box;
}

#liberte-chat-panel.lcb-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
}

/* En-tête */
.lcb-header {
    background: linear-gradient(135deg, #005c5a 0%, #007d84 100%);
    color: #FFFFFF;
    padding: 14px 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.lcb-title-wrap {
    min-width: 0;
}

.lcb-title {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.2;
    color: #FFFFFF;
}

.lcb-sub {
    margin: 3px 0 0;
    font-size: 0.76rem;
    color: #E0F7FA;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.lcb-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.16);
    color: #FFFFFF;
}

.lcb-mode-pill.lcb-ralenti {
    background: rgba(251, 191, 36, 0.24);
    color: #FEF3C7;
}

.lcb-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.lcb-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s ease;
}

.lcb-icon-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}

/* Messages */
.lcb-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
    background: #F6FBFB;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lcb-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    gap: 6px;
}

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

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

.lcb-bubble {
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 0.89rem;
    line-height: 1.48;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.lcb-msg-user .lcb-bubble {
    background: #006064;
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
}

.lcb-msg-bot .lcb-bubble {
    background: #FFFFFF;
    color: #263238;
    border: 1px solid rgba(0, 188, 212, 0.22);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 96, 100, 0.05);
}

.lcb-bubble strong {
    font-weight: 700;
    color: inherit;
}

.lcb-user-img {
    max-width: 170px;
    max-height: 170px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #B2EBF2;
    display: block;
}

/* Chips de démarrage */
.lcb-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.lcb-starter-btn {
    border: 1px solid #80DEEA;
    background: #FFFFFF;
    color: #006064;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.lcb-starter-btn:hover {
    background: #E0F7FA;
    border-color: #00BCD4;
}

/* Fiches prestations suggérées */
.lcb-suggestions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.lcb-srv-card {
    background: #FFFFFF;
    border: 1px solid #B2EBF2;
    border-left: 3px solid #00BCD4;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lcb-srv-info {
    min-width: 0;
    flex: 1 1 auto;
}

.lcb-srv-name {
    font-size: 0.81rem;
    font-weight: 600;
    color: #005c5a;
    line-height: 1.25;
}

.lcb-srv-meta {
    font-size: 0.74rem;
    color: #546E7A;
    margin-top: 2px;
}

.lcb-srv-cta {
    flex-shrink: 0;
    border: none;
    border-radius: 8px;
    background: #00BCD4;
    color: #FFFFFF;
    padding: 6px 10px;
    font-size: 0.76rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.lcb-srv-cta:hover {
    background: #0097A7;
}

/* Indicateur attente / cadence lente */
.lcb-typing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 14px;
    background: #FFFFFF;
    border: 1px solid rgba(0, 188, 212, 0.22);
    font-size: 0.81rem;
    color: #455A64;
}

.lcb-dots {
    display: inline-flex;
    gap: 4px;
}

.lcb-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00BCD4;
    animation: lcbPulse 1.2s infinite ease-in-out;
}

.lcb-dots span:nth-child(2) { animation-delay: 0.2s; }
.lcb-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes lcbPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

/* Zone de prévisualisation photo */
.lcb-img-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #E0F7FA;
    border-top: 1px solid #B2EBF2;
    flex-shrink: 0;
}

.lcb-img-bar.lcb-active {
    display: flex;
}

.lcb-img-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #00BCD4;
}

.lcb-img-label {
    flex: 1 1 auto;
    font-size: 0.78rem;
    color: #006064;
    font-weight: 500;
}

.lcb-img-rm {
    border: none;
    background: rgba(0, 96, 100, 0.12);
    color: #006064;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-weight: 700;
}

/* Zone de saisie */
.lcb-input-wrap {
    padding: 10px 12px 8px;
    background: #FFFFFF;
    border-top: 1px solid #E2EEF0;
    flex-shrink: 0;
}

.lcb-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.lcb-photo-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid #B2EBF2;
    background: #F0FAFC;
    color: #006064;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.lcb-photo-btn:hover {
    background: #E0F7FA;
}

.lcb-textarea {
    flex: 1 1 auto;
    min-height: 42px;
    max-height: 108px;
    resize: none;
    border: 1px solid #CFD8DC;
    border-radius: 12px;
    padding: 9px 11px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.35;
    color: #263238;
    background: #FAFAFA;
    outline: none;
}

.lcb-textarea:focus {
    border-color: #00BCD4;
    background: #FFFFFF;
}

.lcb-send-btn {
    height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: none;
    background: #006064;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 0.86rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.16s ease;
}

.lcb-send-btn:hover:not(:disabled) {
    background: #00838F;
}

.lcb-send-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lcb-disclaimer {
    margin: 5px 0 0;
    font-size: 0.69rem;
    color: #607D8B;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 540px) {
    #liberte-chat-btn {
        right: 14px;
        bottom: 118px;
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    body.lcb-page-secondaire #liberte-chat-btn {
        bottom: 18px;
    }

    #liberte-chat-panel {
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        width: auto;
        height: min(82dvh, 590px);
        max-height: calc(100dvh - 16px);
        border-radius: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #liberte-chat-btn,
    #liberte-chat-panel {
        transition: none;
    }
    .lcb-dots span {
        animation: none;
    }
}
