/* Codiav Live Chat — profesyonel widget */
#liveChatRoot.live-chat,
.live-chat {
  --lc-blue: #2563eb;
  --lc-blue-deep: #1d4ed8;
  --lc-ink: #0f172a;
  --lc-panel: #0a1020;
  --lc-elev: #11182b;
  --lc-line: rgba(255, 255, 255, 0.09);
  --lc-muted: #94a3b8;
  --lc-text: #e8eef8;
  position: fixed !important;
  right: 24px !important;
  left: auto !important;
  bottom: 24px !important;
  top: auto !important;
  z-index: 2147483000 !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif !important;
  color: var(--lc-ink);
  line-height: 1.45;
  box-sizing: border-box;
  pointer-events: none;
}

/* Modern scrollbars inside live chat */
.live-chat,
.live-chat *,
#liveChatRoot,
#liveChatRoot * {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent !important;
}

.live-chat::-webkit-scrollbar,
.live-chat *::-webkit-scrollbar,
#liveChatRoot::-webkit-scrollbar,
#liveChatRoot *::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

.live-chat::-webkit-scrollbar-track,
.live-chat *::-webkit-scrollbar-track,
#liveChatRoot::-webkit-scrollbar-track,
#liveChatRoot *::-webkit-scrollbar-track {
  background: transparent !important;
}

.live-chat::-webkit-scrollbar-thumb,
.live-chat *::-webkit-scrollbar-thumb,
#liveChatRoot::-webkit-scrollbar-thumb,
#liveChatRoot *::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.35) !important;
  border-radius: 999px !important;
  border: 1px solid transparent !important;
  background-clip: padding-box !important;
}

.live-chat::-webkit-scrollbar-thumb:hover,
.live-chat *::-webkit-scrollbar-thumb:hover,
#liveChatRoot::-webkit-scrollbar-thumb:hover,
#liveChatRoot *::-webkit-scrollbar-thumb:hover {
  background-color: rgba(96, 165, 250, 0.6) !important;
}

.live-chat *,
.live-chat *::before,
.live-chat *::after { box-sizing: border-box; }

.live-chat > * { pointer-events: auto; }

.live-chat[hidden],
.live-chat-greeting[hidden],
.live-chat-panel[hidden],
.live-chat-preform[hidden],
.live-chat-conversation[hidden],
.live-chat-badge[hidden],
.live-chat-end[hidden],
.live-chat-closed-banner[hidden] {
  display: none !important;
}

a.whatsapp-float {
  left: 24px !important;
  right: auto !important;
  bottom: 24px !important;
  z-index: 2147482990 !important;
}

.scroll-top {
  right: 92px !important;
  left: auto !important;
}

/* Greeting bubble */
.live-chat-greeting {
  position: absolute !important;
  right: 0 !important;
  bottom: 78px !important;
  left: auto !important;
  width: min(320px, calc(100vw - 48px)) !important;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%) !important;
  color: #0f172a !important;
  border-radius: 20px 20px 8px 20px !important;
  padding: 16px 40px 16px 16px !important;
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 18px 48px rgba(15, 23, 42, 0.18) !important;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.28) !important;
  transform-origin: bottom right;
  animation: liveChatGreetingIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 2;
}

.live-chat-greeting::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.live-chat-greeting-tail {
  position: absolute !important;
  right: 22px !important;
  bottom: -7px !important;
  width: 14px !important;
  height: 14px !important;
  background: #f8fafc !important;
  border-right: 1px solid rgba(148, 163, 184, 0.28) !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28) !important;
  transform: rotate(45deg);
  border-radius: 2px;
}

.live-chat-greeting-inner {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  position: relative;
  z-index: 1;
}

.live-chat-greeting-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.live-chat-greeting-avatar {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  display: block !important;
  object-fit: cover !important;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(37, 99, 235, 0.35);
  background: #1e3a8a;
}

.live-chat-greeting-online {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  animation: liveChatPulse 2s infinite;
}

.live-chat-greeting-copy {
  min-width: 0;
  padding-top: 1px;
}

.live-chat-greeting-label {
  display: block !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2563eb !important;
  margin-bottom: 4px !important;
}

.live-chat-greeting p {
  margin: 0 0 6px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em;
}

.live-chat-greeting-cta {
  display: inline-block;
  font-size: 0.72rem !important;
  font-weight: 500 !important;
  color: #64748b !important;
}

.live-chat-greeting:hover .live-chat-greeting-cta {
  color: #2563eb !important;
}

.live-chat-greeting-close {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  border: 0 !important;
  background: rgba(148, 163, 184, 0.12) !important;
  color: #64748b !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  padding: 0 !important;
  z-index: 2;
  transition: background 0.15s ease, color 0.15s ease;
}

.live-chat-greeting-close:hover {
  background: rgba(37, 99, 235, 0.12) !important;
  color: #1d4ed8 !important;
}

@keyframes liveChatGreetingIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Launcher */
.live-chat-launcher {
  width: 60px !important;
  height: 60px !important;
  min-width: 60px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: linear-gradient(145deg, var(--lc-blue), var(--lc-blue-deep)) !important;
  color: #fff !important;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.42) !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  padding: 0 !important;
  margin: 0 0 0 auto !important;
  overflow: hidden !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.live-chat-launcher:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 36px rgba(37, 99, 235, 0.55) !important;
}

.live-chat-launcher-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
}

.live-chat-launcher-icon svg,
.live-chat-launcher-close svg {
  width: 26px !important;
  height: 26px !important;
  display: block !important;
}

.live-chat-launcher-close {
  display: none !important;
  position: absolute !important;
  inset: 0 !important;
  background: linear-gradient(145deg, var(--lc-blue), var(--lc-blue-deep)) !important;
  align-items: center !important;
  justify-content: center !important;
  color: #fff !important;
}

.live-chat.is-open .live-chat-launcher-icon { display: none !important; }
.live-chat.is-open .live-chat-launcher-close { display: flex !important; }
.live-chat.is-open .live-chat-greeting { display: none !important; }

.live-chat-badge {
  position: absolute !important;
  top: -4px !important;
  right: -4px !important;
  min-width: 22px !important;
  height: 22px !important;
  padding: 0 6px !important;
  border-radius: 999px !important;
  background: #ef4444 !important;
  color: #fff !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 2px solid #fff !important;
}

/* Panel */
.live-chat-panel {
  position: absolute !important;
  right: 0 !important;
  left: auto !important;
  bottom: 76px !important;
  width: min(400px, calc(100vw - 32px)) !important;
  height: min(620px, calc(100vh - 110px)) !important;
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(37, 99, 235, 0.22), transparent 55%),
    var(--lc-panel) !important;
  border: 1px solid var(--lc-line) !important;
  border-radius: 22px !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  animation: liveChatPop 0.28s ease;
  color: var(--lc-text) !important;
}

.live-chat-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 14px 14px 14px 16px !important;
  background: linear-gradient(120deg, #172554 0%, #1d4ed8 55%, #2563eb 100%) !important;
  color: #fff !important;
  margin: 0 !important;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.live-chat-header-info {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0;
}

.live-chat-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.live-chat-avatar-img {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  display: block !important;
  object-fit: cover !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.28);
  background: #1e3a8a !important;
}

.live-chat-online-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #1d4ed8;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: liveChatPulse 2s infinite;
}

.live-chat-online-dot.is-offline {
  background: #94a3b8;
  animation: none;
  box-shadow: none;
}

.live-chat-header h3 {
  margin: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  color: #fff !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.live-chat-status {
  font-size: 0.72rem !important;
  opacity: 0.92;
  color: #dbeafe !important;
}

.live-chat-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0;
}

.live-chat-end {
  border: 1px solid rgba(255,255,255,0.28) !important;
  background: rgba(255,255,255,0.12) !important;
  color: #fff !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  white-space: nowrap;
}

.live-chat-end:hover {
  background: rgba(239, 68, 68, 0.35) !important;
  border-color: rgba(252, 165, 165, 0.55) !important;
}

.live-chat-panel-close {
  border: 0 !important;
  background: rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  font-size: 1.2rem !important;
  cursor: pointer;
  line-height: 1 !important;
  padding: 0 !important;
}

.live-chat-body {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Pre-form */
.live-chat-preform {
  padding: 16px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 11px !important;
  overflow-y: auto !important;
}

.live-chat-preform-hero {
  margin-bottom: 4px !important;
}

.live-chat-preform-kicker {
  margin: 0 0 4px !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #60a5fa !important;
}

.live-chat-preform-hero h4 {
  margin: 0 0 6px !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #f8fafc !important;
  line-height: 1.3 !important;
}

.live-chat-preform-intro {
  margin: 0 !important;
  color: var(--lc-muted) !important;
  font-size: 0.84rem !important;
  line-height: 1.5 !important;
}

.live-chat-preform-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
}

.live-chat-preform label {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  font-size: 0.78rem !important;
  color: #cbd5e1 !important;
  margin: 0 !important;
}

.live-chat-preform input {
  border: 1px solid var(--lc-line) !important;
  background: var(--lc-elev) !important;
  color: #f8fafc !important;
  border-radius: 12px !important;
  padding: 11px 12px !important;
  font: inherit !important;
  outline: none !important;
  width: 100% !important;
}

.live-chat-preform input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22) !important;
}

.live-chat-dept-block { display: grid; gap: 8px; }

.live-chat-dept-label {
  font-size: 0.78rem !important;
  color: #cbd5e1 !important;
}

.live-chat-dept-options {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}

.live-chat-dept-option {
  border: 1px solid var(--lc-line) !important;
  background: rgba(255,255,255,0.03) !important;
  color: #e2e8f0 !important;
  border-radius: 12px !important;
  padding: 10px 10px !important;
  text-align: left !important;
  cursor: pointer;
  font: inherit !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.live-chat-dept-option:hover {
  border-color: rgba(96, 165, 250, 0.45) !important;
  background: rgba(37, 99, 235, 0.12) !important;
}

.live-chat-dept-option.is-selected {
  border-color: #60a5fa !important;
  background: rgba(37, 99, 235, 0.22) !important;
  color: #dbeafe !important;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.live-chat-form-error {
  margin: 0 !important;
  color: #fca5a5 !important;
  font-size: 0.8rem !important;
}

.live-chat-submit {
  margin-top: 2px !important;
  border: 0 !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  background: linear-gradient(135deg, var(--lc-blue), var(--lc-blue-deep)) !important;
  color: #fff !important;
  font-weight: 700 !important;
  cursor: pointer;
  width: 100% !important;
  letter-spacing: 0.01em;
}

.live-chat-submit:disabled { opacity: 0.7; cursor: wait; }

.live-chat-submit--ghost {
  background: transparent !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  color: #e2e8f0 !important;
}

.live-chat-preform-note {
  margin: 0 !important;
  text-align: center !important;
  font-size: 0.72rem !important;
  color: #64748b !important;
  line-height: 1.4 !important;
}

/* Conversation */
.live-chat-conversation {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.live-chat-dept-chip {
  margin: 10px 16px 0 !important;
  align-self: flex-start !important;
  background: rgba(37, 99, 235, 0.18) !important;
  color: #93c5fd !important;
  border: 1px solid rgba(59, 130, 246, 0.35) !important;
  border-radius: 999px !important;
  padding: 4px 10px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
}

.live-chat-messages {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 12px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  align-items: stretch !important;
}

.live-chat-msg {
  max-width: min(85%, 300px) !important;
  width: fit-content !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  align-items: flex-end !important;
}

.live-chat-msg.is-new { animation: liveChatPop 0.25s ease; }
.live-chat-msg--agent { align-self: flex-start !important; }
.live-chat-msg--visitor {
  align-self: flex-end !important;
  flex-direction: row-reverse !important;
  text-align: right !important;
}

.live-chat-msg-avatar {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 50% !important;
  flex: 0 0 28px !important;
  display: block !important;
  object-fit: cover !important;
  background: #334155;
  margin: 0 !important;
}

.live-chat-msg-avatar--agent-fallback,
.live-chat-msg-avatar--visitor-fallback {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  border-radius: 50% !important;
  flex: 0 0 28px !important;
  display: inline-block !important;
  margin: 0 !important;
}

.live-chat-msg-avatar--agent-fallback {
  background-image: linear-gradient(135deg, #2563eb, #1e40af) !important;
  position: relative;
}
.live-chat-msg-avatar--agent-fallback::after {
  content: "C";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.live-chat-msg-avatar--visitor-fallback {
  background:
    radial-gradient(circle at 50% 38%, #fff 0 28%, transparent 29%),
    radial-gradient(ellipse at 50% 95%, #fff 0 42%, transparent 43%),
    linear-gradient(135deg, #38bdf8, #0284c7) !important;
}

.live-chat-msg-body {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  min-width: 0 !important;
  max-width: calc(100% - 36px) !important;
  align-items: flex-start !important;
  flex: 1 1 auto !important;
}

.live-chat-msg--visitor .live-chat-msg-body { align-items: flex-end !important; }

.live-chat-msg-meta {
  display: flex !important;
  gap: 6px !important;
  align-items: center !important;
  font-size: 0.65rem !important;
  color: #64748b !important;
  line-height: 1.2 !important;
  max-width: 100% !important;
}

.live-chat-msg-meta strong {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  max-width: 160px !important;
  font-weight: 600 !important;
}

.live-chat-msg--visitor .live-chat-msg-meta { justify-content: flex-end !important; }

.live-chat-msg-bubble {
  display: inline-block !important;
  width: fit-content !important;
  max-width: 100% !important;
  padding: 7px 11px !important;
  border-radius: 14px !important;
  font-size: 0.875rem !important;
  line-height: 1.4 !important;
  word-break: break-word !important;
  text-align: left !important;
}

.live-chat-msg--agent .live-chat-msg-bubble {
  background: #152238;
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-left-radius: 5px;
}

.live-chat-msg--visitor .live-chat-msg-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.live-chat-closed-banner {
  margin: 0 12px 8px !important;
  padding: 12px !important;
  border-radius: 14px !important;
  background: rgba(148, 163, 184, 0.1) !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  text-align: center;
}

.live-chat-closed-banner p {
  margin: 0 0 10px !important;
  font-size: 0.85rem !important;
  color: var(--lc-muted) !important;
}

.live-chat-compose {
  display: flex !important;
  gap: 8px !important;
  padding: 12px !important;
  border-top: 1px solid var(--lc-line) !important;
  background: rgba(15, 23, 42, 0.85) !important;
}

.live-chat-compose.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.live-chat-compose textarea {
  flex: 1 !important;
  resize: none !important;
  border: 1px solid var(--lc-line) !important;
  background: var(--lc-elev) !important;
  color: #f8fafc !important;
  border-radius: 14px !important;
  padding: 11px 12px !important;
  font: inherit !important;
  max-height: 96px !important;
  outline: none !important;
}

.live-chat-send {
  width: 44px !important;
  height: 44px !important;
  border: 0 !important;
  border-radius: 14px !important;
  background: linear-gradient(135deg, var(--lc-blue), var(--lc-blue-deep)) !important;
  color: #fff !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  padding: 0 !important;
}

.live-chat-send svg {
  width: 18px !important;
  height: 18px !important;
}

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

@keyframes liveChatPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (max-width: 768px) {
  #liveChatRoot.live-chat,
  .live-chat {
    right: 16px !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  a.whatsapp-float {
    left: 16px !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .scroll-top {
    right: 16px !important;
    bottom: calc(148px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .live-chat-launcher {
    width: 54px !important;
    height: 54px !important;
    min-width: 54px !important;
  }

  .live-chat-greeting {
    bottom: 70px !important;
    width: min(290px, calc(100vw - 88px)) !important;
  }

  .live-chat-panel {
    position: fixed !important;
    right: 12px !important;
    left: 12px !important;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    height: min(74vh, 620px) !important;
  }

  .live-chat-preform-grid,
  .live-chat-dept-options {
    grid-template-columns: 1fr !important;
  }

  .live-chat-header h3 { max-width: 140px; }
}
