.wplc-widget {
  position: fixed; bottom: 24px; right: 24px; z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

.wplc-toggle {
  width: 60px; height: 60px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; font-size: 28px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.35);
  position: relative; transition: transform 0.2s;
}
.wplc-toggle:hover { transform: scale(1.05); }

.wplc-status-dot {
  position: absolute; top: 4px; right: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #9ca3af; border: 2px solid #fff;
}
.wplc-status-dot.online {
  background: #10b981;
  animation: wplc-pulse 1.8s infinite;
}
@keyframes wplc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.wplc-panel {
  position: absolute; bottom: 76px; right: 0;
  width: 340px; height: 480px; background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; overflow: hidden;
}

.wplc-header {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.wplc-header-info { display: flex; flex-direction: column; gap: 4px; }
.wplc-title { font-weight: 600; font-size: 15px; }
.wplc-status { font-size: 12px; display: flex; align-items: center; gap: 6px; opacity: 0.92; }

.wplc-breathing {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: #9ca3af;
}
.wplc-breathing.online {
  background: #4ade80;
  animation: wplc-breath 2s ease-in-out infinite;
}
@keyframes wplc-breath {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); box-shadow: 0 0 6px #4ade80; }
}

.wplc-close {
  background: transparent; border: none; color: #fff;
  font-size: 22px; cursor: pointer; line-height: 1;
}

.wplc-intro {
  padding: 18px 16px; display: flex; flex-direction: column;
  gap: 10px; flex: 1;
}
.wplc-intro p { margin: 0 0 4px; color: #374151; font-size: 14px; }
.wplc-intro input {
  border: 1px solid #d1d5db; border-radius: 8px;
  padding: 9px 12px; font-size: 14px; font-family: inherit; outline: none;
}
.wplc-intro input:focus { border-color: #4f46e5; }

.wplc-btn-primary {
  background: #4f46e5; color: #fff; border: none; padding: 10px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  margin-top: auto;
}
.wplc-btn-primary:hover { background: #4338ca; }
.wplc-btn-primary:disabled { background: #a5b4fc; cursor: wait; }

.wplc-recaptcha-notice {
  font-size: 11px; color: #9ca3af; margin: 4px 0 0; text-align: center;
}

/* 離線畫面 */
.wplc-offline {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 30px 24px; text-align: center; gap: 16px;
}
.wplc-offline-icon { font-size: 48px; line-height: 1; }
.wplc-offline-text {
  margin: 0; color: #4b5563; font-size: 15px; line-height: 1.6;
}
.wplc-line-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #06c755; color: #fff; text-decoration: none;
  padding: 11px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600;
  transition: background 0.2s; box-shadow: 0 4px 12px rgba(6,199,85,0.3);
}
.wplc-line-btn:hover { background: #05a948; color: #fff; }
.wplc-line-icon {
  background: #fff; color: #06c755;
  font-size: 11px; font-weight: 800;
  padding: 2px 5px; border-radius: 4px; letter-spacing: 0.5px;
}

.wplc-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.wplc-messages {
  flex: 1; overflow-y: auto; padding: 12px; background: #f9fafb;
  display: flex; flex-direction: column; gap: 8px;
}

.wplc-msg {
  max-width: 78%; padding: 8px 12px; border-radius: 14px;
  font-size: 14px; line-height: 1.45; word-wrap: break-word;
}
.wplc-msg.visitor {
  background: #4f46e5; color: #fff; align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.wplc-msg.admin {
  background: #fff; color: #1f2937; align-self: flex-start;
  border: 1px solid #e5e7eb; border-bottom-left-radius: 4px;
}
.wplc-msg.system {
  background: transparent; color: #6b7280;
  align-self: center; font-size: 13px;
  border: 1px dashed #d1d5db; padding: 6px 10px;
}
.wplc-msg.wplc-failed { opacity: 0.5; }
.wplc-msg.wplc-failed::after {
  content: ' ⚠'; color: #ef4444;
}
.wplc-deleted { color: #9ca3af; font-style: italic; }

.wplc-input-row {
  display: flex; gap: 6px; padding: 10px;
  border-top: 1px solid #e5e7eb; background: #fff;
}
.wplc-input-row textarea {
  flex: 1; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
  resize: none; outline: none;
}
.wplc-input-row textarea:focus { border-color: #4f46e5; }

.wplc-btn-send {
  background: #4f46e5; color: #fff; border: none; padding: 0 16px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.wplc-btn-send:hover { background: #4338ca; }

@media (max-width: 480px) {
  .wplc-panel { width: calc(100vw - 24px); right: -12px; }
}

/* 隱藏 reCAPTCHA 角標 */
.grecaptcha-badge { visibility: hidden; }
