/*
 * Tutorial chat bubble — ported from food-decision-agents NarratorPanel
 * (src/components/student-space/world/WorldInteractions.tsx, MIT, Copyright
 * (c) 2026 Reza Ilmi). Literal cream/pill/coral values lifted from the
 * Tailwind classes there. All classes prefixed agnes-tour-* so nothing here
 * collides with console or portal styles.
 *
 * z-index contract: Driver.js overlay/stage/popover sit at 1000000000 (see
 * vendor/driverjs/driver.css). The bubble must always render above that.
 */

:root {
  --agnes-tour-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

.agnes-tour-bubble {
  position: fixed;
  left: max(18px, 8vw);
  right: max(18px, 8vw);
  bottom: 24px;
  z-index: 2147483000;
  margin: 0 auto;
  max-width: 42rem;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: rgba(255, 247, 232, 0.96);
  padding: 32px 24px 20px;
  font-family: 'Poppins', system-ui, sans-serif;
  color: #2b2620;
  box-shadow: 0 22px 60px rgba(35, 25, 18, 0.26);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 220ms var(--agnes-tour-ease-out), transform 220ms var(--agnes-tour-ease-out);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.agnes-tour-bubble.agnes-tour-bubble-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Driver.js locks pointer-events to none on everything except its own
   popover and the highlighted target element (see .driver-active rules in
   vendor/driverjs/driver.css). Our narration bubble is a separate DOM node,
   not Driver's popover, so its Next/Skip/x controls go inert on any step
   that highlights an element (e.g. the orb step). Explicitly exempt it. */
.driver-active .agnes-tour-bubble,
.driver-active .agnes-tour-bubble * {
  pointer-events: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  .agnes-tour-bubble {
    transition: none;
  }
}

.agnes-tour-bubble-pill {
  position: absolute;
  top: -12px;
  left: 24px;
  border-radius: 999px;
  background: #ffd15f;
  color: #402a10;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(64, 42, 16, 0.18);
}

.agnes-tour-bubble-close {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(76, 64, 52, 0.72);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms var(--agnes-tour-ease-out), background-color 140ms var(--agnes-tour-ease-out), color 140ms var(--agnes-tour-ease-out);
}

.agnes-tour-bubble-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #2b2620;
}

.agnes-tour-bubble-close:active {
  transform: scale(0.95);
}

.agnes-tour-bubble-text {
  margin: 0;
  min-height: 3.2em;
  font-size: 17px;
  line-height: 1.65;
  font-weight: 600;
}

.agnes-tour-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.agnes-tour-bubble-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agnes-tour-bubble-skip {
  border: none;
  background: transparent;
  color: rgba(76, 64, 52, 0.72);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
}

.agnes-tour-bubble-skip:hover {
  color: #2b2620;
  text-decoration: underline;
}

.agnes-tour-bubble-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  background: #ff8a5c;
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(255, 120, 66, 0.24);
  transition: transform 140ms var(--agnes-tour-ease-out), background-color 140ms var(--agnes-tour-ease-out);
}

.agnes-tour-bubble-cta:hover {
  background: #ff7842;
  transform: translateY(-1px);
}

.agnes-tour-bubble-cta:active {
  transform: translateY(0);
}

@media (max-width: 640px) {
  .agnes-tour-bubble {
    left: 16px;
    right: 16px;
    bottom: 16px;
    padding: 28px 20px 18px;
  }
}

/* Belt-and-braces: every tour step omits `popover` in its Driver config, so
   Driver renders highlight-only. This backs that up in case a future step
   accidentally sets one. */
.agnes-tour-driver-hidden-popover {
  display: none !important;
}
