/* ============================================================
   Alo, the UPL assistant. Version 2.
   Self-contained. Nothing here overrides existing site styles.
   ============================================================ */

.alo-root {
  --alo-ink: var(--ink, #12142B);
  --alo-blue: var(--blue-500, #29ABE2);
  --alo-orange: #F7931E;
  --alo-orange-soft: #FBB040;
  --alo-panel: #171A34;
  --alo-line: rgba(255, 255, 255, .12);
  --alo-text: #EEF0F6;
  --alo-muted: #A7ADC4;
  --alo-wa: #25D366;
}

/* ============================================================
   Avatar, launcher, header status. Applied exactly as supplied.
   ============================================================ */

/* ---------- আলো avatar ---------- */
.alo-avatar {
  position: relative;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 210deg, #ff8a2b, #2b6cff, #ff8a2b);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.alo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: #fff;
}

/* online dot */
.alo-avatar.is-online::after {
  content: "";
  position: absolute;
  right: 4%;
  bottom: 4%;
  width: 13%;
  height: 13%;
  border-radius: 50%;
  background: #22c55e;
  border: 1.5px solid #fff;
}

/* smaller avatars need a thinner white edge */
.alo-header.is-online::after,
.alo-message.is-online::after {
  border-width: 1px;
  width: 15%;
  height: 15%;
}

/* ---------- sizes: desktop ---------- */
.alo-launcher { width: 96px; height: 96px; }
.alo-header   { width: 60px; height: 60px; }
.alo-message  { width: 48px; height: 48px; }

/* ---------- launcher placement ---------- */
.alo-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(18, 28, 45, 0.30);
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .alo-launcher {
    width: 76px;
    height: 76px;
    right: 14px;
    bottom: 88px;   /* clears the sticky CTA bar */
  }
  .alo-header  { width: 52px; height: 52px; }
  .alo-message { width: 40px; height: 40px; }
}

/* ---------- header status line ---------- */
.alo-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: #9fb0c4;
}

.alo-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex: 0 0 auto;
}

/* ============================================================
   End of supplied block. Everything below is the widget itself.
   ============================================================ */

/* The launcher is a real <button> for keyboard and screen-reader users.
   These only reset button defaults; the sizes above are untouched. */
.alo-launcher {
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  transition: transform .25s ease, opacity .25s ease;
}

.alo-launcher:hover { transform: translateY(-3px); }

.alo-launcher:focus-visible {
  outline: 3px solid var(--alo-orange);
  outline-offset: 3px;
}

/* Hide the launcher while the mobile nav overlay is open. */
body.menu-open .alo-launcher { display: none; }

/* ---------- Panel ---------- */
.alo-panel {
  position: fixed;
  right: 20px;
  bottom: 128px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 40px));
  height: min(600px, calc(100vh - 160px));
  border-radius: 20px;
  overflow: hidden;
  background: var(--alo-panel);
  border: 1px solid var(--alo-line);
  box-shadow: 0 24px 60px rgba(18, 20, 43, .45);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .28s ease, transform .28s ease;
}

.alo-panel[hidden] { display: none; }
.alo-panel.is-open { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- Header ---------- */
.alo-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--alo-line);
  background: linear-gradient(180deg, rgba(41, 171, 226, .10), transparent);
}

.alo-head__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.alo-head__text strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--alo-text);
  letter-spacing: .01em;
  line-height: 1.2;
}

.alo-close {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--alo-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.alo-close:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.alo-close:focus-visible { outline: 2px solid var(--alo-orange); outline-offset: 2px; }

/* ---------- Message log ---------- */
.alo-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.alo-log::-webkit-scrollbar { width: 6px; }
.alo-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  border-radius: 3px;
}

/* A bot message: avatar on the left, bubble on the right. */
.alo-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.alo-msg {
  max-width: 85%;
  margin: 0;
  padding: 11px 14px;
  font-size: .92rem;
  line-height: 1.6;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.alo-row .alo-msg { max-width: calc(100% - 56px); }

.alo-msg--alo {
  background: rgba(255, 255, 255, .07);
  color: var(--alo-text);
  border-bottom-left-radius: 4px;
}

.alo-msg--alo a {
  color: #7FD3F5;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.alo-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--alo-orange-soft), var(--alo-orange));
  color: var(--alo-ink);
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.alo-msg--error {
  align-self: stretch;
  max-width: 100%;
  background: rgba(239, 65, 54, .12);
  color: #FFC9C4;
  border: 1px solid rgba(239, 65, 54, .3);
  font-size: .86rem;
}

/* Typing dots */
.alo-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 14px 14px 14px 64px;
}

.alo-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--alo-muted);
  animation: alo-bounce 1.3s infinite ease-in-out;
}

.alo-typing span:nth-child(2) { animation-delay: .18s; }
.alo-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes alo-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Topic buttons (Step 2) ---------- */
.alo-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 56px;
}

.alo-topic {
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(41, 171, 226, .45);
  background: rgba(41, 171, 226, .08);
  color: var(--alo-text);
  font: inherit;
  font-size: .9rem;
  line-height: 1.45;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.alo-topic:hover {
  background: rgba(41, 171, 226, .18);
  border-color: rgba(41, 171, 226, .8);
  transform: translateX(2px);
}

.alo-topic:focus-visible { outline: 2px solid var(--alo-orange); outline-offset: 2px; }

/* ---------- The gate form (Step 5) ---------- */
.alo-gate {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px;
  margin-left: 56px;
  border-radius: 14px;
  border: 1px solid rgba(247, 147, 30, .4);
  background: linear-gradient(135deg, rgba(247, 147, 30, .12), rgba(41, 171, 226, .08));
}

.alo-gate input {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--alo-line);
  background: rgba(255, 255, 255, .06);
  color: var(--alo-text);
  font: inherit;
  font-size: .9rem;
}

.alo-gate input::placeholder { color: #8990AC; }

.alo-gate input:focus {
  outline: none;
  border-color: rgba(41, 171, 226, .6);
}

.alo-gate button {
  padding: 10px 12px;
  border-radius: 10px;
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}

.alo-gate button[type="submit"] {
  border: 0;
  background: linear-gradient(135deg, var(--alo-orange-soft), var(--alo-orange));
  color: var(--alo-ink);
  font-weight: 600;
}

.alo-gate__no {
  border: 1px solid var(--alo-line);
  background: transparent;
  color: var(--alo-muted);
}

.alo-gate__no:hover { color: #fff; border-color: rgba(255, 255, 255, .3); }

/* ---------- Composer ---------- */
.alo-foot {
  border-top: 1px solid var(--alo-line);
  padding: 12px 14px 12px;
  background: rgba(0, 0, 0, .15);
}

.alo-form { display: flex; gap: 8px; align-items: flex-end; }

.alo-input {
  flex: 1;
  min-height: 42px;
  max-height: 110px;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--alo-line);
  background: rgba(255, 255, 255, .05);
  color: var(--alo-text);
  font: inherit;
  font-size: .92rem;
  line-height: 1.45;
  resize: none;
}

.alo-input::placeholder { color: #8990AC; }

.alo-input:focus {
  outline: none;
  border-color: rgba(41, 171, 226, .6);
  background: rgba(255, 255, 255, .08);
}

.alo-send {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--alo-orange-soft), var(--alo-orange));
  color: var(--alo-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .18s ease, opacity .18s ease;
}

.alo-send:hover:not(:disabled) { transform: translateY(-1px); }
.alo-send:disabled { opacity: .45; cursor: not-allowed; }
.alo-send:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.alo-send svg { width: 18px; height: 18px; }

/* Persistent WhatsApp button (Part G) */
.alo-wa {
  display: block;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(37, 211, 102, .5);
  background: rgba(37, 211, 102, .08);
  color: #9CF0BE;
  font-size: .88rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease;
}

.alo-wa:hover {
  background: rgba(37, 211, 102, .16);
  border-color: var(--alo-wa);
  color: #fff;
}

.alo-wa:focus-visible { outline: 2px solid var(--alo-wa); outline-offset: 2px; }

.alo-disclaimer {
  margin: 8px 0 0;
  font-size: .7rem;
  line-height: 1.4;
  color: #7F86A2;
  text-align: center;
}

/* ---------- Mobile: full screen sheet ---------- */
@media (max-width: 560px) {
  .alo-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: 0;
  }

  .alo-row .alo-msg { max-width: calc(100% - 48px); }
  .alo-topics { padding-left: 48px; }
  .alo-gate { margin-left: 48px; }
  .alo-typing { padding-left: 56px; }
}

/* On the narrowest phones give the buttons the full width. */
@media (max-width: 400px) {
  .alo-topics { padding-left: 0; }
  .alo-gate { margin-left: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .alo-launcher,
  .alo-panel,
  .alo-send,
  .alo-topic {
    transition: none;
  }
  .alo-launcher:hover { transform: none; }
  .alo-typing span { animation: none; opacity: .6; }
}
