/* ─── Convioo Chat Widget — Premium Design ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

#wplc-widget-root {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  z-index: 999999;
  position: fixed;
  bottom: 24px;
  right: 24px;
}

/* ─── Launcher FAB ──────────────────────────────────────────────────────── */
#wplc-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00c16a 0%, #00b057 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 176, 87, 0.45), 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s;
  margin-left: auto;
  position: relative;
}

#wplc-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 176, 87, 0.55), 0 2px 10px rgba(0,0,0,0.15);
}

#wplc-launcher:active {
  transform: scale(0.96);
}

#wplc-launcher-icon,
#wplc-launcher-close {
  position: absolute;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#wplc-launcher-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

#wplc-launcher-close {
  opacity: 0;
  transform: scale(0.5) rotate(-90deg);
}

#wplc-widget-root.wplc-open #wplc-launcher-icon {
  opacity: 0;
  transform: scale(0.5) rotate(90deg);
}

#wplc-widget-root.wplc-open #wplc-launcher-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* ─── Chat Panel ────────────────────────────────────────────────────────── */
#wplc-panel {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  height: 560px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#wplc-panel.wplc-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88) translateY(12px);
}

/* ─── Header ────────────────────────────────────────────────────────────── */
#wplc-header {
  background: linear-gradient(135deg, #00c16a 0%, #009e52 100%);
  color: #fff;
  padding: 16px 16px 20px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

#wplc-header::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

#wplc-header::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 40px;
  width: 90px;
  height: 90px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

#wplc-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

#wplc-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  flex-shrink: 0;
}

#wplc-header-avatar svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

#wplc-header-info {
  flex: 1;
  padding: 0 10px;
}

#wplc-header-info h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

#wplc-header-status-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

#wplc-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

#wplc-header p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}

#wplc-close-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s;
  flex-shrink: 0;
}

#wplc-close-btn:hover {
  background: rgba(255,255,255,0.30);
}

/* ─── Messages area ─────────────────────────────────────────────────────── */
#wplc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scroll-behavior: smooth;
}

#wplc-messages::-webkit-scrollbar {
  width: 4px;
}

#wplc-messages::-webkit-scrollbar-track {
  background: transparent;
}

#wplc-messages::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 4px;
}

/* Date separator */
.wplc-date-sep {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  margin: 8px 0;
  position: relative;
}

.wplc-date-sep::before,
.wplc-date-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #f0f0f0;
}

.wplc-date-sep::before { left: 0; }
.wplc-date-sep::after { right: 0; }

/* Message bubbles */
.wplc-msg {
  max-width: 75%;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  animation: wplc-pop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

@keyframes wplc-pop {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.wplc-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-weight: 500;
}

/* Visitor — right side */
.wplc-msg-visitor {
  align-self: flex-end;
  align-items: flex-end;
  margin-left: 14%;
  margin-bottom: 6px;
}

.wplc-msg-visitor .wplc-msg-bubble {
  background: #00b057;
  color: #fff;
  border-bottom-right-radius: 5px;
}

/* Agent — left side */
.wplc-msg-agent {
  align-self: flex-start;
  align-items: flex-start;
  margin-right: 14%;
  margin-bottom: 6px;
}

.wplc-msg-agent .wplc-msg-bubble {
  background: #f0f2f5;
  color: #1a1a2e;
  border-bottom-left-radius: 5px;
}

/* Consecutive same-sender: reduce bottom margin */
.wplc-msg-visitor + .wplc-msg-visitor,
.wplc-msg-agent + .wplc-msg-agent {
  margin-top: -2px;
  margin-bottom: 2px;
}

.wplc-msg-time {
  font-size: 10px;
  margin-top: 3px;
  padding: 0 6px;
  color: #b0b7c3;
  letter-spacing: 0.1px;
}

.wplc-msg-visitor .wplc-msg-time {
  text-align: right;
}

.wplc-msg-agent .wplc-msg-time {
  text-align: left;
}

/* ─── Typing indicator ──────────────────────────────────────────────────── */
#wplc-typing {
  align-self: flex-start;
  margin-top: 2px;
  animation: wplc-pop 0.2s ease;
}

#wplc-typing.wplc-hidden {
  display: none;
}

.wplc-typing-bubble {
  background: #f4f5f7;
  border-radius: 18px;
  border-bottom-left-radius: 5px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.wplc-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: wplc-bounce 1.2s infinite ease-in-out;
}

.wplc-typing-dot:nth-child(1) { animation-delay: 0s; }
.wplc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.wplc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes wplc-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* ─── Input area ────────────────────────────────────────────────────────── */
#wplc-input-area {
  border-top: 1px solid #f0f0f0;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
}

#wplc-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a2e;
  background: transparent;
  max-height: 80px;
  line-height: 1.45;
  padding: 6px 4px;
}

#wplc-input::placeholder {
  color: #b0b7c3;
}

#wplc-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #00b057;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(0,176,87,0.35);
}

#wplc-send-btn:hover {
  background: #009e52;
  transform: scale(1.06);
}

#wplc-send-btn:disabled {
  background: #d1d5db;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

#wplc-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  margin-left: 2px;
}

/* ─── Footer branding ───────────────────────────────────────────────────── */
#wplc-footer {
  text-align: center;
  padding: 6px 0 8px;
  font-size: 11px;
  color: #c4c9d4;
  letter-spacing: 0.2px;
  background: #fff;
}

#wplc-footer a {
  color: #9ca3af;
  text-decoration: none;
  font-weight: 500;
}

#wplc-footer a:hover {
  color: #00b057;
}

/* ─── Status bar (errors) ───────────────────────────────────────────────── */
#wplc-status {
  padding: 6px 14px;
  font-size: 12px;
  color: #ef4444;
  text-align: center;
  background: #fef2f2;
  border-top: 1px solid #fecaca;
}

#wplc-status.wplc-hidden {
  display: none;
}

/* ─── Unread badge on launcher ──────────────────────────────────────────── */
#wplc-unread-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wplc-unread-badge.wplc-hidden {
  display: none;
}

/* ─── CSAT Rating prompt ────────────────────────────────────────────────── */
.wplc-csat {
  padding: 18px 16px 14px;
  background: #fff;
  border-top: 1px solid #f0f0f0;
  text-align: center;
}

.wplc-csat-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 10px;
}

.wplc-csat-stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 12px;
}

.wplc-star {
  font-size: 30px;
  cursor: pointer;
  color: #e5e7eb;
  background: none;
  border: none;
  padding: 0 2px;
  transition: color 0.15s, transform 0.1s;
  line-height: 1;
}

.wplc-star:hover,
.wplc-star.selected {
  color: #f59e0b;
  transform: scale(1.15);
}

#wplc-csat-comment-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#wplc-csat-comment-area.wplc-hidden {
  display: none;
}

#wplc-csat-comment {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  color: #1a1a2e;
  transition: border-color 0.15s;
}

#wplc-csat-comment:focus {
  border-color: #00b057;
}

.wplc-csat-submit {
  background: #00b057;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

.wplc-csat-submit:hover {
  background: #009e52;
}

.wplc-csat-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}

.wplc-csat-emoji {
  font-size: 28px;
}

.wplc-csat-thanks p {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

/* ─── Offline mode form ─────────────────────────────────────────────────── */
.wplc-offline {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wplc-offline-msg {
  font-size: 12.5px;
  color: #6b7280;
  margin: 0 0 4px;
  line-height: 1.5;
}

.wplc-offline input,
.wplc-offline textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: #1a1a2e;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
  resize: none;
}

.wplc-offline input:focus,
.wplc-offline textarea:focus {
  border-color: #00b057;
}

#wplc-offline-submit {
  background: #00b057;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}

#wplc-offline-submit:hover {
  background: #009e52;
}

/* ─── Department picker ─────────────────────────────────────────────────── */
.wplc-dept-picker {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wplc-dept-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  text-align: center;
}

.wplc-dept-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wplc-dept-btn {
  width: 100%;
  background: #f9fafb;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  color: #111827;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}

.wplc-dept-btn:hover {
  background: #ecfdf5;
  border-color: #00b057;
  color: #00874a;
}
