/* Floating sales WhatsApp widget (public site): FAB launcher + chat panel.
   FAB and send button keep WhatsApp brand green (recognisable); the panel header
   uses the tenant brand colour (--fs-primary). Bottom-right; cookie banner (z 1080)
   stays above. */

.wa-widget {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1078;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .75rem;
}

/* ── Launcher: "Chat with us" bubble + FAB ───────────────────────────────── */
.wa-launch { display: flex; align-items: center; gap: .55rem; }
.wa-bubble {
    position: relative;
    padding: .5rem .85rem;
    border-radius: 10px;
    background: #fff;
    color: #1e293b;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.wa-bubble::after {
    content: "";
    position: absolute;
    right: -4px;
    top: 50%;
    width: 10px; height: 10px;
    transform: translateY(-50%) rotate(45deg);
    background: #fff;
}
.wa-open .wa-bubble { display: none; }

.wa-fab {
    position: relative;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(37, 211, 102, .45), 0 2px 8px rgba(0, 0, 0, .2);
    transition: transform .15s, box-shadow .15s;
}
.wa-fab:hover,
.wa-fab:focus { transform: scale(1.06); color: #fff; outline: none; }
.wa-fab .bi-whatsapp { position: relative; z-index: 1; font-size: 2rem; line-height: 1; }

/* Pulsing attention ring */
.wa-fab-ring {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: 50%;
    background: #25D366;
    animation: waPulse 2.4s ease-out 2 forwards;
}
@keyframes waPulse {
    0%   { transform: scale(1);   opacity: .55; }
    70%  { transform: scale(1.9); opacity: 0; }
    100% { transform: scale(1.9); opacity: 0; }
}
.wa-open .wa-fab-ring { animation: none; opacity: 0; }

/* ── Chat panel ──────────────────────────────────────────────────────────── */
.wa-panel {
    width: 320px;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .25);
    animation: waSlideUp .18s ease-out;
}
.wa-panel[hidden] { display: none; }
@keyframes waSlideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.wa-panel-head {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1rem 1rem .9rem;
    background: var(--fs-primary, #25D366);
    color: #fff;
}
.wa-panel-avatar {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.wa-panel-head-text { flex: 1 1 auto; display: flex; flex-direction: column; line-height: 1.25; }
.wa-panel-head-text strong { font-size: .98rem; }
.wa-panel-head-text small { font-size: .78rem; opacity: .9; }
.wa-panel-x {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    font-size: 1.3rem; line-height: 1;
    cursor: pointer;
}
.wa-panel-x:hover { background: rgba(255, 255, 255, .32); }

.wa-panel-body { padding: 1rem; display: flex; flex-direction: column; gap: .7rem; }
.wa-panel-intro { margin: 0; font-size: .82rem; color: #64748b; line-height: 1.45; }

.wa-field { display: flex; flex-direction: column; gap: .25rem; }
.wa-field label { font-size: .76rem; font-weight: 600; color: #334155; }
.wa-field input {
    width: 100%;
    min-height: 40px;
    padding: .45rem .7rem;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    font-size: .88rem;
    color: #1e293b;
}
.wa-field input:focus {
    outline: none;
    border-color: var(--fs-primary, #25D366);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--fs-primary, #25D366) 18%, transparent);
}

.wa-phone { display: flex; align-items: stretch; gap: .4rem; }
.wa-phone-cc {
    flex: 0 0 auto;
    display: flex; align-items: center;
    padding: 0 .6rem;
    border: 1px solid #d7dde5;
    border-radius: 9px;
    background: #f1f5f9;
    font-size: .85rem; font-weight: 600; color: #334155;
    white-space: nowrap;
}
.wa-phone input { flex: 1 1 auto; }

/* Communication-consent checkbox */
.wa-consent { gap: .2rem; }
.wa-check {
    display: flex; align-items: flex-start; gap: .5rem;
    margin: 0; cursor: pointer;
    font-size: .76rem; color: #475569; line-height: 1.4;
}
.wa-check input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px; height: 16px;
    margin-top: .12rem;
    accent-color: #25D366;
    cursor: pointer;
}
.wa-check a { color: var(--fs-primary, #25D366); font-weight: 600; }

/* Validation feedback (client-side gate) */
.wa-err { display: none; margin-top: .05rem; font-size: .72rem; color: #dc3545; }
.wa-field.wa-invalid input { border-color: #dc3545; }
.wa-field.wa-invalid .wa-phone input { border-color: #dc3545; }
.wa-field.wa-invalid .wa-check { color: #dc3545; }
.wa-field.wa-invalid .wa-check input { outline: 2px solid #dc3545; outline-offset: 1px; }
.wa-field.wa-invalid .wa-err { display: block; }

.wa-panel-foot { padding: 0 1rem 1rem; }
.wa-panel-send {
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 11px;
    background: #25D366;
    color: #fff;
    font-size: .95rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    cursor: pointer;
    transition: filter .15s;
}
.wa-panel-send:hover { filter: brightness(1.06); }
.wa-panel-send .bi-whatsapp { font-size: 1.2rem; }

@media (max-width: 575.98px) {
    .wa-widget { right: .75rem; bottom: .75rem; }
    .wa-fab { width: 54px; height: 54px; }
    .wa-fab .bi-whatsapp { font-size: 1.8rem; }
    .wa-panel { width: calc(100vw - 1.5rem); }
}

@media (prefers-reduced-motion: reduce) {
    .wa-fab-ring { animation: none; opacity: 0; }
    .wa-panel { animation: none; }
}
