/* ==========================================================================
   FIRST OWNER MEDIA — SITE CHATBOT ("Owen")
   Poora widget JS se inject hota hai (chatbot.js). Yahan sirf styling hai.
   Site ke baaki CSS se takraav na ho isliye har class ka prefix: .fo-chat
   ========================================================================== */

.fo-chat {
  --fc-blue: #1264F4;
  --fc-blue-dark: #0B4BC0;
  --fc-blue-soft: #EBF3FF;
  --fc-ink: #050505;
  --fc-muted: #64748B;
  --fc-line: #E2E8F0;
  --fc-radius: 18px;
  --fc-ease: cubic-bezier(0.22, 1, 0.36, 1);

  font-family: 'Plus Jakarta Sans', 'Jakarta Fallback', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   LAUNCHER BUTTON
   WhatsApp float wale pages par uske thoda upar baithta hai.
   -------------------------------------------------------------------------- */
.fo-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(140deg, #3B85FF 0%, var(--fc-blue) 45%, var(--fc-blue-dark) 100%);
  color: #FFFFFF;
  cursor: pointer;
  box-shadow:
    0 10px 26px rgba(18, 100, 244, 0.40),
    0 2px 6px rgba(5, 5, 5, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
  transition: transform 0.35s var(--fc-ease), box-shadow 0.35s ease,
              opacity 0.25s ease, visibility 0.25s ease;
}

/* Halka sa pulse ring — dhyan kheenchta hai par chubhta nahi */
.fo-chat-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--fc-blue);
  opacity: 0;
  pointer-events: none;
  animation: fo-chat-ring 3.2s var(--fc-ease) infinite;
}

@keyframes fo-chat-ring {
  0%        { transform: scale(1);    opacity: 0.55; }
  55%, 100% { transform: scale(1.62); opacity: 0; }
}

.fo-chat-launcher:hover .fo-chat-ring { animation-play-state: paused; }

/* .has-wa class JS lagata hai jab page par WhatsApp float button hota hai */
.fo-chat.has-wa .fo-chat-launcher { bottom: 90px; }

.fo-chat-launcher:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow:
    0 18px 38px rgba(18, 100, 244, 0.50),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.fo-chat-launcher:active { transform: translateY(-1px) scale(0.98); }

.fo-chat-launcher:focus-visible {
  outline: 3px solid var(--fc-blue-soft);
  outline-offset: 3px;
}

.fo-chat-ico-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Bot ke "ears" kinare tak jaate hain, isliye icon thoda bada rakha hai */
.fo-chat-launcher svg {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 1px 2px rgba(5, 5, 5, 0.18));
}

/* Panel khula ho to launcher chhup jaata hai (mobile par jagah bachti hai) */
.fo-chat.is-open .fo-chat-launcher {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
}

/* "Online" dot — halka blink karta hai */
.fo-chat-pulse {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #22C55E;
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 1px 4px rgba(5, 5, 5, 0.22);
  animation: fo-chat-blink 2.6s ease-in-out infinite;
}

@keyframes fo-chat-blink {
  0%, 100% { transform: scale(1);    }
  50%      { transform: scale(1.14); }
}

/* --------------------------------------------------------------------------
   TEASER BUBBLE — pehli baar hi dikhta hai
   -------------------------------------------------------------------------- */
.fo-chat-teaser {
  position: fixed;
  right: 92px;
  bottom: 32px;
  z-index: 1199;
  max-width: 232px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px 14px 2px 14px;
  background: #FFFFFF;
  border: 1px solid var(--fc-line);
  box-shadow: 0 14px 34px rgba(5, 5, 5, 0.14);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--fc-ink);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s var(--fc-ease);
}

.fo-chat.has-wa .fo-chat-teaser { bottom: 98px; }

.fo-chat-teaser.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.fo-chat.is-open .fo-chat-teaser {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fo-chat-teaser-text strong { display: block; font-weight: 700; }
.fo-chat-teaser-text span { color: var(--fc-muted); }

.fo-chat-teaser-x {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--fc-muted);
  cursor: pointer;
}

.fo-chat-teaser-x:hover { background: #F1F5F9; color: var(--fc-ink); }
.fo-chat-teaser-x svg { width: 13px; height: 13px; }

/* --------------------------------------------------------------------------
   PANEL
   -------------------------------------------------------------------------- */
.fo-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1201;
  width: 374px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--fc-line);
  border-radius: var(--fc-radius);
  box-shadow: 0 28px 70px rgba(5, 5, 5, 0.24);
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px) scale(0.97);
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.35s var(--fc-ease),
              visibility 0.3s ease;
}

.fo-chat.is-open .fo-chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* ---- Header ---- */
.fo-chat-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: linear-gradient(135deg, var(--fc-blue) 0%, var(--fc-blue-dark) 100%);
  color: #FFFFFF;
}

.fo-chat-avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.fo-chat-avatar svg { width: 23px; height: 23px; }

.fo-chat-avatar::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22C55E;
  border: 2px solid var(--fc-blue-dark);
}

.fo-chat-head-text { flex: 1; min-width: 0; }

.fo-chat-head-text strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
}

.fo-chat-head-text span {
  display: block;
  font-size: 0.74rem;
  opacity: 0.82;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fo-chat-head-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.25s ease;
}

.fo-chat-head-btn:hover { background: rgba(255, 255, 255, 0.28); }
.fo-chat-head-btn svg { width: 16px; height: 16px; }

/* ---- Message list ---- */
.fo-chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 8px;
  background:
    radial-gradient(#E2E8F0 1px, transparent 1px) 0 0 / 22px 22px,
    #FAFBFC;
  scroll-behavior: smooth;
}

.fo-chat-log::-webkit-scrollbar { width: 6px; }
.fo-chat-log::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 3px;
}

.fo-chat-row {
  display: flex;
  margin-bottom: 10px;
  animation: fo-chat-in 0.32s var(--fc-ease) both;
}

.fo-chat-row.is-user { justify-content: flex-end; }

@keyframes fo-chat-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fo-chat-bubble {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 14px 14px 14px 4px;
  background: #FFFFFF;
  border: 1px solid var(--fc-line);
  color: var(--fc-ink);
  font-size: 0.86rem;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(5, 5, 5, 0.04);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.fo-chat-row.is-user .fo-chat-bubble {
  border-radius: 14px 14px 4px 14px;
  background: var(--fc-blue);
  border-color: var(--fc-blue);
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(18, 100, 244, 0.26);
}

.fo-chat-bubble strong { font-weight: 700; }
.fo-chat-bubble em { font-style: normal; color: var(--fc-blue); font-weight: 600; }
.fo-chat-row.is-user .fo-chat-bubble em { color: #FFFFFF; }

.fo-chat-bubble p { margin: 0 0 8px; }
.fo-chat-bubble p:last-child { margin-bottom: 0; }

.fo-chat-bubble ul {
  margin: 0 0 8px;
  padding-left: 16px;
  list-style: none;
}

.fo-chat-bubble ul:last-child { margin-bottom: 0; }

.fo-chat-bubble li {
  position: relative;
  margin-bottom: 5px;
}

.fo-chat-bubble li::before {
  content: "";
  position: absolute;
  left: -13px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fc-blue);
}

.fo-chat-bubble li:last-child { margin-bottom: 0; }

.fo-chat-bubble a { color: var(--fc-blue); font-weight: 600; }

/* Chhoti stat strip */
.fo-chat-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.fo-chat-stat {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--fc-blue-soft);
  color: var(--fc-blue-dark);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ---- Typing indicator ---- */
.fo-chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px;
}

.fo-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94A3B8;
  animation: fo-chat-dot 1.2s infinite ease-in-out;
}

.fo-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.fo-chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes fo-chat-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-3px); }
}

/* ---- Quick reply chips ---- */
.fo-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 16px 12px;
  background: #FAFBFC;
}

.fo-chat-chips:empty { display: none; }

.fo-chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border: 1px solid #C9DCFF;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--fc-blue-dark);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.22s ease, color 0.22s ease,
              transform 0.22s var(--fc-ease), border-color 0.22s ease;
  animation: fo-chat-in 0.3s var(--fc-ease) both;
}

.fo-chat-chip:hover {
  background: var(--fc-blue);
  border-color: var(--fc-blue);
  color: #FFFFFF;
  transform: translateY(-2px);
}

.fo-chat-chip svg { width: 13px; height: 13px; }

.fo-chat-chip.is-wa {
  border-color: #A7EFC5;
  color: #0E8A45;
}

.fo-chat-chip.is-wa:hover {
  background: #25D366;
  border-color: #25D366;
  color: #FFFFFF;
}

/* ---- Composer ---- */
.fo-chat-form {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--fc-line);
  background: #FFFFFF;
}

.fo-chat-input {
  flex: 1;
  min-width: 0;
  max-height: 96px;
  padding: 11px 13px;
  border: 1px solid var(--fc-line);
  border-radius: 12px;
  background: #F8FAFC;
  color: var(--fc-ink);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: none;
  transition: border-color 0.22s ease, background 0.22s ease;
}

.fo-chat-input::placeholder { color: #94A3B8; }

.fo-chat-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--fc-blue);
}

.fo-chat-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--fc-blue);
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.22s ease, transform 0.22s var(--fc-ease);
}

.fo-chat-send:hover { background: var(--fc-blue-dark); transform: scale(1.05); }
.fo-chat-send:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.fo-chat-send svg { width: 17px; height: 17px; }

.fo-chat-foot {
  flex-shrink: 0;
  padding: 0 14px 10px;
  background: #FFFFFF;
  text-align: center;
  font-size: 0.66rem;
  color: #94A3B8;
}

.fo-chat-foot a { color: #64748B; font-weight: 600; text-decoration: none; }
.fo-chat-foot a:hover { color: var(--fc-blue); }

/* --------------------------------------------------------------------------
   RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .fo-chat-launcher {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }

  .fo-chat-launcher svg { width: 28px; height: 28px; }

  .fo-chat.has-wa .fo-chat-launcher { bottom: 76px; }

  .fo-chat-teaser { display: none; }

  .fo-chat-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border: none;
    border-radius: 0;
  }

  .fo-chat-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .fo-chat-form { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .fo-chat-bubble { max-width: 90%; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fo-chat-ring,
  .fo-chat-pulse { animation: none; }

  .fo-chat-launcher,
  .fo-chat-panel,
  .fo-chat-teaser,
  .fo-chat-row,
  .fo-chat-chip {
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }

  .fo-chat-log { scroll-behavior: auto; }
}
