/* ==========================================================================
   Site assistant + quick contact dock
   Loaded on every page. Purely additive: if this file or chat.js is missing,
   nothing else on the page is affected.
   ========================================================================== */

.dock {
  position: fixed; right: clamp(1rem, 2vw, 1.75rem); bottom: clamp(1rem, 2vw, 1.75rem);
  z-index: 55; display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-3);
}

.dock-btn {
  display: inline-flex; align-items: center; gap: var(--s-3);
  height: 52px; padding: 0 var(--s-5) 0 var(--s-4);
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  color: var(--white); text-decoration: none;
  box-shadow: 0 6px 16px -4px rgba(20,22,28,.28), 0 12px 32px -12px rgba(20,22,28,.34);
  transition: transform .22s var(--ease-out-quint, ease), box-shadow .22s ease,
              background-color .22s ease;
}
.dock-btn svg { flex: none; }
.dock-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -4px rgba(20,22,28,.32), 0 18px 44px -14px rgba(20,22,28,.40); }
.dock-btn:active { transform: translateY(0); }

.dock-btn--chat { background: var(--navy); color: var(--white); }
.dock-btn--chat:hover { background: var(--navy-deep); color: var(--white); }
.dock-btn--wa { background: #1FA855; color: var(--white); }
.dock-btn--wa:hover { background: #17853F; color: var(--white); }

/* On small screens the labels drop and the buttons become circles. */
@media (max-width: 560px) {
  .dock-btn { width: 52px; padding: 0; justify-content: center; }
  .dock-btn .dock-label { display: none; }
}

/* ---------- Panel ---------- */
.chat-panel {
  position: fixed; z-index: 56;
  right: clamp(1rem, 2vw, 1.75rem); bottom: calc(clamp(1rem, 2vw, 1.75rem) + 120px);
  width: min(400px, calc(100vw - 2rem));
  max-height: min(620px, calc(100vh - 200px));
  display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(8,26,46,.28), 0 40px 80px -30px rgba(8,26,46,.34);
  overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(.98); pointer-events: none;
  transition: opacity .26s var(--ease-out-expo, ease), transform .26s var(--ease-out-expo, ease);
}
.chat-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 560px) {
  .chat-panel { right: .75rem; left: .75rem; width: auto; bottom: 5.75rem;
                max-height: calc(100vh - 8rem); }
}

.chat-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-5); background: var(--navy); color: var(--white);
}
.chat-head img { width: 34px; height: 34px; border-radius: 50%; flex: none; background: var(--white); }
.chat-head-text { flex: 1; min-width: 0; line-height: 1.25; }
.chat-head-text b { display: block; font-family: var(--font-display); font-size: 1.02rem; font-weight: 600; }
.chat-head-text span { font-size: .76rem; color: #A9BACA; }
.chat-close {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  background: rgba(255,255,255,.1); color: var(--white);
  border: 0; border-radius: 8px; cursor: pointer; transition: background-color .2s ease;
}
.chat-close:hover { background: rgba(255,255,255,.22); }

.chat-log {
  flex: 1; overflow-y: auto; padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-4);
  background: var(--paper);
  overscroll-behavior: contain;
}

.msg { max-width: 88%; font-size: .94rem; line-height: 1.6; }
.msg-bot {
  align-self: flex-start; background: var(--white); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px 12px 12px 12px;
  padding: var(--s-4);
}
.msg-user {
  align-self: flex-end; background: var(--saffron-deep); color: var(--white);
  border-radius: 12px 4px 12px 12px; padding: var(--s-3) var(--s-4);
}
.msg a { color: var(--saffron-deep); font-weight: 600; }
.msg-user a { color: var(--white); }
.msg-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: var(--s-3);
  font-size: .86rem; font-weight: 600; color: var(--saffron-deep); text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 1px;
}

/* Typing indicator */
.msg-typing { display: flex; gap: 5px; align-items: center; }
.msg-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block;
                animation: chat-dot 1.2s ease-in-out infinite; }
.msg-typing i:nth-child(2) { animation-delay: .16s; }
.msg-typing i:nth-child(3) { animation-delay: .32s; }
@keyframes chat-dot { 0%,60%,100% { opacity: .28; transform: translateY(0); }
                      30% { opacity: 1; transform: translateY(-3px); } }

/* Suggested questions */
.chat-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); padding: 0 var(--s-5) var(--s-4); background: var(--paper); }
.chat-chip {
  border: 1px solid var(--line-strong); background: var(--white); color: var(--ink-soft);
  border-radius: 999px; padding: 6px var(--s-4); font-size: .82rem; font-weight: 500;
  cursor: pointer; transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.chat-chip:hover { border-color: var(--saffron-deep); color: var(--saffron-deep); background: var(--saffron-tint); }

.chat-form {
  display: flex; gap: var(--s-2); padding: var(--s-4);
  border-top: 1px solid var(--line); background: var(--white);
}
.chat-form input {
  flex: 1; min-width: 0; min-height: 44px; padding: var(--s-2) var(--s-4);
  border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--white);
}
.chat-form input:focus { outline: none; border-color: var(--saffron-deep); box-shadow: 0 0 0 3px rgba(178,59,14,.16); }
.chat-send {
  flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  background: var(--saffron-deep); color: var(--white); border: 0; border-radius: 50%;
  cursor: pointer; transition: background-color .2s ease;
}
.chat-send:hover { background: var(--saffron-dark); }
.chat-send:disabled { opacity: .5; cursor: default; }

.chat-note {
  padding: 0 var(--s-5) var(--s-4); background: var(--white);
  font-size: .74rem; color: var(--muted); text-align: center; line-height: 1.5;
}

[data-lang="hi"] .chat-head-text b,
[data-lang="hi"] .msg { font-family: "Noto Sans Devanagari", var(--font-body); }

@media (prefers-reduced-motion: reduce) {
  .chat-panel { transition: none; }
  .dock-btn { transition: none; }
  .dock-btn:hover { transform: none; }
  .msg-typing i { animation: none; opacity: .5; }
}

@media print { .dock, .chat-panel { display: none !important; } }
