/* cwu-widget.css — Chat With Us floating button */

#cwu-root {
    position: fixed;
    z-index: 99999;
}
#cwu-root[data-position="bottom-right"] {
    bottom: var(--cwu-base, 24px);
    right: var(--cwu-offset-x, 24px);
}
#cwu-root[data-position="bottom-left"] {
    bottom: var(--cwu-base, 24px);
    left: var(--cwu-offset-x, 24px);
}
/* Single-button mode: lift the closed button by the extra offset. */
#cwu-root[data-mode="button"] #cwu-fab { margin-bottom: var(--cwu-lift, 0px); }

/* Floating action button */
#cwu-fab {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: var(--cwu-pad-y, 13px) var(--cwu-pad-x, 22px);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
    letter-spacing: -0.01em;
}
#cwu-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 24px rgba(0, 0, 0, 0.28);
}
#cwu-fab:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
#cwu-fab svg,
#cwu-fab span {
    flex-shrink: 0;
    pointer-events: none; /* clicks always land on the button, never a child that gets swapped out → single-tap reliable */
}

/* Collapse to icon-only on narrow screens */
@media (max-width: 500px) {
    #cwu-fab {
        padding: 15px;
        border-radius: 50%;
    }
    #cwu-fab-label {
        display: none;
    }
}

/* Consent overlay */
#cwu-consent {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}
#cwu-consent[hidden] {
    display: none;
}
#cwu-consent-box {
    background: #fff;
    border-radius: 14px;
    padding: 28px 28px 24px;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    animation: cwu-pop 0.18s ease;
}
@keyframes cwu-pop {
    from { transform: scale(0.94); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
#cwu-consent-title {
    margin: 0 0 10px;
    font-size: 1.0625rem;
    font-weight: 700;
    color: #111827;
    font-family: inherit;
}
#cwu-consent-box > p:last-of-type {
    margin: 0 0 20px;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.55;
    font-family: inherit;
}
.cwu-consent-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
#cwu-consent-cancel {
    padding: 9px 18px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    font-family: inherit;
    transition: background 0.12s;
}
#cwu-consent-cancel:hover {
    background: #f9fafb;
}
#cwu-consent-confirm {
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    background: var(--cwu-accent, #25D366);
    color: #fff;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.12s;
}
#cwu-consent-confirm:hover {
    filter: brightness(0.93);
}
#cwu-consent-confirm:focus,
#cwu-consent-cancel:focus,
#cwu-fab:focus-visible {
    outline: 2px solid var(--cwu-accent, #25D366);
    outline-offset: 2px;
}

/* ============================================================ */
/* Panel mode (agent roster)                                    */
/* ============================================================ */

/* In panel mode the FAB is icon-only (circular) */
#cwu-fab.cwu-fab-panel {
    padding: 0;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    justify-content: center;
}

.cwu-panel {
    position: absolute;
    bottom: 74px;
    width: 330px;
    max-width: calc(100vw - 36px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.22);
    font-family: inherit;
    animation: cwu-panel-in 0.18s ease;
}
#cwu-root[data-position="bottom-right"] .cwu-panel { right: 0; }
#cwu-root[data-position="bottom-left"]  .cwu-panel { left: 0; }
.cwu-panel[hidden] { display: none; }

@keyframes cwu-panel-in {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.cwu-panel-header {
    padding: 16px 18px;
    position: relative;
}
.cwu-panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(255, 255, 255, 0.22);
    color: inherit;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.12s;
}
.cwu-panel-close:hover { background: rgba(255, 255, 255, 0.34); }
.cwu-panel-head-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cwu-panel-head-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cwu-panel-head-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cwu-panel-title { font-size: 15px; font-weight: 600; line-height: 1.25; }
.cwu-panel-sub   { font-size: 12.5px; opacity: 0.9; line-height: 1.3; }

/* Reply-time bar */
.cwu-panel-reply {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    background: #f5f7f8;
    color: #6b7280;
    font-size: 12px;
}
.cwu-panel-reply svg { flex-shrink: 0; }

/* Closed (office-hours) banner */
.cwu-panel-closed {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 11px 18px;
    background: #fff7ed;
    border-top: 1px solid #fed7aa;
    border-bottom: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 12.5px;
    line-height: 1.45;
}
.cwu-panel-closed svg { flex-shrink: 0; margin-top: 1px; color: #c2410c; }
.cwu-closed-text { display: flex; flex-direction: column; gap: 2px; }
.cwu-closed-next { font-weight: 600; }

/* Agent list */
.cwu-panel-agents {
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}
.cwu-agent {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    background: #f6f7f8;
    border-left: 3px solid var(--cwu-accent, #25D366);
    margin-bottom: 8px;
    transition: background 0.12s, transform 0.12s;
}
.cwu-agent:last-child { margin-bottom: 0; }
.cwu-agent:hover { background: #eef1f3; transform: translateX(1px); }
.cwu-agent-avatar { position: relative; flex-shrink: 0; width: 44px; height: 44px; }
.cwu-agent-photo,
.cwu-agent-initials {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
}
.cwu-agent-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #fff;
}
.cwu-dot-online { background: #1db954; }
.cwu-dot-away   { background: #b6bdc0; }
.cwu-agent-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cwu-agent-name { font-size: 14px; font-weight: 600; color: #1f2937; line-height: 1.3; }
.cwu-agent-dept { font-size: 12px; color: #6b7280; line-height: 1.35; }
.cwu-agent-awaynote { font-size: 11px; color: #92670c; line-height: 1.35; margin-top: 1px; }
.cwu-agent-action {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.12s;
}
.cwu-agent:hover .cwu-agent-action { transform: scale(1.08); }
.cwu-agent-away { opacity: 0.92; }

/* Privacy footer */
.cwu-panel-foot {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-top: 1px solid #eef0f1;
    color: #9aa1a8;
    font-size: 11.5px;
}
.cwu-panel-foot svg { flex-shrink: 0; }

@media (max-width: 500px) {
    .cwu-panel { bottom: 78px; }
}

/* Quick-reply chips */
.cwu-panel-quick {
    padding: 11px 14px 3px;
}
.cwu-quick-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #9aa1a8;
    margin-bottom: 8px;
}
.cwu-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cwu-quick-chip {
    border: 1px solid #d8dee3;
    background: #fff;
    color: #374151;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 12px;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.cwu-quick-chip:hover {
    background: #f5f7f8;
    border-color: #c2cbd1;
}
.cwu-quick-chip.cwu-quick-active {
    background: #e7f8ee;
    border-color: #9ae3bd;
    color: #0f6e56;
    font-weight: 600;
}

/* FAB label callout (panel mode) */
.cwu-fab-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: var(--cwu-lift, 0px); /* lift the closed bubble above a cookie bar */
    transition: margin-bottom 0.18s ease;
}
/* When the panel is open the bubble returns to the base so the panel sits in its
   original position (the lift is for the closed bubble only). */
#cwu-root.cwu-open .cwu-fab-row { margin-bottom: 0; }
#cwu-root[data-position="bottom-left"] .cwu-fab-row { flex-direction: row-reverse; }
.cwu-fab-callout {
    background: #fff;
    color: #1f2937;
    border: none;
    border-radius: 24px;
    padding: var(--cwu-pad-y, 12px) var(--cwu-pad-x, 17px);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    transition: background 0.12s, transform 0.12s;
}
.cwu-fab-callout:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}
@media (max-width: 480px) {
    /* Keep the label visible on mobile, just a touch smaller and capped so it
       never overflows next to the button. */
    .cwu-fab-callout {
        font-size: 13px;
        padding: 10px 14px;
        max-width: 60vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Privacy policy link (panel footer + consent dialog) */
.cwu-privacy-link {
    color: #4b5563;
    text-decoration: underline;
    white-space: nowrap;
}
.cwu-privacy-link:hover { color: #1f2937; }
#cwu-consent-box .cwu-privacy-link { color: var(--cwu-accent, #25D366); }

/* Privacy consent gate (panel) */
.cwu-panel-consent {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 16px 4px;
    font-size: 12.5px;
    line-height: 1.45;
    color: #4b5563;
    cursor: pointer;
}
.cwu-panel-consent input[type="checkbox"] {
    margin: 2px 0 0;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    accent-color: var(--cwu-accent, #25D366);
    cursor: pointer;
}
.cwu-consent-text a {
    color: var(--cwu-accent, #1f7a4d);
    text-decoration: underline;
}
.cwu-needs-consent .cwu-agent {
    opacity: 0.45;
}
.cwu-needs-consent .cwu-agent:hover {
    background: transparent;
}
.cwu-panel-consent.cwu-consent-nudge {
    animation: cwu-consent-shake 0.4s ease;
    background: #fff5f5;
    border-radius: 8px;
}
@keyframes cwu-consent-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* ---- Inline button: [eazechat] shortcode / block (M6) ---- */
.cwu-inline { display:inline-flex; align-items:center; gap:8px; padding:11px 18px; border-radius:999px; font-weight:600; text-decoration:none; line-height:1; font-size:0.95rem; transition:opacity .12s, transform .12s; vertical-align:middle; }
.cwu-inline span { line-height:1; }
.cwu-inline svg { flex:0 0 auto; }
.cwu-inline-solid { background:var(--cwu-bg,#25D366); color:var(--cwu-fg,#fff); }
.cwu-inline-outline { background:transparent; color:var(--cwu-bg,#25D366); box-shadow:inset 0 0 0 2px var(--cwu-bg,#25D366); }
.cwu-inline:hover { opacity:.92; transform:translateY(-1px); }
.cwu-inline-notice { color:#b91c1c; font-size:0.9em; }
