#lsd-root, #lsd-root * {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Pulsing White Glow Animations ===== */
@keyframes lsd-pulse-glow {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(255, 255, 255, 0.25),
                0 0 0 0 rgba(255, 255, 255, 0.5);
  }
  50% {
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.55),
                0 0 0 8px rgba(255, 255, 255, 0);
  }
}

@keyframes lsd-pulse-dot {
  0%, 100% {
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6),
                0 0 0 0 rgba(255, 255, 255, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.9),
                0 0 0 6px rgba(255, 255, 255, 0);
    transform: scale(1.15);
  }
}

#lsd-open-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 999998;
  display: flex; align-items: center; gap: 8px;
  background: #000000; color: #fff; border: none;
  padding: 14px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.25);
  transition: transform 0.2s, background 0.2s;
  animation: lsd-pulse-glow 2.5s ease-in-out infinite;
}
#lsd-open-btn:hover {
  background: #1a1a1a; transform: translateY(-2px);
}
#lsd-open-btn.lsd-hidden { display: none; }

#lsd-popup {
  position: fixed; bottom: 24px; right: 24px; z-index: 999999;
  width: 380px; max-width: calc(100vw - 32px);
  height: 580px; max-height: calc(100vh - 48px);
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  display: none; flex-direction: column; overflow: hidden;
}
#lsd-popup.lsd-open { display: flex; }

.lsd-header {
  background: linear-gradient(135deg, #000000, #1a1a1a);
  color: #fff; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.lsd-header-left { display: flex; align-items: center; gap: 12px; }
.lsd-status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ffffff;
  animation: lsd-pulse-dot 1.8s ease-in-out infinite;
}
.lsd-header-title { font-size: 16px; font-weight: 600; color: #fff; }
.lsd-header-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; color: #fff; }

#lsd-close-btn {
  background: rgba(255, 255, 255, 0.25) !important;
  border: 2px solid rgba(255, 255, 255, 0.6) !important;
  color: #ffffff !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  font-size: 24px !important;
  font-weight: bold !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  transition: all 0.15s !important;
}
#lsd-close-btn:hover {
  background: rgba(255, 255, 255, 0.4) !important;
  transform: rotate(90deg);
}

.lsd-form { padding: 20px; overflow-y: auto; flex: 1; }
.lsd-intro { font-size: 14px; color: #4b5563; margin-bottom: 16px; line-height: 1.5; }
.lsd-field { margin-bottom: 12px; }
.lsd-field label {
  display: block; font-size: 11px; font-weight: 600; color: #374151;
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px;
}
.lsd-field input, .lsd-field textarea {
  width: 100%; border: 1px solid #d1d5db; border-radius: 8px;
  padding: 10px 12px; font-size: 14px; background: #fff;
  color: #1f2937 !important; font-family: inherit;
}
.lsd-field input:focus, .lsd-field textarea:focus {
  outline: none; border-color: #6b7280;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.18);
}
.lsd-field textarea { resize: vertical; min-height: 70px; }

/* ===== Kill browser autofill green/yellow color (Chrome, Safari) ===== */
.lsd-field input:-webkit-autofill,
.lsd-field input:-webkit-autofill:hover,
.lsd-field input:-webkit-autofill:focus,
.lsd-field textarea:-webkit-autofill {
  -webkit-text-fill-color: #1f2937 !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
  box-shadow: 0 0 0 1000px #ffffff inset !important;
  caret-color: #1f2937;
  transition: background-color 5000s ease-in-out 0s;
}

/* ===== Quick Reply Buttons IN FORM (before submit) ===== */
.lsd-form-quick-replies {
  margin: 14px 0 16px 0;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}
.lsd-form-quick-label {
  font-size: 11px;
  font-weight: 600;
  color: #1f2937;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.lsd-form-quick-btn {
  display: block !important;
  width: 100% !important;
  background: #fff !important;
  border: 1px solid #d1d5db !important;
  color: #1f2937 !important;
  padding: 9px 12px !important;
  margin-bottom: 6px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-align: left !important;
  transition: all 0.15s !important;
  font-family: inherit !important;
  height: auto !important;
  line-height: 1.4 !important;
}
.lsd-form-quick-btn:hover {
  background: #1f2937 !important;
  border-color: #1f2937 !important;
  color: #ffffff !important;
}
.lsd-form-quick-btn:last-child { margin-bottom: 0 !important; }

#lsd-submit-btn {
  width: 100%; background: #000000; color: #fff; border: none;
  padding: 12px; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 6px;
}
#lsd-submit-btn:hover { background: #1a1a1a; }
#lsd-submit-btn:disabled { background: #9ca3af; cursor: not-allowed; }

.lsd-status { margin-top: 10px; font-size: 13px; text-align: center; min-height: 18px; }
.lsd-status.success { color: #059669; }
.lsd-status.error { color: #dc2626; }
.lsd-status.info { color: #6b7280; }

.lsd-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.lsd-messages { flex: 1; overflow-y: auto; padding: 16px; background: #f9fafb; }
.lsd-msg { max-width: 80%; margin-bottom: 10px; display: flex; flex-direction: column; }
.lsd-msg.lsd-customer { margin-left: auto; align-items: flex-end; }
.lsd-msg.lsd-rep { margin-right: auto; align-items: flex-start; }
.lsd-msg-bubble {
  padding: 9px 13px; border-radius: 14px;
  font-size: 14px; line-height: 1.4;
  white-space: pre-wrap; word-wrap: break-word;
}
.lsd-msg.lsd-customer .lsd-msg-bubble {
  background: #000000; color: #fff; border-bottom-right-radius: 4px;
}
.lsd-msg.lsd-rep .lsd-msg-bubble {
  background: #fff; color: #111827;
  border: 1px solid #e5e7eb; border-bottom-left-radius: 4px;
}
.lsd-msg-meta { font-size: 11px; color: #9ca3af; margin-top: 3px; padding: 0 4px; }

.lsd-input-row {
  background: #fff; border-top: 1px solid #e5e7eb;
  padding: 12px; display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
}
#lsd-reply-input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 18px;
  padding: 9px 14px; font-size: 14px; resize: none; font-family: inherit;
  max-height: 100px; min-height: 40px; line-height: 1.4;
  color: #1f2937 !important;
}
#lsd-reply-input:focus {
  outline: none; border-color: #6b7280;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.18);
}

#lsd-reply-btn {
  background: #000000 !important;
  border: none !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  color: #ffffff !important;
}
#lsd-reply-btn:hover { background: #1a1a1a !important; }
#lsd-reply-btn:disabled { background: #9ca3af !important; cursor: not-allowed !important; }
#lsd-reply-btn::after {
  content: "➤";
  color: #ffffff;
  font-size: 16px;
  font-weight: bold;
}
#lsd-reply-btn svg { display: none !important; }

@media (max-width: 480px) {
  #lsd-popup {
    width: 100vw; height: 100vh; max-height: 100vh;
    bottom: 0; right: 0; border-radius: 0;
  }
  #lsd-open-btn { bottom: 16px; right: 16px; padding: 12px 16px; font-size: 14px; }
}
