/* === GB Vendeur IA - Chat Widget === */

/* Bulle flottante */
.gb-vendeur-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 9997;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border: none;
    outline: none;
}

.gb-vendeur-bubble:hover {
    transform: scale(1.08);
}

.gb-vendeur-bubble.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

.gb-vendeur-bubble svg {
    width: 28px;
    height: 28px;
}

.gb-vendeur-bubble-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Fenêtre de chat */
.gb-vendeur-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 420px;
    max-height: 620px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.gb-vendeur-window.is-open {
    display: flex;
}

/* Mode plein écran */
.gb-vendeur-window.is-fullscreen {
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    width: auto;
    max-height: none;
    border-radius: 12px;
}

/* Header */
.gb-vendeur-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.gb-vendeur-title {
    font-weight: 600;
    font-size: 15px;
}

.gb-vendeur-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gb-vendeur-reset,
.gb-vendeur-fullscreen,
.gb-vendeur-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gb-vendeur-fullscreen {
    font-size: 16px;
}

.gb-vendeur-close {
    font-size: 22px;
}

.gb-vendeur-reset:hover,
.gb-vendeur-fullscreen:hover,
.gb-vendeur-close:hover {
    opacity: 1;
}

.gb-vendeur-reset {
    font-size: 16px;
}

.gb-vendeur-reset svg,
.gb-vendeur-fullscreen svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Zone messages */
.gb-vendeur-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 460px;
    min-height: 200px;
}

.gb-vendeur-window.is-fullscreen .gb-vendeur-messages {
    max-height: none;
}

/* Messages */
.gb-vendeur-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    animation: gb-vendeur-fadeIn 0.2s ease;
}

.gb-vendeur-msg-bot {
    background: #f0f0f0;
    color: #1a1a1a;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.gb-vendeur-msg a.gb-vendeur-link {
    color: #0073aa;
    text-decoration: underline;
    font-weight: 600;
}

.gb-vendeur-msg a.gb-vendeur-link:hover {
    color: #005177;
}

.gb-vendeur-msg-user {
    background: var(--gb-vendeur-primary, #2c3e50);
    color: var(--gb-vendeur-text, #fff);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.gb-vendeur-msg-system {
    background: #e8f5e9;
    color: #2e7d32;
    align-self: center;
    text-align: center;
    font-size: 13px;
    border-radius: 8px;
    max-width: 90%;
}

/* Récapitulatif stylisé */
.gb-vendeur-recap {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 8px 0;
    overflow: hidden;
}

.gb-vendeur-recap-header {
    background: var(--gb-vendeur-primary, #2c3e50);
    color: var(--gb-vendeur-text, #fff);
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
}

.gb-vendeur-recap-content {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.6;
}

/* Typing indicator */
.gb-vendeur-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.gb-vendeur-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: gb-vendeur-bounce 1.4s infinite ease-in-out both;
}

.gb-vendeur-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.gb-vendeur-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.gb-vendeur-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes gb-vendeur-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes gb-vendeur-fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Zone de saisie */
.gb-vendeur-input-wrap {
    display: flex;
    align-items: center;
    border-top: 1px solid #e8e8e8;
    padding: 10px 12px;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}

.gb-vendeur-input-wrap textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 16px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
    line-height: 1.4;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
}

.gb-vendeur-input-wrap textarea:focus {
    border-color: var(--gb-vendeur-primary, #2c3e50);
}

/* Bouton micro */
.gb-vendeur-mic {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    color: #999;
    padding: 0;
}

.gb-vendeur-mic svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.gb-vendeur-mic:hover {
    color: #555;
}

.gb-vendeur-mic.is-recording {
    color: #e53935;
    animation: gb-vendeur-pulse 1.2s infinite ease-in-out;
}

@keyframes gb-vendeur-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.15);
        opacity: 0.7;
    }
}

.gb-vendeur-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s;
    font-size: 16px;
}

.gb-vendeur-send:hover {
    opacity: 0.85;
}

.gb-vendeur-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .gb-vendeur-bubble {
        width: 54px;
        height: 54px;
    }

    .gb-vendeur-bubble svg {
        width: 24px;
        height: 24px;
    }

    .gb-vendeur-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
    }

    .gb-vendeur-messages {
        max-height: calc(85vh - 140px);
    }
}