/* =============================================================
   Sugabi AI — full-page assistant (/assistant/).
   Loaded only on that page, after site.css.
   ============================================================= */
html, body { height: 100%; }
body.sga-body {
  display: flex; flex-direction: column;
  height: 100dvh; min-height: 100dvh;
  overflow: hidden;
}
body.sga-body .site-header { flex: 0 0 auto; }
/* This page IS the assistant — no floating launcher, no to-top. */
body.sga-body .sg-chat-launcher, body.sga-body #to-top, body.sga-body .award-float { display: none !important; }

.sga-main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

/* ---------- Assistant sub-header ---------- */
.sga-bar {
  flex: 0 0 auto;
  padding: .65rem 1.25rem; border-bottom: 1px solid #eee9fb; background: #fff;
}
.sga-bar-inner {
  display: flex; align-items: center; gap: .75rem;
  max-width: 1100px; margin: 0 auto;
}
.sga-glyph {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; color: #fff; font-size: 1rem;
  background: linear-gradient(135deg, #6717E9, #9B55F5);
}
.sga-bar-name { font-weight: 700; color: var(--sg-ink); font-size: .95rem; line-height: 1.2; }
.sga-bar-sub { color: var(--sg-muted); font-size: .75rem; }
.sga-new {
  margin-left: auto; display: inline-flex; align-items: center; gap: .4rem;
  background: var(--sg-bg-soft); border: 1.5px solid #e3dcf9; color: var(--sg-purple);
  font-family: 'Poppins', sans-serif; font-weight: 600; font-size: .85rem;
  padding: .45rem 1.1rem; border-radius: 50rem; cursor: pointer;
  transition: background .2s ease, border-color .2s ease;
}
.sga-new:hover { background: #efeafd; border-color: #cdbcf5; }
.sga-new:focus-visible { outline: 3px solid rgba(94,23,235,.4); outline-offset: 2px; }

/* ---------- Log ---------- */
.sga-log { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; background: #fff; }
.sga-thread {
  max-width: 760px; margin: 0 auto; padding: 1.5rem 1.25rem 1rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}

/* ---------- Welcome state ---------- */
.sga-welcome {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.25rem; text-align: center; padding: 2rem 1.25rem; min-height: 60%;
}
.sga-welcome .sga-glyph {
  width: 60px; height: 60px; font-size: 1.7rem;
  box-shadow: 0 14px 30px rgba(94,23,235,.3);
}
.sga-welcome h1 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); margin: 0; }
.sga-welcome .sga-lede { color: var(--sg-muted); font-size: .95rem; line-height: 1.7; max-width: 34rem; margin: 0; }
.sga-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: .85rem; margin-top: .25rem; }
.sga-card {
  width: 220px; text-align: left; background: var(--sg-bg-soft);
  border: 1.5px solid #e3dcf9; border-radius: 1rem; padding: 1rem 1.15rem;
  cursor: pointer; font-family: 'Poppins', sans-serif;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.sga-card:hover { border-color: #9B55F5; background: #f1ecfd; transform: translateY(-2px); }
.sga-card:focus-visible { outline: 3px solid rgba(94,23,235,.4); outline-offset: 2px; }
.sga-card b {
  display: block; color: var(--sg-purple); font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: .35rem;
}
.sga-card span { color: var(--sg-ink); font-size: .88rem; line-height: 1.5; }

/* ---------- Messages ---------- */
.sga-msg--user {
  align-self: flex-end; max-width: 82%;
  background: var(--sg-purple); color: #fff;
  font-size: .95rem; line-height: 1.65;
  padding: .8rem 1.25rem; border-radius: 1.25rem 1.25rem .4rem 1.25rem;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.sga-msg--bot { display: flex; gap: .75rem; max-width: 92%; }
.sga-msg--bot .sga-glyph { width: 30px; height: 30px; font-size: .85rem; margin-top: .15rem; }
.sga-msg-body { color: var(--sg-ink); font-size: .95rem; line-height: 1.75; min-width: 0; overflow-wrap: break-word; }
.sga-msg-body p { margin: 0 0 .6rem; }
.sga-msg-body p:last-child { margin: 0; }
.sga-msg-body a { color: var(--sg-purple); font-weight: 600; }
.sga-msg--error .sga-msg-body { color: #8a3a12; }

/* ---------- Typing indicator ---------- */
.sga-typing { display: flex; gap: .75rem; align-items: center; }
.sga-typing .sga-dots { display: flex; gap: 5px; padding: .4rem 0; }
.sga-typing .sga-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: #9B55F5;
  animation: sga-blink 1.2s infinite;
}
.sga-typing .sga-dots span:nth-child(2) { animation-delay: .2s; }
.sga-typing .sga-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes sga-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- Booking hand-off ---------- */
.sga-handoff {
  align-self: flex-start; margin-left: calc(30px + .75rem);
  display: inline-flex; align-items: center; gap: .5rem;
  background: #fff; border: 1.5px solid var(--sg-pink); color: #d63868;
  font-weight: 600; font-size: .85rem; text-decoration: none;
  padding: .55rem 1.2rem; border-radius: 50rem;
  transition: background .2s ease, color .2s ease;
}
.sga-handoff:hover { background: var(--sg-pink); color: #fff; }

/* ---------- Composer ---------- */
.sga-composer { flex: 0 0 auto; background: #fff; padding: .5rem 0 .6rem; }
.sga-composer-inner { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; }
.sga-form {
  display: flex; align-items: flex-end; gap: .6rem;
  background: var(--sg-bg-soft); border: 1.5px solid #e3dcf9;
  border-radius: 1.6rem; padding: .45rem .45rem .45rem 1.3rem;
  transition: border-color .2s ease;
}
.sga-form:focus-within { border-color: #9B55F5; }
.sga-input {
  flex: 1; border: 0; background: transparent; resize: none;
  font-family: 'Poppins', sans-serif; font-size: .95rem; line-height: 1.5;
  color: var(--sg-ink); padding: .55rem 0; max-height: 112px; min-width: 0;
}
.sga-input:focus { outline: none; }
.sga-input::placeholder { color: #8b97ab; }
.sga-send {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--sg-purple); color: #fff; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.sga-send:hover:not(:disabled) { background: var(--sg-purple-dark); transform: translateY(-1px); }
.sga-send:disabled { opacity: .45; cursor: default; }
.sga-send:focus-visible { outline: 3px solid rgba(94,23,235,.4); outline-offset: 2px; }
.sga-note {
  text-align: center; color: #8b97ab; font-size: .72rem; line-height: 1.5;
  margin: .55rem 0 0;
}

/* Poppins carries no Sinhala glyphs — form controls follow site.css's
   per-language typography instead of the Latin pin above. */
html[lang="si"] .sga-input,
html[lang="si"] .sga-new,
html[lang="si"] .sga-card { font-family: 'Abhaya Libre', serif; }

/* ---------- Empty state (PC): composer sits with the greeting, mid-page;
   it drops to the bottom once the chat starts ---------- */
@media (min-width: 576px) {
  /* The bar stays pinned under the navbar; only the greeting + composer
     group floats centered in the remaining space. */
  body.sga-empty .sga-log { flex: 0 0 auto; overflow: visible; margin-top: auto; }
  body.sga-empty .sga-composer { margin-bottom: auto; }
  body.sga-empty .sga-welcome { min-height: 0; padding-bottom: .75rem; }
  body.sga-empty .sga-thread:empty { padding: 0; }
}

/* ---------- Phones ---------- */
@media (max-width: 575.98px) {
  /* Chrome auto-hide: once the visitor scrolls into the conversation,
     the navbar and the disclaimer give their space to the thread.
     Both return when the log is scrolled back to the top. */
  body.sga-hide-chrome .site-header { display: none; }
  body.sga-hide-chrome .sga-note { display: none; }

  .sga-bar { padding: .55rem .9rem; }
  .sga-bar-sub { display: none; }
  .sga-thread { padding: 1rem .9rem .75rem; }
  .sga-composer-inner { padding: 0 .9rem; }
  .sga-cards { flex-direction: column; align-items: stretch; }
  .sga-card { width: 100%; }
  .sga-welcome { padding: 1.25rem .9rem; gap: 1rem; }
  .sga-msg--user { max-width: 88%; }
}
