/* Ask panel — slim bottom bar (desktop) / compact pill (phone) */
.ask-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 240;
  pointer-events: none;
  font-family: inherit;
}

.ask-root * {
  box-sizing: border-box;
}

.ask-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  border: 0;
  border-top: 1px solid rgba(var(--purple-rgb), 0.22);
  background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 -10px 30px rgba(18, 8, 28, 0.1);
}

.ask-bar:hover {
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
}

.ask-bar-label {
  text-align: center;
}

.ask-panel {
  pointer-events: auto;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(420px, 78vh);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid rgba(var(--purple-rgb), 0.28);
  box-shadow: 0 -18px 50px rgba(18, 8, 28, 0.18);
  transform: translateY(110%);
  transition: transform 0.28s ease;
  visibility: hidden;
}

.ask-root.is-open .ask-panel {
  transform: translateY(0);
  visibility: visible;
}

.ask-root.is-open .ask-bar {
  visibility: hidden;
}

.ask-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.ask-panel-head h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  color: var(--ink);
}

.ask-panel-head p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.45;
  max-width: 36rem;
}

.ask-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
}

.ask-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.8rem 1.1rem 0.35rem;
}

.ask-chip {
  border: 1px solid rgba(var(--purple-rgb), 0.28);
  background: var(--purple-tint);
  color: var(--purple-deep);
  border-radius: 999px;
  padding: 0.38rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.ask-chip:hover {
  border-color: rgba(var(--purple-rgb), 0.45);
}

.ask-messages {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: linear-gradient(180deg, #fcfbfe 0%, #ffffff 45%);
}

.ask-bubble {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.85rem;
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ask-bubble.bot {
  align-self: flex-start;
  background: #f4f0f8;
  color: var(--ink);
}

.ask-bubble.user {
  align-self: flex-end;
  background: var(--grad-brand-btn, linear-gradient(135deg, #1e0a36 0%, #5b21b6 45%, #9d3df2 100%));
  color: #fff;
}

.ask-bubble.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.2rem;
}

.ask-compose {
  border-top: 1px solid var(--line);
  padding: 0.75rem 1.1rem 0.9rem;
  display: grid;
  gap: 0.55rem;
  background: #fff;
}

.ask-compose textarea {
  width: 100%;
  min-height: 2.7rem;
  max-height: 5.5rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  resize: vertical;
  color: var(--ink);
}

.ask-compose textarea:focus {
  outline: 2px solid rgba(var(--purple-rgb), 0.28);
  border-color: rgba(var(--purple-rgb), 0.4);
}

.ask-compose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ask-compose-row a {
  font-size: 0.8rem;
  color: var(--purple);
  text-decoration: none;
}

.ask-compose-row a:hover {
  text-decoration: underline;
}

.ask-send {
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  background: var(--grad-brand-btn, linear-gradient(135deg, #1e0a36 0%, #5b21b6 45%, #9d3df2 100%));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.ask-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Phone: compact floating pill when closed */
@media (max-width: 720px) {
  .ask-bar {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: auto;
    position: absolute;
    min-height: 2.75rem;
    border-radius: 999px;
    border: 1px solid rgba(var(--purple-rgb), 0.25);
    box-shadow: 0 10px 30px rgba(18, 8, 28, 0.16);
  }

  .ask-panel {
    height: min(82vh, 560px);
    border-radius: 1rem 1rem 0 0;
  }

  .ask-chip {
    font-size: 0.74rem;
  }
}

/* Leave room so page content isn't hidden under the closed bar on desktop */
@media (min-width: 721px) {
  body {
    padding-bottom: 3.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-panel {
    transition: none;
  }
}
