/* ==========================================================================
   VIVRE-BOURGES NATIVE LIVECHAT WIDGET - STYLES
   ========================================================================== */

/* Bulle Flottante Lanceur - Compacte par défaut, s'ouvre au survol en desktop */
.vb-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    background: linear-gradient(135deg, #ff8c42 0%, #ea580c 100%);
    color: #ffffff;
    border: none;
    border-radius: 50px;
    width: 52px;
    height: 52px;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(234, 88, 12, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), padding 0.3s ease, border-radius 0.3s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.vb-chat-launcher-text {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    margin: 0;
    transition: max-width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, margin 0.25s ease;
}
.vb-chat-launcher-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}
.vb-chat-launcher-dot {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 9px;
    height: 9px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 6px #4ade80;
    animation: livechatPulse 2s infinite ease-in-out;
    transition: all 0.3s ease;
}
/* Survol en Desktop : extension fluide du bouton */
@media (min-width: 769px) {
    .vb-chat-launcher:hover {
        width: 225px !important;
        padding: 0 16px !important;
        gap: 8px;
        justify-content: flex-start;
        border-radius: 999px;
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 6px 24px rgba(234, 88, 12, 0.48);
    }
    .vb-chat-launcher:hover .vb-chat-launcher-text {
        max-width: 170px !important;
        opacity: 1 !important;
        margin-left: 2px;
    }
    .vb-chat-launcher:hover .vb-chat-launcher-dot {
        position: static;
        margin-left: auto;
    }
}
@keyframes livechatPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Fenêtre de Tchat */
.vb-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 80px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #fed7aa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
.vb-chat-window.is-open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* En-tête du tchat */
.vb-chat-header {
    background: linear-gradient(135deg, #ff8c42 0%, #ea580c 100%);
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.vb-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vb-chat-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.vb-chat-header-text h4 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 800;
}
.vb-chat-status {
    font-size: 0.76rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}
.vb-chat-status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
}
.vb-chat-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.15s;
}
.vb-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Zone des messages */
.vb-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fdfefe;
}
.vb-chat-msg-row {
    display: flex;
    width: 100%;
}
.vb-chat-msg-row.msg-admin {
    justify-content: flex-start;
}
.vb-chat-msg-row.msg-visitor {
    justify-content: flex-end;
}
.vb-chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}
.msg-admin .vb-chat-bubble {
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 3px;
    border: 1px solid #e2e8f0;
}
.msg-visitor .vb-chat-bubble {
    background: linear-gradient(135deg, #ff8c42 0%, #ea580c 100%);
    color: #ffffff;
    border-bottom-right-radius: 3px;
}
.vb-bubble-time {
    font-size: 0.68rem;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}
.msg-admin .vb-bubble-time {
    color: #64748b;
}

/* Zone Identification Rapide (si pas encore renseigné) */
.vb-chat-user-banner {
    background: #fff7ed;
    border-bottom: 1px solid #fed7aa;
    padding: 8px 14px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
}
.vb-chat-user-input {
    flex: 1;
    border: 1px solid #fdba74;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.82rem;
    background: #ffffff;
    outline: none;
}

/* Pied de formulaire */
.vb-chat-footer {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}
.vb-chat-form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.vb-chat-input {
    flex: 1;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 0.92rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
}
.vb-chat-input:focus {
    border-color: #ea580c;
}
.vb-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8c42 0%, #ea580c 100%);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.vb-chat-send-btn:hover {
    transform: scale(1.06);
}
.vb-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Adaptation Mobile */
@media (max-width: 600px) {
    .vb-chat-launcher {
        bottom: 18px;
        right: 18px;
        padding: 12px;
        border-radius: 50%;
        width: 52px;
        height: 52px;
        justify-content: center;
    }
    .vb-chat-launcher-text {
        display: none;
    }
    .vb-chat-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}
