/* ═══════════════════════════════════════════════
   WhatsApp Chat Button Pro — Widget v3 (tawk.to quality)
   ═══════════════════════════════════════════════ */

/* ---------- RESET ---------- */
#wcb-widget, #wcb-widget * {
    box-sizing: border-box;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Prevent WordPress theme styles from bleeding into widget buttons */
#wcb-widget button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: normal;
    box-shadow: none;
}

/* ---------- ROOT POSITIONING ---------- */
#wcb-widget {
    position: fixed;
    z-index: var(--wcb-z, 9999);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

#wcb-widget.wcb-bottom.wcb-right  { bottom: var(--wcb-offset-y,24px); right:  var(--wcb-offset-x,24px); align-items: flex-end; }
#wcb-widget.wcb-bottom.wcb-left   { bottom: var(--wcb-offset-y,24px); left:   var(--wcb-offset-x,24px); align-items: flex-start; }
#wcb-widget.wcb-top.wcb-right     { top: var(--wcb-offset-y,24px);    right:  var(--wcb-offset-x,24px); align-items: flex-end;   flex-direction: column-reverse; }
#wcb-widget.wcb-top.wcb-left      { top: var(--wcb-offset-y,24px);    left:   var(--wcb-offset-x,24px); align-items: flex-start; flex-direction: column-reverse; }

/* ═══════════════════════════════════════════════
   LAUNCHER BUTTON — clean pill
   ═══════════════════════════════════════════════ */
.wcb-btn {
    display: flex !important;
    align-items: center !important;
    gap: 10px;
    height: 56px !important;
    padding: 0 22px 0 18px !important;
    background: var(--wcb-btn-color, #25D366) !important;
    border: none !important;
    border-radius: 28px !important;
    cursor: pointer !important;
    box-shadow: 0 4px 24px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.12) !important;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
    position: relative;
    outline: none;
    min-width: 56px;
    justify-content: center;
    color: var(--wcb-label-color, #fff) !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-size: 15px !important;
}
.wcb-btn:hover  { transform: scale(1.05); box-shadow: 0 6px 28px rgba(0,0,0,.22); }
.wcb-btn:active { transform: scale(.97); }
.wcb-btn:focus-visible { box-shadow: 0 0 0 3px rgba(37,211,102,.4), 0 4px 24px rgba(0,0,0,.18); }

.wcb-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    transition: transform .22s cubic-bezier(.34,1.56,.64,1);
}
.wcb-btn-icon svg { width: 28px; height: 28px; }
.wcb-icon-wa    { fill: var(--wcb-icon-color, #fff); display: block; }
.wcb-icon-close { display: none; fill: none; stroke: var(--wcb-icon-color,#fff); stroke-width: 2.5; }

#wcb-widget.wcb-open .wcb-btn-icon  { transform: rotate(90deg); }
#wcb-widget.wcb-open .wcb-icon-wa   { display: none; }
#wcb-widget.wcb-open .wcb-icon-close { display: block; }

.wcb-btn-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--wcb-label-color, #fff);
    white-space: nowrap;
    letter-spacing: .01em;
}

/* ── PULSE ─────────────────────────────── */
@keyframes wcb-pulse-ring {
    0%   { transform: scale(.9); opacity: .7; }
    70%  { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(.9); opacity: 0; }
}
.wcb-pulse::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background: var(--wcb-btn-color, #25D366);
    opacity: .3;
    animation: wcb-pulse-ring 2.4s ease-out infinite;
    pointer-events: none;
    z-index: -1;
}
#wcb-widget.wcb-open .wcb-pulse::before { display: none; }

/* ═══════════════════════════════════════════════
   GREETING BUBBLE
   ═══════════════════════════════════════════════ */
.wcb-tooltip {
    background: #fff;
    color: #111;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    padding: 10px 16px;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 20px rgba(0,0,0,.13), 0 1px 4px rgba(0,0,0,.08);
    max-width: 220px;
    opacity: 0;
    transform: translateY(8px) scale(.96);
    transition: opacity .22s, transform .22s;
    pointer-events: none;
    white-space: nowrap;
    position: relative;
}
#wcb-widget.wcb-left .wcb-tooltip { border-radius: 18px 18px 18px 4px; }
.wcb-tooltip.wcb-visible { opacity: 1; transform: translateY(0) scale(1); }
#wcb-widget.wcb-open .wcb-tooltip { opacity: 0 !important; pointer-events: none; }

/* ═══════════════════════════════════════════════
   POPUP CARD
   ═══════════════════════════════════════════════ */
.wcb-popup {
    width: 340px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.08);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(.97);
    transition: opacity .24s cubic-bezier(.4,0,.2,1), transform .24s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
    transform-origin: bottom right;
}
#wcb-widget.wcb-left .wcb-popup { transform-origin: bottom left; }
#wcb-widget.wcb-top  .wcb-popup { transform-origin: top right; transform: translateY(-16px) scale(.97); }
.wcb-popup.wcb-popup-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header ─────────────────────────────── */
.wcb-popup-header {
    background: var(--wcb-btn-color, #25D366);
    padding: 18px 18px 20px;
    position: relative;
    overflow: hidden;
}
.wcb-popup-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 110% -30%, rgba(255,255,255,.2) 0%, transparent 60%);
    pointer-events: none;
}
.wcb-popup-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}
.wcb-popup-brand { display: flex; align-items: center; gap: 11px; }
.wcb-popup-wa-badge {
    width: 42px; height: 42px;
    background: rgba(255,255,255,.22);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.wcb-popup-wa-badge svg { width: 22px; height: 22px; fill: #fff; }
.wcb-popup-title { font-size: 15.5px; font-weight: 700; color: #fff; line-height: 1.2; margin: 0 0 3px; }
.wcb-popup-sub   { font-size: 12px; color: rgba(255,255,255,.82); margin: 0; line-height: 1.4; }

.wcb-popup-close {
    background: rgba(255,255,255,.18) !important;
    border: 1px solid rgba(255,255,255,.3) !important;
    color: #fff !important;
    width: 30px !important; height: 30px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0; transition: background .15s; outline: none; margin-top: 0;
    padding: 0 !important;
    box-shadow: none !important;
}
.wcb-popup-close svg { width: 14px; height: 14px; stroke: #fff; }
.wcb-popup-close:hover { background: rgba(255,255,255,.32) !important; }

/* ── Body ───────────────────────────────── */
.wcb-popup-body { background: #f2f3f5; }

.wcb-offline-notice {
    display: flex; align-items: flex-start; gap: 9px;
    background: #fffbeb; border-bottom: 1px solid #fde68a;
    padding: 11px 16px; font-size: 12.5px; color: #78350f; line-height: 1.45;
}
.wcb-offline-dot { width: 9px; height: 9px; min-width: 9px; border-radius: 50%; background: #f59e0b; margin-top: 3px; }

.wcb-agents-list { padding: 10px; display: flex; flex-direction: column; gap: 6px; }

/* ── Agent row ──────────────────────────── */
.wcb-agent-item {
    display: flex; align-items: center; gap: 13px;
    padding: 13px 14px;
    background: #fff; border-radius: 12px; text-decoration: none; color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 0 0 1px rgba(0,0,0,.04);
    transition: box-shadow .18s, transform .18s;
}
.wcb-agent-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
    transform: translateY(-1px);
}
.wcb-agent-item:active { transform: scale(.98); }

/* Avatar */
.wcb-agent-avatar-wrap { position: relative; flex-shrink: 0; }
.wcb-agent-avatar {
    width: 48px; height: 48px; border-radius: 50%; object-fit: cover; display: block;
}
.wcb-avatar-placeholder {
    width: 48px; height: 48px; border-radius: 50%;
    background: #1A73E8; /* overridden per-agent via inline style */
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 700; color: #fff; letter-spacing: -.5px;
    user-select: none;
}

/* Status dot */
.wcb-status-dot {
    position: absolute; bottom: 1px; right: 1px;
    width: 13px; height: 13px; border-radius: 50%;
    border: 2.5px solid #fff;
}
.wcb-status-dot.wcb-status-online  { background: #22c55e; }
.wcb-status-dot.wcb-status-busy    { background: #f97316; }
.wcb-status-dot.wcb-status-away    { background: #eab308; }
.wcb-status-dot.wcb-status-offline { background: #94a3b8; }

/* Agent text */
.wcb-agent-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wcb-agent-name { font-size: 14px; font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcb-agent-role { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcb-agent-status-text { font-size: 11.5px; font-weight: 600; }
.wcb-status-online-text  { color: #16a34a; }
.wcb-status-busy-text    { color: #ea580c; }
.wcb-status-away-text    { color: #ca8a04; }
.wcb-status-offline-text { color: #94a3b8; }

/* Arrow */
.wcb-agent-arrow { width: 15px; height: 15px; stroke: #d1d5db; flex-shrink: 0; transition: stroke .15s, transform .15s; }
.wcb-agent-item:hover .wcb-agent-arrow { stroke: var(--wcb-btn-color,#25D366); transform: translateX(3px); }

/* ── Footer ─────────────────────────────── */
.wcb-popup-footer {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 9px; background: #f2f3f5; border-top: 1px solid rgba(0,0,0,.06);
    font-size: 11px; color: #adb5bd; font-weight: 500;
}

/* ═══════════════════════════════════════════════
   ENTRANCE ANIMATIONS
   ═══════════════════════════════════════════════ */
@keyframes wcb-anim-bounce  { 0%{opacity:0;transform:scale(0) translateY(20px)} 55%{transform:scale(1.08) translateY(-4px)} 100%{opacity:1;transform:none} }
@keyframes wcb-anim-fade    { from{opacity:0} to{opacity:1} }
@keyframes wcb-anim-slide   { from{opacity:0;transform:translateY(30px)} to{opacity:1;transform:none} }
@keyframes wcb-anim-zoom    { from{opacity:0;transform:scale(.4)} to{opacity:1;transform:scale(1)} }

.wcb-anim-bounce   .wcb-btn { animation: wcb-anim-bounce .55s cubic-bezier(.34,1.56,.64,1) both; }
.wcb-anim-fade     .wcb-btn { animation: wcb-anim-fade .4s ease both; }
.wcb-anim-slide_up .wcb-btn { animation: wcb-anim-slide .4s ease both; }
.wcb-anim-zoom     .wcb-btn { animation: wcb-anim-zoom .4s cubic-bezier(.34,1.56,.64,1) both; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .wcb-popup { width: calc(100vw - 32px); max-width: 340px; }
    #wcb-widget.wcb-bottom.wcb-right { bottom:16px; right:16px; }
    #wcb-widget.wcb-bottom.wcb-left  { bottom:16px; left:16px; }
}
@media (max-width: 768px)  { .wcb-hide-on-mobile  { display:none !important; } }
@media (min-width: 769px)  { .wcb-hide-on-desktop { display:none !important; } }
