/* ==========================================================================
   WhatsApp Chat WordPress — Frontend Widget
   Author: Zeeshan Raza
   ========================================================================== */

#zr-wa-root {
  position: fixed;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#zr-wa-root * { box-sizing: border-box; }

/* Position variants */
#zr-wa-root.pos-right  { right: 24px; bottom: 24px; }
#zr-wa-root.pos-left   { left:  24px; bottom: 24px; }

/* ── Trigger button ───────────────────────────────────────────────────────── */
.zr-wa-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform .2s;
  user-select: none;
}

.zr-wa-trigger:hover { transform: scale(1.05); }

.zr-wa-trigger-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,.45);
  transition: box-shadow .2s;
  flex-shrink: 0;
  position: relative;
}

.zr-wa-trigger-btn:hover {
  box-shadow: 0 6px 28px rgba(37,211,102,.6);
}

.zr-wa-trigger-btn svg { width: 32px; height: 32px; }

/* Unread badge */
.zr-wa-badge-count {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  background: #FF3B30;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

.zr-wa-trigger-label {
  background: #fff;
  color: #1a1a1a;
  padding: 8px 16px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
  white-space: nowrap;
  animation: slideIn .3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Popup window ────────────────────────────────────────────────────────── */
.zr-wa-popup {
  position: absolute;
  bottom: 76px;
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.pos-right  .zr-wa-popup { right: 0; }
.pos-left   .zr-wa-popup { left: 0; transform-origin: bottom left; }

.zr-wa-popup.open {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Header */
.zr-wa-popup-header {
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.zr-wa-popup-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.zr-wa-popup-header-text { flex: 1; }

.zr-wa-popup-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.zr-wa-popup-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.zr-wa-online-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

.zr-wa-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background .2s;
  flex-shrink: 0;
}

.zr-wa-close-btn:hover { background: rgba(255,255,255,.3); }

/* Chat body */
.zr-wa-popup-body {
  padding: 16px;
  min-height: 80px;
  max-height: 200px;
  overflow-y: auto;
}

.zr-wa-bubble {
  background: #fff;
  border-radius: 8px 8px 8px 2px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #1e293b;
  max-width: 90%;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: relative;
}

.zr-wa-bubble::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -6px;
  border: 6px solid transparent;
  border-right-color: #fff;
  border-bottom: 0;
}

.zr-wa-bubble-time {
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
  margin-top: 2px;
}

/* Agent list */
.zr-wa-agents {
  border-top: 1px solid #f1f5f9;
  max-height: 220px;
  overflow-y: auto;
}

.zr-wa-agent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
}

.zr-wa-agent-item:hover { background: #f8fafc; }

.zr-wa-agent-item + .zr-wa-agent-item { border-top: 1px solid #f1f5f9; }

.zr-wa-agent-item img,
.zr-wa-agent-item .zr-wa-agent-initials {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.zr-wa-agent-initials {
  background: #25D366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.zr-wa-agent-item-info { flex: 1; min-width: 0; }

.zr-wa-agent-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zr-wa-agent-item-status {
  font-size: 12px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.zr-wa-status-online  .dot { background: #22c55e; }
.zr-wa-status-offline .dot { background: #94a3b8; }

.zr-wa-agent-item-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.zr-wa-agent-arrow {
  color: #cbd5e1;
  flex-shrink: 0;
}

/* GDPR bar */
.zr-wa-gdpr {
  padding: 10px 16px;
  background: #fef9c3;
  border-top: 1px solid #fef08a;
  font-size: 11px;
  color: #713f12;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.zr-wa-gdpr a { color: #713f12; }

.zr-wa-gdpr-accept {
  margin-left: auto;
  flex-shrink: 0;
  padding: 4px 12px;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}

.zr-wa-gdpr-accept:hover { background: #15803d; }

/* ── Shortcode button ────────────────────────────────────────────────────── */
.zr-wa-shortcode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: filter .2s, transform .15s;
  text-decoration: none;
}

.zr-wa-shortcode-btn:hover { filter: brightness(.9); transform: translateY(-1px); }

/* ── RTL support ─────────────────────────────────────────────────────────── */
[dir="rtl"] #zr-wa-root.pos-right { right: auto; left: 24px; }
[dir="rtl"] #zr-wa-root.pos-left  { left: auto; right: 24px; }
[dir="rtl"] .zr-wa-popup { right: auto; left: 0; transform-origin: bottom left; }
[dir="rtl"] .pos-right .zr-wa-popup { left: 0; right: auto; transform-origin: bottom left; }

/* ═══════════════════════════════════════════════════════════════
   TRIGGER STYLE — PILL (Need Help? button)
   ════════════════════════════════════════════════════════════ */

/* Pill style — icon + label inside one rounded button */
#zr-wa-root.style-pill .zr-wa-trigger-btn {
  width: auto;
  height: auto;
  border-radius: 50px;
  padding: 14px 22px 14px 18px;
  gap: 10px;
  display: flex;
  align-items: center;
}

#zr-wa-root.style-pill .zr-wa-trigger-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

#zr-wa-root.style-pill .zr-wa-trigger-btn-label {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: .01em;
}

/* Pill hover */
#zr-wa-root.style-pill .zr-wa-trigger-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,211,102,.55);
}

/* Hide separate label chip in pill mode */
#zr-wa-root.style-pill .zr-wa-trigger-label { display: none !important; }

/* ── Bubble style (default) ── */
#zr-wa-root.style-bubble .zr-wa-trigger-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  padding: 0;
}

#zr-wa-root.style-bubble .zr-wa-trigger-btn svg {
  width: 32px;
  height: 32px;
}

/* Hide pill label in bubble mode */
#zr-wa-root.style-bubble .zr-wa-trigger-btn-label { display: none !important; }


/* ── Transparent icon fix ─────────────────────────────────────────────────── */
/* Button background color shows through — icon SVG is transparent */
.zr-wa-trigger-btn svg,
.zr-wa-trigger-btn img {
  display: block;
  flex-shrink: 0;
}

/* Remove any inherited background from SVG children */
.zr-wa-trigger-btn svg path {
  fill: white;
}
