/* ================================================
   Chat Widget — Wrapper
   ================================================ */
.chat-widget {
    width: 320px;
    display: inline-flex;
    flex-direction: column;
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* ================================================
   Avatar Bubble
   ================================================ */
.avatar-bubble {
    position: relative;
    flex-shrink: 0;
}

.avatar-bubble--lg {
    width: 80px;
    height: 80px;
}

.avatar-bubble--md {
    width: 44px;
    height: 44px;
}

.avatar-bubble__img {
    width: 100%;
    height: 100%;
    border-radius: 56px;
    object-fit: cover;
    display: block;
}

.avatar-bubble--lg .avatar-bubble__img {
    border: 1px solid var(--main-color);
    box-shadow: -2px 6px 8px 0px rgba(204, 204, 204, 1);
}

.avatar-bubble__badge {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--emerald-500);
    border-radius: 50%;
    outline: 2px solid var(--white);
    outline-offset: -1px;
}

.avatar-bubble--lg .avatar-bubble__badge {
    bottom: 0;
    right: 0;
}

.avatar-bubble--md .avatar-bubble__badge {
    width: 10px;
    height: 10px;
    bottom: 0;
    right: 0;
}

/* ================================================
   Chat Header
   ================================================ */
.chat-header {
    background: var(--main-color);
    border-radius: 10px 10px 0 0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header__inner {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.chat-header__close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.chat-header__close:hover {
    opacity: 1;
}

.chat-header__avatar-wrap {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.chat-header__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.chat-header__online {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--emerald-500);
    border-radius: 50%;
    border: 0.5px solid var(--white);
}

.chat-header__info {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.chat-header__name {
    color: var(--white);
    font-size: 16px;
    font-family: var(--font-helvetica);
    font-weight: var(--font-weight-bold);
    line-height: 20px;
}

.chat-header__status {
    color: var(--white);
    font-size: 14px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-regular);
}

/* ================================================
   Chat Conversation Body
   ================================================ */
.chat-conversation {
    flex: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--white);
    min-height: 384px;
    max-height: 384px;
    overflow-y: auto;
}

.chat-conversation__date {
    color: var(--gray2);
    font-size: 12px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-regular);
    text-align: center;
}

.chat-conversation__thread {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    align-self: stretch;
}

.chat-conversation__bot-row {
    display: inline-flex;
    align-items: flex-start;
    gap: 14px;
    align-self: stretch;
}

.chat-conversation__bot-messages {
    flex: 1;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.chat-conversation__suggestions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-self: stretch;
}

/* ================================================
   Chat Message Bubble
   ================================================ */
.chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: stretch;
}

.chat-message--user {
    align-items: flex-end;
}

.chat-message--bot {
    align-items: flex-start;
}

.chat-message__time {
    color: var(--gray2);
    font-size: 12px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-regular);
    text-align: center;
    align-self: center;
}

.chat-message__bubble {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    box-shadow: var(--shadow-card);
}

.chat-message--bot .chat-message__bubble {
    background: var(--gray-disabled);
    border-radius: 0 10px 10px 10px;
}

.chat-message--user .chat-message__bubble {
    background: var(--main-color);
    border-radius: 10px 0 10px 10px;
}

.chat-message--user .chat-message__text {
    color: var(--white);
}

.chat-message__text {
    color: var(--dark1);
    font-size: 12px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-regular);
    flex: 1;
}

/* ================================================
   Chat Suggestion Pill
   ================================================ */
.chat-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    border: none;
    cursor: pointer;
    align-self: stretch;
    transition: background 0.15s ease;
}

.chat-suggestion:hover {
    background: var(--light-warm);
}

.chat-suggestion__icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--main-color);
    font-size: 14px;
    overflow: hidden;
}

.chat-suggestion__text {
    color: var(--dark1);
    font-size: 12px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-regular);
    text-align: left;
}

/* ================================================
   Chat Input
   ================================================ */
.chat-input {
    display: inline-flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--white);
    border-radius: 0 0 10px 10px;
    box-shadow: var(--shadow-card);
    align-self: stretch;
}

.chat-input__field {
    flex: 1;
    height: 36px;
    padding: 10px 12px;
    background: rgba(244, 244, 245, 0.70);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.chat-input__text {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--dark1);
    font-size: 12px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-regular);
}

.chat-input__text::placeholder {
    color: var(--gray2);
}

.chat-input__attach-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-system);
    font-size: 14px;
    flex-shrink: 0;
}

.chat-input__send {
    height: 36px;
    width: 44px;
    padding: 10px 16px;
    background: var(--white);
    border-radius: 10px;
    border: 1px solid var(--main-color);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--main-color);
    font-size: 20px;
    transition: background 0.15s ease, color 0.15s ease;
}

.chat-input__send:hover {
    background: var(--main-color);
    color: var(--white);
}

/* ================================================
   Chat Float — Bulle flottante persistante
   ================================================ */
.home-chat {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.home-chat__bubble-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    transform-origin: bottom right;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.home-chat__bubble-wrap[hidden] {
    display: none;
}


.home-chat__tooltip {
    background: var(--white);
    color: var(--dark1);
    font-size: 12px;
    font-family: var(--font-rubik);
    font-weight: var(--font-weight-medium, 500);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--main-color-orange);
    box-shadow: var(--shadow-card);
    white-space: nowrap;
    transition: opacity 0.5s ease;
    text-align: right;
}

.home-chat__tooltip--hidden {
    opacity: 0;
}

.home-chat__bubble-container {
    position: relative;
    display: inline-flex;
}

.home-chat__bubble {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.home-chat__bubble:hover {
    transform: scale(1.06);
}

/* Bouton × dismiss — apparaît au hover sur le container */
.home-chat__bubble-dismiss {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--dark1);
    color: var(--white);
    border: 2px solid var(--white);
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, background 0.15s ease;
    padding: 0;
    z-index: 1;
}

.home-chat__bubble-container:hover .home-chat__bubble-dismiss {
    opacity: 1;
    pointer-events: auto;
}

.home-chat__bubble-dismiss:hover {
    background: var(--accent-red, #e53935);
}

.home-chat__widget {
    transform-origin: bottom right;
    animation: chat-pop-in 0.2s ease;
}

.home-chat__widget[hidden] {
    display: none;
}

@keyframes chat-pop-in {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

@media (max-width: 480px) {
    .home-chat {
        bottom: 8px;
        right: 8px;
    }
}

/* ── Typing dots animation ── */
.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.chat-typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--main-color);
    border-radius: 50%;
    animation: chatTypingBounce 1.4s ease-in-out infinite;
}

.chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes chatTypingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}
