/* =====================================================================
   Shakti Academy — Chat Widget styles
   All classes are namespaced with .cbw- so they cannot collide with the
   existing site's CSS. Colour variables are scoped to the two widget
   roots (not :root) so nothing leaks into the host page either.
   ===================================================================== */

.cbw-launcher,
.cbw-panel {
  --cbw-accent: #E76A0C;
  --cbw-accent-deep: #B23A08;
  --cbw-ink: #20160E;
}

/* ---------- Launcher bubble ---------- */
.cbw-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(150deg, var(--cbw-accent), var(--cbw-accent-deep));
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .30), 0 4px 10px rgba(0, 0, 0, .12);
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3), box-shadow .25s;
}
.cbw-launcher:hover  { transform: translateY(-2px) scale(1.04); }
.cbw-launcher:active { transform: scale(.96); }
.cbw-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.cbw-launcher svg { width: 27px; height: 27px; fill: #fff; transition: opacity .2s, transform .2s; }
.cbw-launcher .cbw-ic-close { position: absolute; opacity: 0; transform: rotate(-30deg); }
body.cbw-open .cbw-launcher .cbw-ic-chat  { opacity: 0; transform: rotate(30deg); }
body.cbw-open .cbw-launcher .cbw-ic-close { opacity: 1; transform: rotate(0); }

/* ---------- Chat panel ---------- */
.cbw-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 2147483000;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 588px;
  max-height: calc(100vh - 128px);
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-shadow: 0 24px 60px -12px rgba(32, 22, 14, .32), 0 8px 20px rgba(0, 0, 0, .10);
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(14px) scale(.96);
  pointer-events: none;
  transition: opacity .24s ease, transform .28s cubic-bezier(.2, .9, .3, 1.2);
}
body.cbw-open .cbw-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ---------- Header ---------- */
.cbw-header {
  background: linear-gradient(150deg, var(--cbw-accent), var(--cbw-accent-deep));
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.cbw-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, .35);
}
.cbw-titles { flex: 1; min-width: 0; }
.cbw-title  { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.cbw-status { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.cbw-dot    { width: 7px; height: 7px; border-radius: 50%; background: #3BE38B; box-shadow: 0 0 0 3px rgba(59, 227, 139, .25); }
.cbw-hbtn {
  background: rgba(255, 255, 255, .14);
  border: none; color: #fff; cursor: pointer;
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  transition: background .15s;
}
.cbw-hbtn:hover { background: rgba(255, 255, 255, .28); }
.cbw-hbtn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.cbw-hbtn svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; }

/* ---------- Message area ---------- */
.cbw-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 8px;
  background:
    radial-gradient(600px 300px at 100% 0%, #FFF4EA, rgba(255, 244, 234, 0) 70%),
    #FBFAF8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.cbw-body::-webkit-scrollbar { width: 8px; }
.cbw-body::-webkit-scrollbar-thumb { background: #E6DED5; border-radius: 8px; }

.cbw-msg {
  max-width: 82%;
  padding: 11px 14px;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: cbw-pop .32s cubic-bezier(.2, .9, .3, 1.2) both;
}
.cbw-msg.bot {
  align-self: flex-start;
  background: #F3EFEA;
  color: var(--cbw-ink);
  border-bottom-left-radius: 5px;
}
.cbw-msg.user {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(150deg, var(--cbw-accent), var(--cbw-accent-deep));
  border-bottom-right-radius: 5px;
}
@keyframes cbw-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cbw-typing {
  align-self: flex-start;
  background: #F3EFEA;
  padding: 14px 16px;
  border-radius: 16px;
  border-bottom-left-radius: 5px;
  display: flex; gap: 5px;
  animation: cbw-pop .2s ease both;
}
.cbw-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #C4B6A6;
  animation: cbw-bounce 1.2s infinite ease-in-out;
}
.cbw-typing span:nth-child(2) { animation-delay: .15s; }
.cbw-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cbw-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: .5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Footer / controls ---------- */
.cbw-footer {
  flex-shrink: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid #EFE9E1;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
}
.cbw-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cbw-chip {
  border: 1.5px solid #EAD9C7;
  background: #fff;
  color: var(--cbw-accent-deep);
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
  animation: cbw-pop .3s ease both;
}
.cbw-chip:hover {
  background: var(--cbw-accent);
  border-color: var(--cbw-accent);
  color: #fff;
  transform: translateY(-1px);
}
.cbw-chip:focus-visible { outline: 2px solid var(--cbw-accent); outline-offset: 2px; }
.cbw-chip[disabled] { opacity: .55; cursor: default; }

/* WhatsApp hand-off button — uses WhatsApp's own green so it reads as
   "this leaves the site and opens WhatsApp" rather than another option. */
.cbw-chip-wa {
  background: #25D366;
  border-color: #25D366;
  color: #fff;
  font-weight: 600;
}
.cbw-chip-wa:hover {
  background: #1EBE5A;
  border-color: #1EBE5A;
  color: #fff;
}
.cbw-chip-wa:focus-visible { outline: 2px solid #128C7E; outline-offset: 2px; }

.cbw-inputrow { display: flex; gap: 8px; align-items: stretch; }
.cbw-input {
  flex: 1;
  border: 1.5px solid #EAD9C7;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--cbw-ink);
  outline: none;
  transition: border .15s;
}
.cbw-input:focus { border-color: var(--cbw-accent); }
.cbw-send {
  border: none;
  background: var(--cbw-accent);
  color: #fff;
  width: 44px;
  border-radius: 12px;
  cursor: pointer;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background .15s;
}
.cbw-send:hover { background: var(--cbw-accent-deep); }
.cbw-send svg { width: 19px; height: 19px; fill: #fff; }
.cbw-error { font-size: 12px; color: #D8345F; padding: 0 2px; }

.cbw-brand {
  text-align: center;
  font-size: 11px;
  color: #B3A899;
  padding-bottom: 2px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  .cbw-panel {
    right: 12px; left: 12px;
    bottom: 88px;
    width: auto;
    height: calc(100vh - 150px);
  }
  .cbw-launcher { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .cbw-panel, .cbw-launcher, .cbw-msg, .cbw-chip, .cbw-typing span {
    transition: none !important;
    animation: none !important;
  }
}
