/* OmniChat - n8n AI Floating Chat Widget */
#omnichat-n8n-root {
  --omnichat-primary: #2563eb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  position: fixed;
  bottom: 22px;
  z-index: 999999;
}

#omnichat-n8n-root.omnichat-pos-right {
  right: 22px;
}

#omnichat-n8n-root.omnichat-pos-left {
  left: 22px;
}

.omnichat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--omnichat-primary);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.omnichat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.omnichat-launcher svg {
  width: 24px;
  height: 24px;
  display: block;
}

.omnichat-popup {
  position: absolute;
  bottom: 68px;
  width: 370px;
  max-width: calc(100vw - 28px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#omnichat-n8n-root.omnichat-pos-right .omnichat-popup {
  right: 0;
}

#omnichat-n8n-root.omnichat-pos-left .omnichat-popup {
  left: 0;
}

.omnichat-popup.omnichat-open {
  display: flex;
  animation: omnichatFadeUp 0.18s ease-out;
}

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

.omnichat-header {
  background: var(--omnichat-primary);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.omnichat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.omnichat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.omnichat-header-text {
  min-width: 0;
}

.omnichat-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}

.omnichat-subtitle {
  font-size: 12px;
  opacity: 0.88;
  margin: 2px 0 0;
  line-height: 1.25;
}

.omnichat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.omnichat-icon-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
}

.omnichat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.omnichat-handoff-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  text-decoration: none;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.omnichat-handoff-btn:hover {
  background: rgba(255, 255, 255, 0.32);
  color: #ffffff;
}

.omnichat-end-btn {
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.omnichat-end-btn:hover {
  background: rgba(220, 38, 38, 0.95);
}

.omnichat-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.omnichat-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.omnichat-msg-bot {
  align-self: flex-start;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.omnichat-msg-user {
  align-self: flex-end;
  background: var(--omnichat-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.omnichat-msg-bot a {
  color: var(--omnichat-primary);
  text-decoration: underline;
  word-break: break-word;
}

.omnichat-msg-user a {
  color: #ffffff;
  text-decoration: underline;
  word-break: break-word;
}

.omnichat-msg-typing {
  font-style: italic;
  color: #64748b;
}

.omnichat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.omnichat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  color: #0f172a;
  background: #ffffff;
}

.omnichat-input:focus {
  border-color: var(--omnichat-primary);
}

.omnichat-send {
  background: var(--omnichat-primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.omnichat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.omnichat-msg-bot a {
  color: var(--omnichat-primary);
  text-decoration: underline;
  word-break: break-all;
}

.omnichat-msg-bot code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12.5px;
}

.omnichat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.omnichat-starter-chip {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.omnichat-starter-chip:hover {
  border-color: var(--omnichat-primary);
  color: var(--omnichat-primary);
}

.omnichat-branding {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  background: #ffffff;
  padding: 4px 10px 7px;
}

.omnichat-branding a {
  color: var(--omnichat-primary);
  text-decoration: none;
  font-weight: 600;
}

.omnichat-branding a:hover {
  text-decoration: underline;
}

.omnichat-attach-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.omnichat-attach-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: #eff6ff;
  border-top: 1px solid #dbeafe;
  font-size: 12px;
  color: #1e40af;
}

.omnichat-attach-preview button {
  background: none;
  border: none;
  color: #1e40af;
  cursor: pointer;
  font-weight: 700;
}

.omnichat-lead-form {
  position: absolute;
  inset: 60px 0 0 0;
  background: #ffffff;
  z-index: 10;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  overflow-y: auto;
}

#omnichat-n8n-root.omnichat-theme-glass .omnichat-lead-form {
  background: rgba(255, 255, 255, 0.96);
}

.omnichat-lead-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.omnichat-lead-input {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  outline: none;
}

.omnichat-lead-input:focus {
  border-color: var(--omnichat-primary);
}

.omnichat-phone-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.omnichat-country-select {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 13.5px;
  background: #ffffff;
  color: #0f172a;
  width: 78px;
  flex-shrink: 0;
}

.omnichat-phone-input {
  flex: 1;
  min-width: 0;
}

.omnichat-lead-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: -2px;
}

.omnichat-gdpr-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.omnichat-gdpr-label a {
  color: var(--omnichat-primary);
  text-decoration: underline;
}

#omnichat-n8n-root.omnichat-theme-dark .omnichat-gdpr-label {
  color: #cbd5e1;
}

.omnichat-lead-submit {
  background: var(--omnichat-primary);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.omnichat-proactive {
  position: absolute;
  bottom: 66px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.16);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  cursor: pointer;
}

#omnichat-n8n-root.omnichat-pos-right .omnichat-proactive {
  right: 0;
}

#omnichat-n8n-root.omnichat-pos-left .omnichat-proactive {
  left: 0;
}

.omnichat-proactive button {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
}

/* Dark Theme */
#omnichat-n8n-root.omnichat-theme-dark .omnichat-popup,
#omnichat-n8n-root.omnichat-theme-dark .omnichat-lead-form {
  background: #0f172a;
  border-color: #1e293b;
}

#omnichat-n8n-root.omnichat-theme-dark .omnichat-messages,
#omnichat-n8n-root.omnichat-theme-dark .omnichat-starters {
  background: #1e293b;
  border-color: #334155;
}

#omnichat-n8n-root.omnichat-theme-dark .omnichat-msg-bot {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
}

#omnichat-n8n-root.omnichat-theme-dark .omnichat-form,
#omnichat-n8n-root.omnichat-theme-dark .omnichat-branding {
  background: #0f172a;
  border-color: #334155;
}

#omnichat-n8n-root.omnichat-theme-dark .omnichat-input,
#omnichat-n8n-root.omnichat-theme-dark .omnichat-lead-input,
#omnichat-n8n-root.omnichat-theme-dark .omnichat-country-select,
#omnichat-n8n-root.omnichat-theme-dark .omnichat-starter-chip {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

#omnichat-n8n-root.omnichat-theme-dark .omnichat-lead-title {
  color: #f8fafc;
}

/* Glass Theme */
#omnichat-n8n-root.omnichat-theme-glass .omnichat-popup {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

#omnichat-n8n-root.omnichat-theme-glass .omnichat-messages {
  background: rgba(248, 250, 252, 0.65);
}

/* Minimal Editorial Theme */
#omnichat-n8n-root.omnichat-theme-minimal .omnichat-popup {
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

#omnichat-n8n-root.omnichat-theme-minimal .omnichat-header {
  background: #ffffff;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
}

#omnichat-n8n-root.omnichat-theme-minimal .omnichat-icon-btn,
#omnichat-n8n-root.omnichat-theme-minimal .omnichat-handoff-btn {
  background: #f1f5f9;
  color: #0f172a;
}

#omnichat-n8n-root.omnichat-theme-minimal .omnichat-messages {
  background: #ffffff;
}

#omnichat-n8n-root.omnichat-theme-minimal .omnichat-msg-bot {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* Gradient Pro Theme */
#omnichat-n8n-root.omnichat-theme-gradient .omnichat-popup {
  border-radius: 20px;
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.25);
}

#omnichat-n8n-root.omnichat-theme-gradient .omnichat-header,
#omnichat-n8n-root.omnichat-theme-gradient .omnichat-launcher,
#omnichat-n8n-root.omnichat-theme-gradient .omnichat-msg-user,
#omnichat-n8n-root.omnichat-theme-gradient .omnichat-send {
  background: linear-gradient(135deg, var(--omnichat-primary) 0%, #7c3aed 100%);
}

/* Compact Bubble Theme */
#omnichat-n8n-root.omnichat-theme-compact .omnichat-popup {
  width: 330px;
  height: 450px;
  border-radius: 14px;
}

#omnichat-n8n-root.omnichat-theme-compact .omnichat-messages {
  padding: 10px;
  gap: 7px;
}

#omnichat-n8n-root.omnichat-theme-compact .omnichat-msg {
  padding: 8px 11px;
  font-size: 13px;
}
