/* Site guide drawer — scoped to the host and highlight target only */

.sg-host {
  position: relative;
  z-index: 9600;
  --sg-clear-bottom: 0px;
}

/* Membership gate is a full-viewport overlay at --z-modal. The launcher has to stay above it. */
body:has(#membershipGateModal:not([hidden])) .sg-host {
  z-index: calc(var(--z-modal, 10070) + 2);
}

/* Post-reg scene (#post-reg-logo-seq, z 2147483005) covers the page while flipped/interactive. Keep the guide tab above it but below checkout (2147483010). */
html:has(#post-reg-logo-seq.prls--flipped) .sg-host,
html:has(#post-reg-logo-seq.prls--interactive) .sg-host {
  z-index: 2147483006;
}

.sg-launcher {
  position: fixed;
  bottom: calc(1rem + var(--sg-clear-bottom, 0px));
  right: 1rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(7, 11, 30, 0.15);
}

.sg-launcher[data-sg-attention] {
  position: fixed;
}

.sg-launcher[data-sg-attention]::after {
  content: "";
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-error);
  box-shadow: 0 0 0 2px var(--color-paper);
}

.sg-host:not([data-sg-lang="fr"]) .sg-i18n[lang="fr"],
.sg-host[data-sg-lang="fr"] .sg-i18n[lang="en"] {
  display: none;
}

.sg-drawer {
  position: fixed;
  bottom: calc(5rem + var(--sg-clear-bottom, 0px));
  right: 1rem;
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 7rem));
  display: flex;
  flex-direction: column;
  border-radius: 0.75rem;
  background: var(--color-bg-surface, var(--color-paper));
  box-shadow: 0 4px 24px rgba(7, 11, 30, 0.18);
  overflow: hidden;
}

.sg-drawer--open {
  display: flex;
}

/* Author display beats the UA [hidden] rule, so Close left the panel up. */
.sg-drawer[hidden] {
  display: none !important;
}

.sg-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}

.sg-drawer__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.sg-drawer__close {
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: var(--button-radius);
  background: transparent;
  cursor: pointer;
}

.sg-drawer__list {
  flex: 1 1 auto;
  min-height: 6rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.5rem 1rem;
  list-style: none;
}

.sg-msg {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  line-height: 1.4;
}

.sg-msg--user {
  background: color-mix(in srgb, var(--color-ink) 8%, var(--color-bg-base));
}

.sg-msg--guide {
  background: var(--color-bg-base);
}

.sg-msg--error {
  border-left: 3px solid var(--color-error);
}

.sg-msg__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm, 0.5rem);
  margin-top: var(--space-sm, 0.75rem);
}

.sg-msg__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--button-height-sm, 2.25rem);
  margin: 0;
  padding: 0 var(--space-md, 1rem);
  border-radius: var(--button-radius, 999px);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  font-size: var(--text-sm, 0.875rem);
  font-weight: var(--weight-medium, 600);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.sg-msg__link:hover {
  background: var(--color-primary-dark);
  color: var(--color-text-on-primary);
  text-decoration: underline;
  text-decoration-color: var(--color-secondary);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.sg-drawer__starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
}

.sg-starter {
  min-height: 44px;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}

.sg-showme {
  margin-top: 0.5rem;
  min-height: 44px;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}

.sg-composer {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid color-mix(in srgb, var(--color-ink) 8%, transparent);
}

.sg-composer [data-sg="send"] {
  border-radius: var(--button-radius);
}

.sg-composer__input {
  font-size: 16px;
  width: 100%;
  min-height: 7.5rem;
  resize: vertical;
  padding: 0.75rem;
  border-radius: 0.375rem;
}

.sg-drawer__error {
  margin: 0;
  padding: 0.5rem 1rem;
  color: var(--color-error);
}

.sg-drawer__showme-status {
  margin: 0;
  padding: 0.25rem 1rem;
  font-size: 0.875rem;
}

@keyframes sg-highlight-pulse {
  0%,
  100% {
    outline-color: color-mix(in srgb, var(--color-success) 90%, transparent);
  }
  50% {
    outline-color: color-mix(in srgb, var(--color-success) 35%, transparent);
  }
}

.sg-highlight {
  outline: 2px solid color-mix(in srgb, var(--color-success) 90%, transparent);
  outline-offset: 2px;
  animation: sg-highlight-pulse 1s ease-in-out 3;
}

@media (prefers-reduced-motion: reduce) {
  .sg-highlight {
    animation: none;
  }
}
