/* ── WhatsApp AI Widget ───────────────────────────────────── */
/* NN/g Chat UX: bottom-right (#3), high contrast (#3),
   transparent about AI (#17), show availability (#7,#15).
   Material Design FAB: 56px. No auto-open. */

.dcx-wa-widget {
    --wa-green: #25D366;
    --wa-dark: #075E54;
    --wa-fab: #0f172b;
    --wa-accent: #ed1a3b;
    --wa-accent-dark: #b10d28;
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: "Plus Jakarta Sans", sans-serif;
}

/* ── FAB button ──────────────────────────────────────────── */
.dcx-wa-widget__fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--wa-fab);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(15, 23, 43, .35), 0 2px 6px rgba(0, 0, 0, .1);
    transition: transform .2s ease, box-shadow .2s ease;
    position: relative;
    -webkit-appearance: none;
}

.dcx-wa-widget__fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(15, 23, 43, .45), 0 3px 8px rgba(0, 0, 0, .12);
}

.dcx-wa-widget__fab-icon {
    transition: opacity .2s ease, transform .2s ease;
    position: absolute;
}

.dcx-wa-widget__fab-icon--wa {
    opacity: 1;
    transform: scale(1);
}

.dcx-wa-widget__fab-icon--close {
    opacity: 0;
    transform: scale(.6) rotate(-90deg);
}

/* Open state — toggle icons */
.dcx-wa-widget.is-open .dcx-wa-widget__fab-icon--wa {
    opacity: 0;
    transform: scale(.6);
}

.dcx-wa-widget.is-open .dcx-wa-widget__fab-icon--close {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* Subtle pulse to draw attention (NN/g #3: contrast) — only once */
@keyframes dcx-wa-pulse {
    0%   { box-shadow: 0 4px 16px rgba(15, 23, 43, .35), 0 0 0 0 rgba(15, 23, 43, .25); }
    70%  { box-shadow: 0 4px 16px rgba(15, 23, 43, .35), 0 0 0 14px rgba(15, 23, 43, 0); }
    100% { box-shadow: 0 4px 16px rgba(15, 23, 43, .35), 0 0 0 0 rgba(15, 23, 43, 0); }
}

.dcx-wa-widget:not(.is-open) .dcx-wa-widget__fab {
    animation: dcx-wa-pulse 2.5s ease-out 3s 3;
}

/* ── Popup card ──────────────────────────────────────────── */
.dcx-wa-widget__popup {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 340px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .15), 0 2px 8px rgba(0, 0, 0, .08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.96);
    transform-origin: bottom right;
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
}

.dcx-wa-widget.is-open .dcx-wa-widget__popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ── Popup header ────────────────────────────────────────── */
.dcx-wa-widget__header {
    background: var(--wa-fab);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.dcx-wa-widget__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.dcx-wa-widget__header-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dcx-wa-widget__name {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
}

.dcx-wa-widget__status {
    font-size: .75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .7);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dcx-wa-widget__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wa-green);
    flex-shrink: 0;
}

/* ── Popup body ──────────────────────────────────────────── */
.dcx-wa-widget__body {
    background: #e5ddd5;
    padding: 24px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Chat bubble — WhatsApp style */
.dcx-wa-widget__bubble {
    background: #fff;
    border-radius: 0 10px 10px 10px;
    padding: 12px 16px;
    font-size: .86rem;
    line-height: 1.55;
    color: #303030;
    max-width: 92%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    position: relative;
}

/* AI badge — NN/g #17: be upfront about using a bot */
.dcx-wa-widget__ai-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .68rem;
    font-weight: 600;
    color: #8696a0;
    padding-left: 2px;
}

/* ── CTA button ──────────────────────────────────────────── */
.dcx-wa-widget__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: #0f172b;
    color: #fff;
    text-decoration: none;
    font-size: .92rem;
    font-weight: 700;
    transition: background .15s ease;
}

.dcx-wa-widget__cta:hover {
    background: #1e293b;
}

/* ── Overlay — Material Design scrim pattern ─────────────── */
.dcx-wa-widget__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    z-index: 9998;
    animation: dcx-wa-fade-in .2s ease;
}

.dcx-wa-widget__overlay.is-visible {
    display: block;
}

/* No overlay needed on large screens — popup is small */
@media (min-width: 769px) {
    .dcx-wa-widget__overlay.is-visible {
        display: none;
    }
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .dcx-wa-widget {
        bottom: 16px;
        right: 16px;
    }
    .dcx-wa-widget__fab {
        width: 54px;
        height: 54px;
    }
    .dcx-wa-widget__fab-icon--wa {
        width: 24px;
        height: 24px;
    }
    .dcx-wa-widget__popup {
        width: calc(100vw - 32px);
        right: 0;
        bottom: 70px;
    }
}

@keyframes dcx-wa-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
