/* === 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: 2147483646;
    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);
}

/* Tooltip au survol */
.gb-vendeur-bubble-tooltip {
    position: absolute;
    white-space: nowrap;
    background: #fff;
    color: #1a1a1a;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    opacity: 0;
    transform: translateX(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Flèche du tooltip */
.gb-vendeur-bubble-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
}

/* Position selon le côté de la bulle */
.gb-vendeur-bubble--left .gb-vendeur-bubble-tooltip {
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
}

.gb-vendeur-bubble--left .gb-vendeur-bubble-tooltip::after {
    right: 100%;
    border-right-color: #fff;
}

.gb-vendeur-bubble--right .gb-vendeur-bubble-tooltip {
    right: calc(100% + 12px);
    left: auto;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
}

.gb-vendeur-bubble--right .gb-vendeur-bubble-tooltip::after {
    left: 100%;
    border-left-color: #fff;
}

/* Apparition au hover */
.gb-vendeur-bubble:hover .gb-vendeur-bubble-tooltip {
    opacity: 1;
}

.gb-vendeur-bubble--left:hover .gb-vendeur-bubble-tooltip {
    transform: translateY(-50%) translateX(0);
}

.gb-vendeur-bubble--right:hover .gb-vendeur-bubble-tooltip {
    transform: translateY(-50%) translateX(0);
}

.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: min(620px, calc(100vh - 110px));
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
    z-index: 2147483647;
    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;
    color: white;
}

.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: 150px;
}

.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);
    }
}

/* Prévisualisation fichier joint */
.gb-vendeur-file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f0f4f8;
    border-top: 1px solid #e8e8e8;
    font-size: 12px;
    color: #555;
}

.gb-vendeur-file-preview-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gb-vendeur-file-preview-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.gb-vendeur-file-preview-remove:hover {
    color: #e53935;
}

/* Overlay drag & drop */
.gb-vendeur-drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    z-index: 10;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    pointer-events: none;
}

.gb-vendeur-drop-overlay span {
    padding: 16px 28px;
    border: 2px dashed var(--gb-vendeur-primary, #2c3e50);
    border-radius: 12px;
    color: var(--gb-vendeur-primary, #2c3e50);
    font-size: 15px;
    font-weight: 600;
}

.gb-vendeur-window.is-dragover .gb-vendeur-drop-overlay {
    display: flex;
}

/* Bouton upload */
.gb-vendeur-upload {
    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-upload svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

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

/* 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;
    min-width: 0;
}

.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 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100%;
        max-height: none;
        height: 100%;
        border-radius: 0;
    }

    .gb-vendeur-messages {
        max-height: none;
        flex: 1;
    }
}