/* ==========================================================================
   ARHANT SOLUTIONS — AI CHATBOT WIDGET STYLES (MODERN LIGHT THEME)
   Scoped cleanly under #arhant-chatbot-root
   ========================================================================== */

#arhant-chatbot-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Floating Launcher Button */
.acb-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a1628 0%, #1e3a8a 50%, #2563eb 100%);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  position: relative;
  outline: none;
}

.acb-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.acb-launcher:active {
  transform: scale(0.95);
}

.acb-launcher__icon {
  width: 28px;
  height: 28px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.acb-launcher__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0a1628;
}

/* Teaser / Auto-Popup Bubble (Modern Light Card) */
.acb-teaser {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 290px;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  padding: 14px 16px;
  cursor: pointer;
  animation: acb-slide-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acb-teaser::after {
  content: "";
  position: absolute;
  bottom: -8px;
  right: 24px;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  transform: rotate(45deg);
}

.acb-teaser__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.acb-teaser__tag {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.acb-teaser__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
  animation: acb-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.acb-teaser__close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.acb-teaser__close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.acb-teaser__text {
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
  font-weight: 500;
  margin: 0;
}

/* Chat Window Panel (Modern Light Elevated Container) */
.acb-window {
  display: none;
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 384px;
  height: 570px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.16), 0 0 1px 1px rgba(0, 0, 0, 0.04);
  flex-direction: column;
  overflow: hidden;
  animation: acb-scale-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.acb-window.is-open {
  display: flex;
}

/* Chat Header (Deep Arhant Navy Authority Gradient) */
.acb-header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #0a1628 0%, #0f2240 50%, #162d52 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.acb-header__brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.acb-header__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #0d9488 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 13.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  position: relative;
}

.acb-header__avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #10b981;
  border: 2px solid #0a1628;
  border-radius: 50%;
}

.acb-header__info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.acb-header__info p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

.acb-header__info p span {
  color: #10b981;
  font-size: 10px;
}

.acb-header__actions button {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.acb-header__actions button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

/* Chat Messages Scroll Container */
.acb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.acb-messages::-webkit-scrollbar {
  width: 6px;
}
.acb-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

/* Message Bubbles */
.acb-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: acb-fade-in 0.2s ease;
}

.acb-msg--bot {
  align-self: flex-start;
}

.acb-msg--user {
  align-self: flex-end;
}

.acb-msg__bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.acb-msg--bot .acb-msg__bubble {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.acb-msg--bot .acb-msg__bubble strong {
  color: #0a1628;
  font-weight: 700;
}

.acb-msg--user .acb-msg__bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.acb-msg__time {
  font-size: 10.5px;
  color: #64748b; /* High-contrast slate (passes WCAG AA) */
  margin-top: 3px;
  padding: 0 4px;
}

.acb-msg--user .acb-msg__time {
  align-self: flex-end;
}

/* Accessible Focus-Visible Indicators (WCAG 2.4.7) */
.acb-launcher:focus-visible,
.acb-btn-pill:focus-visible,
.acb-lead-submit:focus-visible,
.acb-lead-skip:focus-visible,
.acb-send-btn:focus-visible,
.acb-header__actions button:focus-visible,
.acb-teaser__close:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Quick-Reply Button Options */
.acb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.acb-btn-pill {
  background: #ffffff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  outline: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.05);
}

.acb-btn-pill:hover {
  background: #eff6ff;
  color: #1e40af;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.12);
}

/* Inline Lead Capture Form Card (Clean Modern Light Card) */
.acb-lead-card {
  background: #ffffff;
  border: 1.5px solid #bfdbfe;
  border-top: 3.5px solid #2563eb;
  border-radius: 14px;
  padding: 14px 16px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  animation: acb-slide-up 0.25s ease;
}

.acb-lead-card__header {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.acb-lead-card__title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.acb-lead-card__sub {
  font-size: 11.5px;
  line-height: 1.45;
  color: #64748b;
  margin: 0;
}

.acb-lead-input-row {
  display: flex;
  gap: 6px;
}

.acb-country-select {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  width: 95px;
  transition: border-color 0.2s ease;
}

.acb-lead-input {
  flex: 1;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.acb-lead-input::placeholder {
  color: #94a3b8;
}

.acb-lead-input:focus,
.acb-country-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.acb-lead-submit {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.acb-lead-submit:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.acb-lead-skip {
  background: none;
  border: none;
  color: #64748b;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
  padding: 2px;
  transition: color 0.2s ease;
}

.acb-lead-skip:hover {
  color: #0f172a;
}

/* Typing Indicator */
.acb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #ffffff;
  border-radius: 14px;
  width: fit-content;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.acb-typing__dot {
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
  animation: acb-bounce 1.4s infinite ease-in-out both;
}

.acb-typing__dot:nth-child(1) { animation-delay: -0.32s; }
.acb-typing__dot:nth-child(2) { animation-delay: -0.16s; }

/* Chat Footer / Input Row */
.acb-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

.acb-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.acb-form:focus-within {
  border-color: #93c5fd;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.acb-input {
  flex: 1;
  background: none;
  border: none;
  color: #0f172a;
  font-size: 13.5px;
  outline: none;
  padding: 6px 0;
}

.acb-input::placeholder {
  color: #94a3b8;
}

.acb-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.acb-send-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: scale(1.05);
}

.acb-send-btn:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Animations */
@keyframes acb-slide-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes acb-scale-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes acb-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@keyframes acb-ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}

/* Mobile Responsive Bottom-Sheet (< 768px) */
@media (max-width: 767px) {
  #arhant-chatbot-root {
    bottom: 16px;
    right: 16px;
  }

  .acb-window {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  /* Critical fix: 16px font-size prevents iOS Safari from auto-zooming on focus */
  .acb-input,
  .acb-lead-input,
  .acb-country-select {
    font-size: 16px !important;
  }

  /* Support iOS safe area for modern notched iPhones / home bar indicator */
  .acb-footer {
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }

  .acb-teaser {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 70px;
  }
}

/* Reduced motion accessibility preference */
@media (prefers-reduced-motion: reduce) {
  .acb-launcher,
  .acb-teaser,
  .acb-window,
  .acb-msg,
  .acb-typing__dot,
  .acb-teaser__pulse {
    animation: none !important;
    transition: none !important;
  }
}
