
:root {
  --desh-chat-navy: #1c2b82;
  --desh-chat-blue: #1f7cc4;
  --desh-chat-green: #3dae49;
  --desh-chat-green-dark: #2f9139;
  --desh-chat-bg: #f4f7fc;
  --desh-chat-line: #dce5f3;
  --desh-chat-text: #1d2540;
  --desh-chat-nav-h: 64px;
}

.desh-chat-root, .desh-chat-root *,
.desh-chat-wall, .desh-chat-wall *,
.desh-chat-navbar, .desh-chat-navbar * {
  box-sizing: border-box;
}

/* ============================================================
   RIGHT-WALL BUTTONS  (Call / WhatsApp / AI Chat / Back to top)
   ============================================================ */
.desh-chat-wall {
  position: fixed;
  right: 0;
  width: 52px;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 14px 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 21px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  z-index: 99980;
  box-shadow: -4px 5px 18px rgba(0, 0, 0, .22);
  transition: transform .3s ease, box-shadow .3s ease, opacity .25s ease, visibility .25s;
  -webkit-tap-highlight-color: transparent;
}
.desh-chat-wall:hover,
.desh-chat-wall:focus-visible {
  color: #fff;
  transform: translateX(-7px);
  box-shadow: -8px 8px 25px rgba(0, 0, 0, .3);
}
.desh-chat-wall:focus-visible { outline: 3px solid var(--desh-chat-green); outline-offset: 2px; }

.desh-chat-wall-call { bottom: 235px; background: linear-gradient(135deg, var(--desh-chat-navy), var(--desh-chat-blue)); }
.desh-chat-wall-wa   { bottom: 175px; background: #25d366; }
.desh-chat-wall-chat { bottom: 115px; background: linear-gradient(135deg, var(--desh-chat-blue), var(--desh-chat-green)); animation: deshChatWallPulse 2.5s infinite; }
.desh-chat-wall-top  { bottom: 55px;  background: var(--desh-chat-navy); opacity: 0; visibility: hidden; transform: translateX(20px); }
.desh-chat-wall-top.desh-chat-show { opacity: 1; visibility: visible; transform: none; }
.desh-chat-wall-top.desh-chat-show:hover { transform: translateX(-7px); }

.desh-chat-wall i { animation: deshChatBounce 2s infinite; }
.desh-chat-wall-top i { animation: none; }
.desh-chat-wall-chat.desh-chat-hidden { display: none; }

@keyframes deshChatBounce { 0%, 80%, 100% { transform: none; } 90% { transform: translateY(-3px) scale(1.12); } }
@keyframes deshChatWallPulse {
  0%   { box-shadow: -4px 5px 18px rgba(0, 0, 0, .22), 0 0 0 0 rgba(61, 174, 73, .55); }
  70%  { box-shadow: -4px 5px 18px rgba(0, 0, 0, .22), 0 0 0 14px rgba(61, 174, 73, 0); }
  100% { box-shadow: -4px 5px 18px rgba(0, 0, 0, .22), 0 0 0 0 rgba(61, 174, 73, 0); }
}

/* tooltip label (hover devices only) */
@media (hover: hover) {
  .desh-chat-wall::before {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    padding: 6px 11px;
    border-radius: 7px;
    background: var(--desh-chat-navy);
    color: #fff;
    font: 600 12px/1 "Segoe UI", Arial, sans-serif;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  .desh-chat-wall:hover::before { opacity: 1; transform: translateY(-50%); }
}

/* desktop: buttons hidden while chat panel is open */
body.desh-chat-is-open .desh-chat-wall { display: none; }


/* ============================================================
   CHAT WINDOW
   ============================================================ */
.desh-chat-window {
  position: fixed;
  right: 0;
  bottom: 20px;
  z-index: 100000;
  width: 390px;
  max-width: 100vw;
  height: min(660px, calc(100vh - 40px));
  height: min(585px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px 0 0 18px;
  overflow: hidden;
  box-shadow: -6px 8px 34px rgba(18, 28, 90, .3);
  transform: translateX(110%);
  visibility: hidden;
  transition: transform .3s ease, visibility 0s linear .3s;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--desh-chat-text);
  outline: none;
}
.desh-chat-window.desh-chat-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .3s ease, visibility 0s;
}

/* ---------- Header: logo top-left, refresh + close right ---------- */
.desh-chat-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 12px;
  background:
    radial-gradient(circle at 92% -20%, rgba(61, 174, 73, .55) 0, rgba(61, 174, 73, 0) 45%),
    radial-gradient(circle at 70% 130%, rgba(255, 255, 255, .16) 0, rgba(255, 255, 255, 0) 40%),
    linear-gradient(120deg, var(--desh-chat-navy) 0%, var(--desh-chat-blue) 100%);
  overflow: hidden;
}
.desh-chat-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 66px;
  padding: 4px 6px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .22);
}
.desh-chat-logo img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }

.desh-chat-header-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: #fff; }
.desh-chat-online { display: inline-flex; align-items: center; gap: 6px; font: 700 14px/1 "Segoe UI", Arial, sans-serif; }
.desh-chat-online i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #5fe36d;
  box-shadow: 0 0 0 0 rgba(95, 227, 109, .7);
  animation: deshChatOnline 1.8s infinite;
}
@keyframes deshChatOnline { 70% { box-shadow: 0 0 0 7px rgba(95, 227, 109, 0); } 100% { box-shadow: 0 0 0 0 rgba(95, 227, 109, 0); } }
.desh-chat-header-sub { font-size: 12px; opacity: .85; }

.desh-chat-header-actions { flex: 0 0 auto; display: flex; gap: 6px; align-self: flex-start; padding: 14px 10px 10px 10px;}
.desh-chat-icon-btn {
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  color: #fff; font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, transform .25s ease;
}
.desh-chat-icon-btn:hover { background: rgba(255, 255, 255, .36); }
.desh-chat-icon-btn:active { transform: scale(.9); }
#deshChatRefresh:hover i { animation: deshChatSpin .6s linear; }
@keyframes deshChatSpin { to { transform: rotate(-360deg); } }

/* services strip */
.desh-chat-strip {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 12px;
  background: #fff;
  border-bottom: 1px solid var(--desh-chat-line);
  font: 600 11.5px/1 "Segoe UI", Arial, sans-serif;
  color: var(--desh-chat-navy);
  overflow: hidden;
}
.desh-chat-strip span { white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.desh-chat-strip i { color: var(--desh-chat-green); margin-right: 4px; }

/* header, strip and composer must never shrink; only the body scrolls */
.desh-chat-header,
.desh-chat-strip,
.desh-chat-composer {
  flex: 0 0 auto;
}

.desh-chat-body {
  flex: 1 1 0;      /* take the remaining height and scroll inside it */
  min-height: 0;
}

/* ---------- Body ---------- */
.desh-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 10px;
  background-color: var(--desh-chat-bg);
  background-image: radial-gradient(#d5e1f3 1px, transparent 1px);
  background-size: 18px 18px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.desh-chat-body::-webkit-scrollbar { width: 6px; }
.desh-chat-body::-webkit-scrollbar-thumb { background: #c3cfe6; border-radius: 6px; }

.desh-chat-msg { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 10px; animation: deshChatIn .28s ease; }
.desh-chat-msg-bot { justify-content: flex-start; }
.desh-chat-msg-user { justify-content: flex-end; }
@keyframes deshChatIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.desh-chat-avatar {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--desh-chat-navy), var(--desh-chat-green));
  color: #fff; font-size: 13px;
  box-shadow: 0 2px 6px rgba(28, 43, 130, .3);
}
.desh-chat-avatar-gap { flex: 0 0 auto; width: 28px; }

.desh-chat-bubble {
  max-width: 82%;
  padding: 10px 13px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.desh-chat-msg-bot .desh-chat-bubble {
  background: #fff;
  color: var(--desh-chat-text);
  border: 1px solid var(--desh-chat-line);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 8px rgba(28, 43, 130, .06);
}
.desh-chat-msg-user .desh-chat-bubble {
  background: linear-gradient(120deg, var(--desh-chat-navy), var(--desh-chat-blue));
  color: #fff;
  border-radius: 16px 4px 16px 16px;
  box-shadow: 0 3px 10px rgba(28, 43, 130, .25);
}
.desh-chat-bubble a { color: var(--desh-chat-blue); font-weight: 600; text-decoration: none; }
.desh-chat-bubble a:hover { text-decoration: underline; }
.desh-chat-bubble strong { color: var(--desh-chat-navy); }
.desh-chat-msg-user .desh-chat-bubble strong,
.desh-chat-msg-user .desh-chat-bubble a { color: #fff; }

/* welcome card */
.desh-chat-card { margin: -10px -13px; border-radius: 4px 16px 16px 16px; overflow: hidden; }
.desh-chat-card-top {
  padding: 14px 14px 12px;
  color: #fff;
  background: linear-gradient(120deg, var(--desh-chat-navy), var(--desh-chat-blue));
}
.desh-chat-card-top h4 { margin: 0 0 3px; font-size: 16px; font-weight: 700; color: #fff; }
.desh-chat-card-top p { margin: 0; font-size: 12.5px; opacity: .9; }
.desh-chat-card-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 11px 12px; background: #fff; }
.desh-chat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  border-radius: 14px;
  background: #eaf6ec;
  color: var(--desh-chat-green-dark);
  font: 600 11.5px/1 "Segoe UI", Arial, sans-serif;
}
.desh-chat-chip.desh-chat-chip-blue { background: #e8f2fb; color: var(--desh-chat-blue); }

/* typing dots */
.desh-chat-typing { display: flex; gap: 5px; padding: 13px 15px; }
.desh-chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--desh-chat-blue); opacity: .4; animation: deshChatDot 1s infinite; }
.desh-chat-typing span:nth-child(2) { animation-delay: .15s; }
.desh-chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes deshChatDot { 50% { opacity: 1; transform: translateY(-3px); } }

/* quick buttons */
.desh-chat-quick-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px 36px; animation: deshChatIn .28s ease; }
.desh-chat-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 8px 13px;
  border: 1.5px solid var(--desh-chat-blue);
  border-radius: 20px;
  background: #fff;
  color: var(--desh-chat-navy);
  font: 600 13px/1.3 "Segoe UI", Arial, sans-serif;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(31, 124, 196, .1);
  transition: background .2s ease, color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.desh-chat-quick-btn i { font-size: 12px; color: var(--desh-chat-blue); transition: color .2s ease; }
.desh-chat-quick-btn:hover { background: var(--desh-chat-blue); color: #fff; box-shadow: 0 5px 12px rgba(31, 124, 196, .3); transform: translateY(-1px); }
.desh-chat-quick-btn:hover i { color: #fff; }
.desh-chat-quick-btn:active { transform: scale(.97); }
.desh-chat-quick-btn.desh-chat-quick-cta { background: linear-gradient(120deg, var(--desh-chat-green), var(--desh-chat-green-dark)); border-color: var(--desh-chat-green); color: #fff; }
.desh-chat-quick-btn.desh-chat-quick-cta i { color: #fff; }
.desh-chat-quick-btn.desh-chat-quick-cta:hover { filter: brightness(1.08); }

/* ---------- Enquiry form ---------- */
.desh-chat-msg-form .desh-chat-bubble { width: 100%; max-width: 100%; padding: 14px; }
.desh-chat-msg-form .desh-chat-avatar,
.desh-chat-msg-form .desh-chat-avatar-gap { display: none; }
.desh-chat-form-title { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--desh-chat-navy); }
.desh-chat-field { margin-bottom: 10px; }
.desh-chat-field label { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--desh-chat-navy); }
.desh-chat-field label em { color: #d93025; font-style: normal; }
.desh-chat-field input,
.desh-chat-field select,
.desh-chat-field textarea {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--desh-chat-line);
  border-radius: 9px;
  background: #fff;
  color: var(--desh-chat-text);
  font: 14px/1.4 "Segoe UI", Arial, sans-serif;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.desh-chat-field textarea { resize: vertical; min-height: 70px; }
.desh-chat-field input:focus,
.desh-chat-field select:focus,
.desh-chat-field textarea:focus {
  outline: none;
  border-color: var(--desh-chat-blue);
  box-shadow: 0 0 0 3px rgba(31, 124, 196, .18);
}
.desh-chat-field.desh-chat-invalid input,
.desh-chat-field.desh-chat-invalid select,
.desh-chat-field.desh-chat-invalid textarea { border-color: #d93025; }
.desh-chat-error { display: none; margin-top: 3px; font-size: 12px; color: #d93025; }
.desh-chat-field.desh-chat-invalid .desh-chat-error { display: block; }
.desh-chat-turnstile { min-height: 65px; max-width: 100%; overflow: hidden; margin-bottom: 8px; }
.desh-chat-turnstile.desh-chat-turnstile-invalid { outline: 2px solid #d93025; outline-offset: 2px; border-radius: 6px; }
.desh-chat-submit {
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(120deg, var(--desh-chat-green), var(--desh-chat-blue));
  color: #fff;
  font: 700 14.5px/1 "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  transition: filter .2s ease, transform .15s ease;
}
.desh-chat-submit:hover { filter: brightness(1.08); }
.desh-chat-submit:active { transform: scale(.98); }
.desh-chat-submit:disabled { opacity: .65; cursor: not-allowed; }
.desh-chat-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* ---------- Composer ---------- */
.desh-chat-composer {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-top: 1px solid var(--desh-chat-line);
}
.desh-chat-composer input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--desh-chat-line);
  border-radius: 22px;
  font: 14.5px "Segoe UI", Arial, sans-serif;
  color: var(--desh-chat-text);
  background: var(--desh-chat-bg);
  transition: border-color .2s ease, background .2s ease;
}
.desh-chat-composer input:focus { outline: none; border-color: var(--desh-chat-blue); background: #fff; }
.desh-chat-send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  border: 0; border-radius: 50%;
  background: linear-gradient(120deg, var(--desh-chat-navy), var(--desh-chat-blue));
  color: #fff; font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s ease, filter .2s ease;
}
.desh-chat-send:hover { filter: brightness(1.15); }
.desh-chat-send:active { transform: scale(.92); }

/* ---------- Mobile bottom navbar (hidden on desktop) ---------- */
.desh-chat-navbar { display: none; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {

  /* stop any sideways scrolling on the page */
  html, body { overflow-x: hidden !important; max-width: 100% !important; }
  body { padding-bottom: calc(var(--desh-chat-nav-h) + env(safe-area-inset-bottom, 0px)); }

  /* wall buttons: call / WhatsApp / chat live in the navbar on mobile */
  .desh-chat-wall-call,
  .desh-chat-wall-wa,
  .desh-chat-wall-chat { display: none !important; }

  /* back-to-top stays, sitting just above the navbar, flush with the right wall */
  .desh-chat-wall-top {
    width: 40px;
    height: 40px;
    font-size: 16px;
    border-radius: 12px 0 0 12px;
    bottom: calc(var(--desh-chat-nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  }
  .desh-chat-wall-top.desh-chat-show:hover { transform: none; }

  /* ---- navbar: 5 equal columns, clipped, cannot scroll ---- */
  .desh-chat-navbar {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: calc(var(--desh-chat-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    padding: 0 0 env(safe-area-inset-bottom, 0px) !important;
    list-style: none !important;
    overflow: hidden !important;
    white-space: normal !important;
    transform: none !important;
    z-index: 99990;
    background: #fff;
    border-top: 1px solid var(--desh-chat-line);
    box-shadow: 0 -4px 18px rgba(28, 43, 130, .14);
    touch-action: manipulation;
  }
  .desh-chat-navbar::before {            /* logo-colour accent line */
    content: "";
    position: absolute; left: 0; right: 0; top: 0; height: 3px;
    background: linear-gradient(90deg, var(--desh-chat-navy), var(--desh-chat-blue), var(--desh-chat-green));
  }
  .desh-chat-nav-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 100%;
    margin: 0 !important;
    padding: 6px 2px 4px !important;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--desh-chat-navy);
    font: 600 11px/1.1 "Segoe UI", Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }
  .desh-chat-nav-item i { font-size: 19px; line-height: 1; }
  .desh-chat-nav-item span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .desh-chat-nav-item:active { background: var(--desh-chat-bg); }
  .desh-chat-nav-wa { color: #1ea952; }

  .desh-chat-nav-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--desh-chat-navy), var(--desh-chat-blue) 60%, var(--desh-chat-green));
    color: #fff;
    box-shadow: 0 4px 10px rgba(28, 43, 130, .35);
  }
  .desh-chat-nav-bubble i { font-size: 18px; color: #fff; }
  .desh-chat-nav-main { gap: 3px; padding-top: 7px !important; }

  /* ---- chat window: full screen ---- */
  .desh-chat-window {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    transform: translateY(100%);
  }
  .desh-chat-window.desh-chat-open { transform: translateY(0); }
  .desh-chat-bubble { font-size: 14px; max-width: 84%; }
  .desh-chat-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .desh-chat-field input,
  .desh-chat-field select,
  .desh-chat-field textarea,
  .desh-chat-composer input { font-size: 16px; }   /* stops iOS zoom on focus */
  body.desh-chat-is-open .desh-chat-wall-top { display: none; }
}

@media (max-width: 360px) {
  .desh-chat-nav-item { font-size: 10px !important; }
  .desh-chat-logo { width: 72px; height: 58px; }
  .desh-chat-strip span:nth-child(3) { display: none; }
  .desh-chat-quick-btn { font-size: 12.5px; padding: 7px 11px; }
  .desh-chat-quick-row { margin-left: 0; }
}

@media (max-height: 560px) and (min-width: 769px) {
  .desh-chat-window { bottom: 8px; height: calc(100vh - 16px); }
  .desh-chat-wall-call { bottom: 175px; }
  .desh-chat-wall-wa { bottom: 125px; }
  .desh-chat-wall-chat { bottom: 75px; }
  .desh-chat-wall-top { bottom: 20px; }
  .desh-chat-wall { width: 44px; height: 44px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .desh-chat-window, .desh-chat-msg, .desh-chat-quick-row,
  .desh-chat-wall, .desh-chat-wall i, .desh-chat-online i { animation: none !important; transition: none !important; }
}