/* Atelier Chat — Bulle de Contact & FAQ (Frontend) */

.achat-root {
    --achat-primary: #7a0c18;
    --achat-bg: #f6f5f3;
    --achat-card: #ffffff;
    --achat-text: #181d26;
    --achat-muted: #667085;
    --achat-border: #eaecf0;
    --achat-online: #22c55e;
    --achat-offline: #f59e0b;
    position: fixed;
    bottom: 22px;
    z-index: 999990;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
    line-height: 1.45;
    color: var(--achat-text);
    box-sizing: border-box;
}

.achat-root.is-right {
    right: 22px;
}

.achat-root.is-left {
    left: 22px;
}

.achat-root *,
.achat-root *::before,
.achat-root *::after {
    box-sizing: border-box;
}

/* Bouton flottant (Launcher) */
.achat-launcher {
    position: relative;
    width: 58px;
    height: 58px;
    border-radius: 999px;
    border: none;
    background: var(--achat-primary);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    padding: 0;
    margin-left: auto;
}

.achat-root.is-left .achat-launcher {
    margin-left: 0;
    margin-right: auto;
}

.achat-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.34);
    filter: brightness(1.06);
}

.achat-launcher:focus-visible {
    outline: 3px solid var(--achat-primary);
    outline-offset: 3px;
}

.achat-launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.achat-launcher-icon.is-chevron {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.75);
}

.achat-launcher[aria-expanded="true"] .achat-launcher-icon.is-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.75);
}

.achat-launcher[aria-expanded="true"] .achat-launcher-icon.is-chevron {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.achat-launcher-status-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--achat-online);
}

.achat-root.is-offline .achat-launcher-status-dot {
    background: var(--achat-offline);
}

/* Fenêtre principale */
.achat-window {
    width: 376px;
    max-width: calc(100vw - 32px);
    max-height: min(650px, calc(100vh - 104px));
    background: var(--achat-bg);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow-x: hidden;
    overflow-y: auto;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    transform-origin: bottom right;
    animation: achat-pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.achat-root.is-left .achat-window {
    transform-origin: bottom left;
}

.achat-window[hidden] {
    display: none !important;
}

@keyframes achat-pop-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* En-tête avec dégradé fondu comme sur le modèle */
.achat-header {
    position: relative;
    background: linear-gradient(180deg, var(--achat-primary) 0%, var(--achat-primary) 72%, var(--achat-bg) 100%);
    color: #ffffff;
    padding: 30px 26px 46px;
    text-align: center;
}

.achat-header-title {
    margin: 0 auto 10px;
    max-width: 260px;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.achat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
}

.achat-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--achat-online);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.achat-root.is-offline .achat-status-indicator {
    background: var(--achat-offline);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

.achat-close-btn,
.achat-back-btn {
    position: absolute;
    top: 14px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
    padding: 0;
}

.achat-close-btn {
    right: 14px;
}

.achat-back-btn {
    left: 14px;
}

.achat-close-btn:hover,
.achat-back-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.achat-back-btn[hidden] {
    display: none !important;
}

/* Corps de la bulle */
.achat-body {
    padding: 0 16px 18px;
    margin-top: -26px;
    position: relative;
    z-index: 2;
}

.achat-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.achat-view[hidden] {
    display: none !important;
}

/* Bannière de fermeture automatique */
.achat-closed-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 13px;
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.achat-closed-banner.is-compact {
    margin-bottom: 12px;
}

.achat-closed-banner[hidden] {
    display: none !important;
}

.achat-closed-banner-icon {
    flex-shrink: 0;
    color: #d97706;
    margin-top: 2px;
}

/* Cartes blanches */
.achat-card {
    background: var(--achat-card);
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(16, 24, 40, 0.07);
    border: 1px solid rgba(16, 24, 40, 0.04);
    overflow: hidden;
}

.achat-card[hidden] {
    display: none !important;
}

/* Carte principale "Envoyez-moi un message" */
.achat-contact-trigger {
    width: 100%;
    border: none;
    background: transparent;
    padding: 18px 20px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    color: inherit;
    font: inherit;
}

.achat-contact-trigger:hover {
    background: #fafafa;
}

.achat-contact-trigger-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.achat-platform-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--achat-primary);
}

.achat-mini-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.achat-contact-trigger-title {
    font-size: 16.5px;
    font-weight: 700;
    color: #101828;
}

.achat-contact-trigger-sub {
    font-size: 14px;
    color: var(--achat-muted);
}

.achat-contact-trigger-arrow {
    color: #667085;
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.achat-contact-trigger:hover .achat-contact-trigger-arrow {
    transform: translateX(3px);
    color: #101828;
}

/* Carte Questions Fréquentes (Accordéon moderne <details>) */
.achat-faq-card {
    padding: 18px 20px 10px;
}

.achat-card-heading {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: #101828;
}

.achat-faq-details {
    border-bottom: 1px solid var(--achat-border);
}

.achat-faq-details:last-child {
    border-bottom: none;
}

.achat-faq-summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.65ch;
    padding: 13px 4px;
    font-size: 14.5px;
    font-weight: 500;
    color: #1d2939;
    cursor: pointer;
    user-select: none;
}

.achat-faq-summary::-webkit-details-marker {
    display: none;
}

.achat-faq-summary:where(:not([aria-disabled="true"])):hover {
    color: var(--achat-primary);
}

.achat-faq-summary::before {
    content: "";
    inline-size: 1em;
    block-size: 1em;
    flex-shrink: 0;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center / contain;
    rotate: -90deg;
}

.achat-faq-summary:dir(rtl)::before {
    rotate: 90deg;
}

.achat-faq-details[open] > .achat-faq-summary::before {
    rotate: 0deg;
}

@media (prefers-reduced-motion: no-preference) {
    .achat-faq-summary::before {
        transition: rotate 0.2s ease;
    }
}

.achat-faq-details::details-content {
    interpolate-size: allow-keywords;
    overflow: clip;
    contain: layout;
}

.achat-faq-details:not([open])::details-content {
    block-size: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .achat-faq-details::details-content {
        transition: block-size, content-visibility, display;
        transition-duration: 0.25s;
        transition-timing-function: ease-in-out;
        transition-behavior: allow-discrete;
    }
}

.achat-faq-answer {
    padding: 0 4px 14px 22px;
    font-size: 13.8px;
    color: #475467;
    line-height: 1.55;
}

/* Carte Horaires d'ouverture */
.achat-hours-card {
    padding: 4px 20px;
}

.achat-hours-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
}

.achat-hours-list li {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dashed #f2f4f7;
}

.achat-hours-list li:last-child {
    border-bottom: none;
}

.achat-hours-list li.is-today {
    color: var(--achat-primary);
    font-weight: 700;
}

/* Vue 2 : Agent & Sélection du canal */
.achat-agent-card {
    padding: 18px 20px;
}

.achat-agent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--achat-border);
}

.achat-agent-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--achat-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.achat-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.achat-agent-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: var(--achat-online);
}

.achat-root.is-offline .achat-agent-dot {
    background: var(--achat-offline);
}

.achat-agent-meta {
    display: flex;
    flex-direction: column;
}

.achat-agent-meta strong {
    font-size: 16px;
    color: #101828;
}

.achat-agent-meta span {
    font-size: 13px;
    color: var(--achat-muted);
}

.achat-channels-prompt {
    margin: 0 0 12px;
    font-size: 13.5px;
    color: var(--achat-muted);
}

.achat-channel-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.achat-channel-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--achat-border);
    background: #ffffff;
    text-decoration: none !important;
    color: #101828 !important;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.achat-channel-btn:hover {
    transform: translateY(-1px);
    border-color: #d0d5dd;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
}

.achat-channel-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.achat-channel-btn.is-whatsapp .achat-channel-btn-icon {
    background: #25d366;
}

.achat-channel-btn.is-sms .achat-channel-btn-icon {
    background: #0ea5e9;
}

.achat-channel-btn.is-instagram .achat-channel-btn-icon {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
}

.achat-channel-btn-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.achat-channel-btn-body strong {
    font-size: 14.5px;
    font-weight: 600;
    color: #101828;
}

.achat-channel-btn-body span {
    font-size: 12.5px;
    color: var(--achat-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.achat-channel-btn-arrow {
    font-size: 16px;
    color: #98a2b3;
    transition: transform 0.15s ease, color 0.15s ease;
}

.achat-channel-btn:hover .achat-channel-btn-arrow {
    transform: translateX(3px);
    color: #101828;
}

@media (max-width: 480px) {
    .achat-root {
        bottom: 16px;
    }
    .achat-root.is-right {
        right: 16px;
    }
    .achat-root.is-left {
        left: 16px;
    }
    .achat-window {
        width: calc(100vw - 32px);
        max-height: calc(100vh - 96px);
    }
}
