/**
 * Smart Chat Support - Frontend Widget Styles
 * Version: 1.2.1 — fix always-open chat window (CSS specificity bug)
 *
 * All visual rules use !important to prevent Elementor and theme
 * stylesheets from overriding padding, color, or sizing.
 *
 * @package SCSChatSupport
 */

/* ============================================================
   LAYER 0 — HARD RESET
   Scope every reset inside #ecs-widget-wrapper so nothing
   leaks out to the page, and nothing from the page leaks in.
============================================================ */
#ecs-widget-wrapper,
#ecs-widget-wrapper *,
#ecs-widget-wrapper *::before,
#ecs-widget-wrapper *::after {
  box-sizing: border-box !important;
  -webkit-font-smoothing: antialiased !important;
}

/* Strip all inherited margin/padding from every child so
   theme stylesheets (Elementor, Astra, Divi, OceanWP, etc.)
   cannot inject spacing into the widget. */
#ecs-widget-wrapper p,
#ecs-widget-wrapper h1,
#ecs-widget-wrapper h2,
#ecs-widget-wrapper h3,
#ecs-widget-wrapper h4,
#ecs-widget-wrapper ul,
#ecs-widget-wrapper ol,
#ecs-widget-wrapper li,
#ecs-widget-wrapper label,
#ecs-widget-wrapper input,
#ecs-widget-wrapper textarea,
#ecs-widget-wrapper button,
#ecs-widget-wrapper form,
#ecs-widget-wrapper div,
#ecs-widget-wrapper span,
#ecs-widget-wrapper a,
#ecs-widget-wrapper svg {
  margin: 0 !important;
  padding: 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
  line-height: normal !important;
}

/* ============================================================
   LAYER 1 — WIDGET WRAPPER (fixed position anchor)
============================================================ */
#ecs-widget-wrapper {
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 999999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  width: auto !important;
  height: auto !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  pointer-events: auto !important;
}

/* ============================================================
   LAYER 2 — FLOATING TOGGLE BUTTON
============================================================ */
#ecs-widget-wrapper #ecs-toggle-btn,
#ecs-widget-wrapper .ecs-toggle-btn {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  border-radius: 50% !important;
  background: #1a56db !important;
  background-color: #1a56db !important;
  border: none !important;
  outline: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(26,86,219,.50) !important;
  transition: transform 0.22s ease, background 0.22s ease !important;
  flex-shrink: 0 !important;
  position: relative !important;
  order: 2 !important;
  padding: 0 !important;
  margin: 0 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-size: 0 !important;
}

#ecs-widget-wrapper #ecs-toggle-btn:hover {
  background: #1447c0 !important;
  background-color: #1447c0 !important;
  transform: scale(1.08) !important;
}

#ecs-widget-wrapper #ecs-toggle-btn:active {
  transform: scale(0.96) !important;
}

/* Pulse ring */
#ecs-widget-wrapper #ecs-toggle-btn::after {
  content: '' !important;
  position: absolute !important;
  inset: 0 !important;
  border-radius: 50% !important;
  background: #1a56db !important;
  animation: ecs-pulse 2.6s ease-out infinite !important;
  z-index: -1 !important;
  margin: 0 !important;
  padding: 0 !important;
}

@keyframes ecs-pulse {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { transform: scale(1.55); opacity: 0; }
  100% { transform: scale(1.55); opacity: 0; }
}

#ecs-widget-wrapper #ecs-toggle-btn[aria-expanded="true"]::after {
  animation: none !important;
}

/* SVG icons inside toggle button */
#ecs-widget-wrapper .ecs-icon {
  width: 24px !important;
  height: 24px !important;
  display: block !important;
  flex-shrink: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
}

#ecs-widget-wrapper .ecs-icon-hidden {
  display: none !important;
}

/* ============================================================
   LAYER 3 — CHAT WINDOW PANEL
============================================================ */
#ecs-widget-wrapper #ecs-chat-window {
  width: 368px !important;
  max-height: 560px !important;
  background: #ffffff !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 40px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.10) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  margin: 0 0 12px 0 !important;
  padding: 0 !important;
  order: 1 !important;
  border: 1px solid rgba(0,0,0,.08) !important;
  transform-origin: bottom right !important;
}

#ecs-widget-wrapper .ecs-hidden {
  display: none !important;
}

/*
 * CRITICAL: This rule must come AFTER the #ecs-chat-window display:flex rule above.
 * Both selectors have the same specificity weight (1 ID + 1 ID vs 1 ID + 1 class),
 * so the LATER rule in the file wins. This guarantees the chat window starts hidden.
 */
#ecs-widget-wrapper #ecs-chat-window.ecs-hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#ecs-widget-wrapper #ecs-chat-window.ecs-open {
  animation: ecs-slide-in 0.28s cubic-bezier(0.34,1.5,0.64,1) forwards !important;
}

@keyframes ecs-slide-in {
  from { opacity: 0; transform: scale(0.88) translateY(14px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* ============================================================
   LAYER 4 — CHAT HEADER
============================================================ */
#ecs-widget-wrapper .ecs-chat-header {
  background: #1a56db !important;
  background-color: #1a56db !important;
  padding: 16px 18px !important;       /* header padding */
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  flex-shrink: 0 !important;
  border-radius: 0 !important;
}

#ecs-widget-wrapper .ecs-header-avatar {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,0.18) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  color: #fff !important;
  padding: 0 !important;
  margin: 0 !important;
}

#ecs-widget-wrapper .ecs-header-avatar svg {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper .ecs-header-info {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  padding: 0 !important;
  margin: 0 !important;
}

#ecs-widget-wrapper .ecs-header-name {
  color: #ffffff !important;
  font-size: 14.5px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper .ecs-header-status {
  color: rgba(255,255,255,0.82) !important;
  font-size: 11.5px !important;
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  margin: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper .ecs-status-dot {
  width: 7px !important;
  height: 7px !important;
  min-width: 7px !important;
  border-radius: 50% !important;
  background: #4ade80 !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  animation: ecs-blink 2.2s ease-in-out infinite !important;
  margin: 0 !important;
  padding: 0 !important;
}

@keyframes ecs-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ============================================================
   LAYER 5 — CHAT BODY (scrollable area)
============================================================ */
#ecs-widget-wrapper .ecs-chat-body {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 20px 16px 20px 16px !important;  /* top right bottom left — 20px top for bubble clearance */
  margin: 0 !important;
  background: #f3f4f6 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  scroll-behavior: smooth !important;
}

#ecs-widget-wrapper .ecs-chat-body::-webkit-scrollbar { width: 4px !important; }
#ecs-widget-wrapper .ecs-chat-body::-webkit-scrollbar-track { background: transparent !important; }
#ecs-widget-wrapper .ecs-chat-body::-webkit-scrollbar-thumb { background: #d1d5db !important; border-radius: 10px !important; }

/* ============================================================
   LAYER 6 — AGENT MESSAGE BUBBLE
============================================================ */
#ecs-widget-wrapper .ecs-message {
  display: flex !important;
  align-items: flex-start !important;
  max-width: 92% !important;
  margin: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper .ecs-message-agent {
  align-self: flex-start !important;
}

/* THE BUBBLE — explicit padding with !important on every property */
#ecs-widget-wrapper .ecs-message-agent p {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 4px 12px 12px 12px !important;
  padding-top: 13px !important;
  padding-right: 15px !important;
  padding-bottom: 13px !important;
  padding-left: 15px !important;
  font-size: 13.5px !important;
  line-height: 1.6 !important;
  color: #111827 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.10) !important;
  margin: 0 !important;
  display: block !important;
}

/* ============================================================
   LAYER 7 — LEAD FORM CARD
============================================================ */
#ecs-widget-wrapper #ecs-form-container {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  padding: 16px !important;
  margin: 0 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.10) !important;
}

#ecs-widget-wrapper .ecs-form-group {
  margin-bottom: 11px !important;
  padding: 0 !important;
}

#ecs-widget-wrapper .ecs-form-group:last-of-type {
  margin-bottom: 0 !important;
}

#ecs-widget-wrapper .ecs-form-group label {
  display: block !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #111827 !important;
  margin-bottom: 4px !important;
  margin-top: 0 !important;
  padding: 0 !important;
  letter-spacing: 0.01em !important;
  line-height: 1.4 !important;
}

#ecs-widget-wrapper .ecs-form-group label span {
  color: #dc2626 !important;
  margin-left: 1px !important;
}

#ecs-widget-wrapper .ecs-form-group input,
#ecs-widget-wrapper .ecs-form-group textarea {
  width: 100% !important;
  padding: 8px 10px !important;
  margin: 0 !important;
  font-size: 13px !important;
  color: #111827 !important;
  background: #ffffff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 8px !important;
  outline: none !important;
  resize: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  line-height: 1.4 !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  box-shadow: none !important;
}

#ecs-widget-wrapper .ecs-form-group input::placeholder,
#ecs-widget-wrapper .ecs-form-group textarea::placeholder {
  color: #b0b7c0 !important;
  font-size: 12.5px !important;
}

#ecs-widget-wrapper .ecs-form-group input:focus,
#ecs-widget-wrapper .ecs-form-group textarea:focus {
  border-color: #1a56db !important;
  box-shadow: 0 0 0 3px rgba(26,86,219,.10) !important;
}

/* ============================================================
   LAYER 8 — FORM ERROR BOX
============================================================ */
#ecs-widget-wrapper .ecs-form-error {
  display: none !important;
  background: #fef2f2 !important;
  border: 1px solid #fecaca !important;
  color: #dc2626 !important;
  border-radius: 8px !important;
  padding: 8px 11px !important;
  margin-top: 9px !important;
  margin-bottom: 0 !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

#ecs-widget-wrapper .ecs-form-error.ecs-visible {
  display: block !important;
}

/* ============================================================
   LAYER 9 — SEND MESSAGE BUTTON
   FIX: padding-top/bottom explicitly 15px each
============================================================ */
#ecs-widget-wrapper button#ecs-submit-btn,
#ecs-widget-wrapper .ecs-submit-btn {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin-top: 13px !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  /* Explicit 4-side padding — cannot be collapsed by any cascade */
  padding-top: 15px !important;
  padding-bottom: 15px !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  background: #1a56db !important;
  background-color: #1a56db !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  letter-spacing: 0.01em !important;
  text-transform: none !important;
  line-height: 1.4 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(26,86,219,.28) !important;
  transition: background 0.22s ease, transform 0.22s ease !important;
  outline: none !important;
}

#ecs-widget-wrapper button#ecs-submit-btn:hover,
#ecs-widget-wrapper .ecs-submit-btn:hover {
  background: #1447c0 !important;
  background-color: #1447c0 !important;
  transform: translateY(-1px) !important;
}

#ecs-widget-wrapper button#ecs-submit-btn:disabled,
#ecs-widget-wrapper .ecs-submit-btn:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* Spinner inside submit button */
#ecs-widget-wrapper .ecs-spinner {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  border: 2.5px solid rgba(255,255,255,.30) !important;
  border-top-color: #fff !important;
  border-radius: 50% !important;
  animation: ecs-spin 0.7s linear infinite !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

#ecs-widget-wrapper .ecs-spinner.ecs-hidden {
  display: none !important;
}

@keyframes ecs-spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   LAYER 10 — THANK YOU / SUCCESS STATE
   FIX: 15px padding all four sides
============================================================ */
#ecs-widget-wrapper #ecs-thank-you {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  /* Explicit 4-side padding */
  padding-top: 15px !important;
  padding-right: 15px !important;
  padding-bottom: 15px !important;
  padding-left: 15px !important;
  margin: 0 !important;
  text-align: center !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.10) !important;
  animation: ecs-fade-in 0.32s ease forwards !important;
}

@keyframes ecs-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

#ecs-widget-wrapper .ecs-thank-you-icon {
  width: 50px !important;
  height: 50px !important;
  border-radius: 50% !important;
  background: #dcfce7 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 12px auto !important;
  padding: 0 !important;
  color: #16a34a !important;
}

#ecs-widget-wrapper .ecs-thank-you-icon svg {
  width: 26px !important;
  height: 26px !important;
  margin: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper #ecs-thank-you h3 {
  font-size: 15.5px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin-bottom: 7px !important;
  margin-top: 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
}

#ecs-widget-wrapper #ecs-thank-you p {
  font-size: 13px !important;
  color: #6b7280 !important;
  line-height: 1.65 !important;
  margin-bottom: 5px !important;
  margin-top: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper #ecs-thank-you p.ecs-contact-info {
  font-size: 12.5px !important;
  margin-top: 11px !important;
  color: #111827 !important;
  line-height: 1.9 !important;
}

#ecs-widget-wrapper #ecs-thank-you a {
  color: #1a56db !important;
  text-decoration: none !important;
}

#ecs-widget-wrapper #ecs-thank-you a:hover {
  text-decoration: underline !important;
}

/* ============================================================
   LAYER 11 — FOOTER BRANDING
   FIX: 5px extra top/bottom (total 12px top/bottom)
============================================================ */
#ecs-widget-wrapper .ecs-chat-footer {
  background: #ffffff !important;
  border-top: 1px solid #e5e7eb !important;
  /* Explicit 4-side padding — 12px top/bottom (7px original + 5px extra) */
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  margin: 0 !important;
  text-align: center !important;
  font-size: 10.5px !important;
  color: #6b7280 !important;
  flex-shrink: 0 !important;
  line-height: 1.4 !important;
}

#ecs-widget-wrapper .ecs-chat-footer strong {
  color: #1a56db !important;
  font-weight: 600 !important;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 480px) {
  #ecs-widget-wrapper {
    bottom: 16px !important;
    right: 14px !important;
  }
  #ecs-widget-wrapper #ecs-chat-window {
    width: calc(100vw - 28px) !important;
    max-height: calc(100svh - 96px) !important;
  }
}

@media (max-width: 360px) {
  #ecs-widget-wrapper {
    right: 8px !important;
    bottom: 10px !important;
  }
}

/* ============================================================
   v1.3.0 ADDITIONS — AI response bubble + loading dots
   All rules scoped to #ecs-widget-wrapper to prevent leaks.
============================================================ */

/* AI response wrapper — hidden until JS populates it */
#ecs-widget-wrapper #ecs-ai-response {
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

#ecs-widget-wrapper #ecs-ai-response.ecs-hidden {
  display: none !important;
}

/* The AI bubble reuses .ecs-message-agent styles and adds
   a subtle left-border accent to distinguish from the welcome bubble */
#ecs-widget-wrapper #ecs-ai-response .ecs-message-agent p {
  border-left: 3px solid #1a56db !important;
  background: #f0f5ff !important;
  animation: ecs-fade-in 0.4s ease forwards !important;
}

/* -----------------------------------------------
   Typing / loading dots animation
----------------------------------------------- */
#ecs-widget-wrapper #ecs-ai-loading {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 5px !important;
  padding: 10px 14px !important;
  margin: 0 !important;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-left: 3px solid #1a56db !important;
  border-radius: 4px 12px 12px 12px !important;
  width: fit-content !important;
  max-width: 80px !important;
}

#ecs-widget-wrapper #ecs-ai-loading.ecs-hidden {
  display: none !important;
}

#ecs-widget-wrapper .ecs-ai-dot {
  width: 7px !important;
  height: 7px !important;
  min-width: 7px !important;
  border-radius: 50% !important;
  background: #1a56db !important;
  display: inline-block !important;
  margin: 0 !important;
  padding: 0 !important;
  animation: ecs-dot-bounce 1.3s ease-in-out infinite !important;
}

#ecs-widget-wrapper .ecs-ai-dot:nth-child(1) { animation-delay: 0s !important; }
#ecs-widget-wrapper .ecs-ai-dot:nth-child(2) { animation-delay: 0.2s !important; }
#ecs-widget-wrapper .ecs-ai-dot:nth-child(3) { animation-delay: 0.4s !important; }

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

/* ============================================================
   v1.4.0 ADDITIONS — Conversational chat UI
   Input bar, visitor bubbles, assistant bubbles, chat layout
============================================================ */

/* -----------------------------------------------
   Chat window height increase for conversation mode
----------------------------------------------- */
#ecs-widget-wrapper #ecs-chat-window {
  max-height: 620px !important;
}

/* -----------------------------------------------
   Chat body — flex column, scrollable
----------------------------------------------- */
#ecs-widget-wrapper #ecs-chat-body {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 16px 14px 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  scroll-behavior: smooth !important;
}

/* -----------------------------------------------
   Conversation message rows
----------------------------------------------- */
#ecs-widget-wrapper #ecs-conversation {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Each row: visitor right-aligned, assistant left-aligned */
#ecs-widget-wrapper .ecs-msg-row {
  display: flex !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  animation: ecs-fade-in 0.25s ease forwards !important;
}

#ecs-widget-wrapper .ecs-msg-visitor {
  justify-content: flex-end !important;
}

#ecs-widget-wrapper .ecs-msg-assistant {
  justify-content: flex-start !important;
}

/* Bubble base */
#ecs-widget-wrapper .ecs-msg-bubble {
  max-width: 82% !important;
  padding: 10px 13px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  word-wrap: break-word !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
  margin: 0 !important;
}

/* Visitor bubble — blue, right side */
#ecs-widget-wrapper .ecs-msg-visitor .ecs-msg-bubble {
  background: #1a56db !important;
  color: #ffffff !important;
  border-radius: 12px 12px 3px 12px !important;
  box-shadow: 0 1px 4px rgba(26,86,219,.25) !important;
}

/* Assistant bubble — light blue tint, left side */
#ecs-widget-wrapper .ecs-msg-assistant .ecs-msg-bubble {
  background: #f0f5ff !important;
  color: #111827 !important;
  border: 1px solid #dbeafe !important;
  border-left: 3px solid #1a56db !important;
  border-radius: 3px 12px 12px 12px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.07) !important;
}

/* -----------------------------------------------
   Chat input bar (shown after AI first reply)
----------------------------------------------- */
#ecs-widget-wrapper #ecs-chat-input-bar {
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  background: #ffffff !important;
  border-top: 1px solid #e5e7eb !important;
  flex-shrink: 0 !important;
}

#ecs-widget-wrapper #ecs-chat-input-bar.ecs-hidden {
  display: none !important;
}

#ecs-widget-wrapper #ecs-chat-input {
  flex: 1 !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  color: #111827 !important;
  background: #f9fafb !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 20px !important;
  outline: none !important;
  resize: none !important;
  overflow: hidden !important;
  line-height: 1.45 !important;
  min-height: 38px !important;
  max-height: 96px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
}

#ecs-widget-wrapper #ecs-chat-input:focus {
  border-color: #1a56db !important;
  box-shadow: 0 0 0 3px rgba(26,86,219,.10) !important;
  background: #ffffff !important;
}

#ecs-widget-wrapper #ecs-chat-input::placeholder {
  color: #b0b7c0 !important;
  font-size: 12.5px !important;
}

/* Send button */
#ecs-widget-wrapper #ecs-chat-send {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  border-radius: 50% !important;
  background: #1a56db !important;
  background-color: #1a56db !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  transition: background 0.2s ease, transform 0.15s ease !important;
  outline: none !important;
}

#ecs-widget-wrapper #ecs-chat-send:hover {
  background: #1447c0 !important;
  background-color: #1447c0 !important;
  transform: scale(1.07) !important;
}

#ecs-widget-wrapper #ecs-chat-send:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

#ecs-widget-wrapper #ecs-chat-send svg {
  width: 16px !important;
  height: 16px !important;
  color: #ffffff !important;
  stroke: #ffffff !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

/* -----------------------------------------------
   Mobile adjustments for conversation mode
----------------------------------------------- */
@media (max-width: 480px) {
  #ecs-widget-wrapper #ecs-chat-window {
    max-height: calc(100svh - 80px) !important;
  }
}

/* ============================================================
   v1.4.2 — Assistant avatar
============================================================ */
#ecs-widget-wrapper .ecs-header-avatar {
  background: transparent !important;
  padding: 0 !important;
  overflow: hidden !important;
}

#ecs-widget-wrapper .ecs-avatar-img {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  object-position: center top !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 2px solid rgba(255,255,255,0.3) !important;
}

/* ============================================================
   v1.7.0 — Booking form, callback, emergency alert styles
============================================================ */

/* Booking form wrapper */
#ecs-widget-wrapper .ecs-booking-form-wrap {
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-left: 3px solid #1a56db !important;
  border-radius: 3px 12px 12px 12px !important;
  padding: 14px 14px 12px !important;
  margin: 0 !important;
  max-width: 92% !important;
  animation: ecs-fade-in 0.3s ease forwards !important;
}

#ecs-widget-wrapper .ecs-booking-title {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #111827 !important;
  margin-bottom: 10px !important;
  padding: 0 !important;
  line-height: 1.4 !important;
}

/* Two-column row for date + time */
#ecs-widget-wrapper .ecs-form-row {
  display: flex !important;
  gap: 8px !important;
}

#ecs-widget-wrapper .ecs-form-row > div {
  flex: 1 !important;
}

/* Booking inputs */
#ecs-widget-wrapper .ecs-booking-input {
  width: 100% !important;
  padding: 7px 9px !important;
  font-size: 12.5px !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: #111827 !important;
  outline: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

#ecs-widget-wrapper .ecs-booking-input:focus {
  border-color: #1a56db !important;
  box-shadow: 0 0 0 2px rgba(26,86,219,.08) !important;
}

#ecs-widget-wrapper textarea.ecs-booking-input {
  resize: vertical !important;
  min-height: 52px !important;
}

/* Callback button */
#ecs-widget-wrapper .ecs-callback-btn {
  width: 100% !important;
  margin-top: 8px !important;
  padding: 9px 16px !important;
  background: transparent !important;
  color: #1a56db !important;
  border: 1.5px solid #1a56db !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: background 0.2s ease !important;
  text-align: center !important;
  display: block !important;
}

#ecs-widget-wrapper .ecs-callback-btn:hover {
  background: #eff4ff !important;
}

/* Emergency alert bubble */
#ecs-widget-wrapper .ecs-emergency-bubble {
  background: #fef2f2 !important;
  border: 1.5px solid #fca5a5 !important;
  border-left: 3px solid #dc2626 !important;
  border-radius: 3px 12px 12px 12px !important;
  color: #111827 !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  padding: 10px 13px !important;
  max-width: 92% !important;
}

/* Calendly bubble */
#ecs-widget-wrapper .ecs-calendly-bubble {
  background: #f0f5ff !important;
  border: 1px solid #dbeafe !important;
  border-left: 3px solid #1a56db !important;
  border-radius: 3px 12px 12px 12px !important;
  padding: 10px 13px !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: #111827 !important;
  max-width: 92% !important;
}

/* ============================================================
   v1.7.1 — Quick booking action buttons
============================================================ */

#ecs-widget-wrapper .ecs-quick-actions {
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
  max-width: 92% !important;
  margin: 0 !important;
  animation: ecs-fade-in 0.3s ease forwards !important;
}

#ecs-widget-wrapper .ecs-quick-btn {
  display: block !important;
  width: 100% !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  text-align: left !important;
  background: #ffffff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: border-color 0.15s ease, background 0.15s ease !important;
  color: #111827 !important;
  outline: none !important;
}

#ecs-widget-wrapper .ecs-quick-estimate {
  border-left: 3px solid #1a56db !important;
}
#ecs-widget-wrapper .ecs-quick-callback {
  border-left: 3px solid #00a32a !important;
}
#ecs-widget-wrapper .ecs-quick-emergency {
  border-left: 3px solid #d63638 !important;
  color: #b91c1c !important;
}

#ecs-widget-wrapper .ecs-quick-btn:hover {
  background: #f8faff !important;
  border-color: #1a56db !important;
}
#ecs-widget-wrapper .ecs-quick-emergency:hover {
  background: #fff5f5 !important;
  border-color: #d63638 !important;
}
