/* Zone Light Chat Widget v2 — Real Chat Interface */
.zl-chat-bubble {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.zl-chat-btn {
  width: 50px; height: 50px;
  border-radius: 50%;
  background: #27ae60;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, background 0.2s;
  position: relative;
  z-index: 2;
}
.zl-chat-btn:hover { background: #219a52; transform: scale(1.08); }
.zl-chat-btn:active { transform: scale(0.95); }

.zl-chat-btn .zl-chat-icon,
.zl-chat-btn .zl-close-icon {
  width: 26px; height: 26px;
  fill: #fff;
  position: absolute;
  transition: opacity 0.2s, transform 0.2s;
}
.zl-chat-btn .zl-close-icon { opacity: 0; transform: rotate(-90deg); }

.zl-chat-open .zl-chat-btn .zl-chat-icon { opacity: 0; transform: rotate(90deg); }
.zl-chat-open .zl-chat-btn .zl-close-icon { opacity: 1; transform: rotate(0deg); }
.zl-chat-open .zl-chat-btn { background: #e74c3c; }
.zl-chat-open .zl-chat-btn:hover { background: #c0392b; }

/* ── Desktop chat window (fixed to viewport) ── */
.zl-chat-window {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 340px;
  max-height: calc(100vh - 120px);
  height: min(480px, calc(100vh - 120px));
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  flex-direction: column;
  overflow: hidden;
}
.zl-chat-header {
  padding: 12px 16px;
  background: #27ae60;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.zl-dot {
  width: 9px; height: 9px;
  background: #2ecc71;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}
.zl-status-text {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.85;
}

.zl-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f5f7fa;
}
.zl-chat-body::-webkit-scrollbar { width: 4px; }
.zl-chat-body::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 10px; }

.zl-msg { display: flex; }
.zl-msg-agent { justify-content: flex-start; }
.zl-msg-user { justify-content: flex-end; }

.zl-msg-bubble {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.zl-msg-agent .zl-msg-bubble {
  background: #fff;
  color: #333;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.zl-msg-user .zl-msg-bubble {
  background: #27ae60;
  color: #fff;
  border-bottom-right-radius: 3px;
}
.zl-msg-bubble a { color: #219a52; text-decoration: underline; }

.zl-typing .zl-msg-bubble {
  opacity: 0.7;
  font-style: italic;
  font-size: 12px;
  padding: 7px 12px;
}
.zl-dots span {
  animation: zlBounce 1.4s infinite;
  display: inline-block;
  font-size: 16px;
  line-height: 0;
  padding: 0 1px;
}
.zl-dots span:nth-child(2) { animation-delay: 0.2s; }
.zl-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes zlBounce {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

.zl-faq-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.zl-faq-btn {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: #555;
}
.zl-faq-btn:hover { background: #27ae60; color: #fff; border-color: #27ae60; }

.zl-chat-footer {
  display: flex;
  padding: 8px 10px;
  background: #fff;
  border-top: 1px solid #eee;
  gap: 6px;
  flex-shrink: 0;
}
.zl-chat-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 16px;
  outline: none;
  transition: border 0.15s;
}
.zl-chat-input:focus { border-color: #27ae60; }

.zl-send-btn {
  background: #27ae60;
  border: none;
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.zl-send-btn:hover { background: #219a52; }
.zl-send-btn svg { width: 16px; height: 16px; fill: #fff; }
.zl-send-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Mobile: full-screen overlay (JS moves window to body) ── */
.zl-chat-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999998;
  background: #fff;
  flex-direction: column;
}
.zl-chat-mobile-overlay .zl-chat-header { padding: 14px 16px; font-size: 15px; }
.zl-mobile-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px 0 0;
  line-height: 1;
  -webkit-appearance: none;
}
.zl-mobile-close:hover { opacity: 0.7; }
.zl-chat-mobile-overlay .zl-chat-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: #f5f7fa; }
.zl-chat-mobile-overlay .zl-chat-footer { display: flex; padding: 10px 12px; background: #fff; border-top: 1px solid #eee; gap: 8px; flex-shrink: 0; }
.zl-chat-mobile-overlay .zl-chat-input { flex: 1; border: 1px solid #ddd; border-radius: 20px; padding: 10px 16px; font-size: 16px; outline: none; }
.zl-chat-mobile-overlay .zl-chat-input:focus { border-color: #27ae60; }
.zl-chat-mobile-overlay .zl-send-btn { width: 40px; height: 40px; background: #27ae60; border: none; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.zl-chat-mobile-overlay .zl-send-btn svg { width: 18px; height: 18px; fill: #fff; }
.zl-chat-mobile-overlay .zl-msg-agent .zl-msg-bubble { font-size: 14px; }
.zl-chat-mobile-overlay .zl-msg-user .zl-msg-bubble { font-size: 14px; }
.zl-chat-mobile-overlay .zl-faq-btn { font-size: 13px; padding: 8px 14px; }
