﻿/* ========================================
   AI SEARCH — Core Bot Styles
   ======================================== */

.AIBot {
  z-index: 999;
}

  .AIBot.fixed {
    position: fixed;
    bottom: 48px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1025;
  }

.AIBot form {
  display: flex;
  gap: 8px;
}

.AIBot .AIQuestion {
  flex: 1;
  padding: 0;
  padding-right: 40px;
}

.AIBot.styled-new {
  font-size: 16px;
  max-width: 1008px;
  padding-left: 16px;
  padding-right: 16px;
}

  .AIBot.styled-new .AIQuestion {
    background-color: transparent;
    font-size: 19.2px;
    line-height: 1;
    color: #004853;
    border: 0;
    border-radius: 0;
  }

    .AIBot.styled-new .AIQuestion:focus {
      outline: none;
      box-shadow: none;
    }

    .AIBot.styled-new .AIQuestion::placeholder {
      color: #004853;
    }

    .AIBot.styled-new .AIQuestion.blink-cursor {
      box-shadow: inset 2px 0 0 0 #004853;
      animation: blinkCursor 1s step-end infinite;
    }

      .AIBot.styled-new .AIQuestion.blink-cursor:focus {
        box-shadow: none;
        animation: none;
      }

@keyframes blinkCursor {
  0%, 100% {
    box-shadow: inset 2px 0 0 0 #fff;
  }

  50% {
    box-shadow: inset 2px 0 0 0 transparent;
  }
}

.AIAction {
  /* Flexbox centering layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Dimensions must be perfectly equal */
  width: 50px;
  height: 50px;
  border-radius: 50%;
  /* Icon size and coloring */
  font-size: 18px;
  color: #fff;
  background-color: #004853;
  border: 0 !important;
  outline: none;
  position: relative;
  cursor: pointer;
  transition: all .4s;
}

.AIAction:hover {
  opacity: 0.75;
}


/* ========================================
   AI Search Bar
   ======================================== */

.ai-search {
  position: relative;
  overflow: hidden;
  padding: 15px 20px;
  border-radius: 20px;
  box-shadow: 0 4px 27.5px rgba(0, 0, 0, 0.25);
}

@media (max-width: 575px) {
  .ai-search {
    padding: 12px;
  }
}

.ai-search .bg-wrap {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #aedf35;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.35s;
}

.ai-search:hover .bg-wrap {
  background-color: rgba(174, 223, 53, 1);
}

/* ========================================
   Gradient Circles
   ======================================== */

.gradient-circle {
  position: absolute;
  overflow: hidden;
  width: 30em;
  height: 30em;
  border-radius: 50%;
  transition: all 0.35s;
}

  .gradient-circle.left {
    top: 50%;
    left: 0;
    transform: translate(-20%, -43%);
    background: radial-gradient(circle at center, #c6ff38, rgba(198, 255, 56, 0) 70%);
    opacity: 50%;
  }

  .gradient-circle.right {
    top: 50%;
    right: 0;
    transform: translate(-10%, -57%);
    background: radial-gradient(circle at center, #9ac72e, rgba(154, 199, 46, 0) 70%);
  }

  .gradient-circle.on-hover {
    width: 45em;
    height: 45em;
    top: 50%;
    right: 0;
    transform: translate(-10%, -57%);
    background: radial-gradient(circle at center, #d0ff5c, rgba(208, 255, 92, 0) 70%);
    opacity: 0;
  }

.ai-search:hover .gradient-circle.on-hover {
  opacity: 1;
}

/* g-2: 8px gutters by default */
.ai-search .row {
  --gutter-x: 8px;
  --gutter-y: 8px;
  margin-left: calc(var(--gutter-x) * -0.5);
  margin-right: calc(var(--gutter-x) * -0.5);
  margin-top: calc(var(--gutter-y) * -1);
}

  .ai-search .row > * {
    padding-left: calc(var(--gutter-x) * 0.5);
    padding-right: calc(var(--gutter-x) * 0.5);
    margin-top: var(--gutter-y);
  }

/* g-sm-4: 1.5rem gutters at 576px+ */
@media (min-width: 576px) {
  .ai-search .row {
    --gutter-x: 24px;
    --gutter-y: 24px;
  }
}

.ai-search:hover {
  box-shadow: 0 4px 49.4px #aedf35;
}

/* ---------------------------------------------------------------------------
   VRS lockup — logo with two swapping sparkles

   CSS reproduction of the Jitter/Lottie animation. No JS, no lottie-web.
   Every timing and transform value below came from the original JSON export:

     duration     144 frames @ 60fps ............... 2.4s
     easing       out (0.5, 0) / in (0, 1) ......... cubic-bezier(.5, 0, 0, 1)
     small scale  65.89% ........................... 0.6589
     slot offset  -43px x, +113px y at S=128.11px .. -0.336, 0.882 (x sparkle W)
     rotation     lead -360deg, trail +360deg (opposite directions)

   The two sparkles trade places every 1.2s. There is always a large one in
   the top slot and a small one in the bottom slot.
   --------------------------------------------------------------------------- */

.vrs-lockup {
  /* Knobs */
  --vrs-logo-height: 2rem;
  --vrs-sparkle-ratio: 0.4; /* sparkle width as a fraction of logo height */
  /* 0 on purpose: the mark's viewBox already carries empty space on the
     right where the chevron tapers, so any flex gap double-counts it. */
  --vrs-gap-ratio: 0;
  /* Derived — no need to touch */
  --vrs-sparkle: calc(var(--vrs-logo-height) * var(--vrs-sparkle-ratio));
  --vrs-dx: calc(var(--vrs-sparkle) * -0.336);
  --vrs-dy: calc(var(--vrs-sparkle) * 0.882);
  --vrs-scale-sm: 0.6589;
  --vrs-duration: 2.4s;
  --vrs-ease: cubic-bezier(0.5, 0, 0, 1);
  display: flex;
  align-items: center;
  gap: calc(var(--vrs-logo-height) * var(--vrs-gap-ratio));
  color: #063560;
}

.vrs-lockup__mark {
  display: block;
  flex: none;
  width: auto;
  height: var(--vrs-logo-height);
  fill: currentColor;
}

/* Sized to the full area both sparkles sweep through, so flexbox reserves the
   right space and nothing drifts over the logo mid-animation. */
.vrs-lockup__sparkles {
  position: relative;
  flex: none;
  width: calc(var(--vrs-sparkle) * 1.166);
  height: calc(var(--vrs-sparkle) * 1.681);
}

/* top/right 0 lands a sparkle exactly in the top slot; the bottom slot is
   that position plus the --vrs-dx / --vrs-dy offset. */
.vrs-lockup__sparkle {
  position: absolute;
  top: 0;
  right: 0;
  display: block;
  width: var(--vrs-sparkle);
  height: auto;
  fill: currentColor;
  transform-origin: 50% 50%;
  animation-duration: var(--vrs-duration);
  animation-timing-function: var(--vrs-ease);
  animation-iteration-count: infinite;
}

.vrs-lockup__sparkle--lead {
  animation-name: vrs-sparkle-descend;
}

.vrs-lockup__sparkle--trail {
  animation-name: vrs-sparkle-ascend;
}

/* Starts large in the top slot, shrinks on the way down. Counter-clockwise. */
@keyframes vrs-sparkle-descend {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }

  50% {
    transform: translate(var(--vrs-dx), var(--vrs-dy)) rotate(-180deg) scale(var(--vrs-scale-sm));
  }

  100% {
    transform: translate(0, 0) rotate(-360deg) scale(1);
  }
}

/* Starts small in the bottom slot, grows on the way up. Clockwise. */
@keyframes vrs-sparkle-ascend {
  0% {
    transform: translate(var(--vrs-dx), var(--vrs-dy)) rotate(0deg) scale(var(--vrs-scale-sm));
  }

  50% {
    transform: translate(0, 0) rotate(180deg) scale(1);
  }

  100% {
    transform: translate(var(--vrs-dx), var(--vrs-dy)) rotate(360deg) scale(var(--vrs-scale-sm));
  }
}

/* Holds the frame-0 pose instead of looping. */
@media (prefers-reduced-motion: reduce) {
  .vrs-lockup__sparkle {
    animation: none;
  }

  .vrs-lockup__sparkle--trail {
    transform: translate(var(--vrs-dx), var(--vrs-dy)) scale(var(--vrs-scale-sm));
  }
}


/* ========================================
   Status Dot
   ======================================== */

.ai-status-dot {
  display: inline-block;
  position: relative;
  top: -2px;
  margin-right: 3px;
  width: 6px;
  height: 6px;
  background: #aedf35;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.ai-results-next {
  font-weight: 600;
  font-style: italic;
}

.ai-results-status {
  overflow: hidden;
}

.ai-results-next {
  display: inline-block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

  .ai-results-next.roll-out {
    transform: translateY(-100%);
    opacity: 0;
  }

  .ai-results-next.roll-in {
    transform: translateY(100%);
    opacity: 0;
    transition: none;
  }


/* ========================================
   Spinner (base show/hide)
   ======================================== */

.ai-spinner {
  display: none;
  text-align: center;
  padding: 40px 0;
}

  .ai-spinner.active {
    display: block;
  }

.vrs-lockup--spinner {
  --vrs-logo-height: 5rem;
  justify-content: center;
  color: #fff;
}

  .vrs-lockup--spinner .vrs-lockup__sparkle {
    fill: #aedf35;
  }


/* ========================================
   AI Results Panel
   ======================================== */

.ai-results {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  margin-bottom: 0;
  background: #004853;
  color: white;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 4px 49.4px #aedf35;
  overflow: hidden;
  z-index: 1;
  max-height: calc(100vh - 208px);
}

@media (min-width: 992px) {
  .ai-results {
    max-height: calc(100vh - 255px);
  }
}

.ai-results.active {
  display: flex;
  flex-direction: column;
  animation: aiSlideUp 0.35s ease forwards;
}

@keyframes aiSlideUp {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.ai-results.closing {
  display: flex;
  flex-direction: column;
  animation: aiSlideDown 0.25s ease forwards;
}

@keyframes aiSlideDown {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.AIBot.styled-new:has(.ai-results.active) .ai-search,
.AIBot.styled-new:has(.ai-results.closing) .ai-search {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: 0 4px 49.4px #aedf35;
}

/* Results Header */
.ai-results-header {
  position: relative;
  padding: 16px;
}

  .ai-results-header .ai-results-close {
    font-size: 24px;
    line-height: 1;
    background-color: transparent;
    border: 0;
    padding: 0;
    color: #aedf35;
    cursor: pointer;
  }

/* Results Body */
.ai-results-body {
  flex-grow: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  padding-top: 0;
}

  .ai-results-body h1,
  .ai-results-body h2,
  .ai-results-body h3,
  .ai-results-body h4,
  .ai-results-body h5,
  .ai-results-body h6 {
    color: #aedf35;
    margin: 1em 0 .75em;
  }

  .ai-results-body ul {
    list-style: disc;
    padding-left: 16px;
  }

  .ai-results-body a {
    color: white;
    text-decoration: underline;
  }

  .ai-results-body hr {
    border: 1px solid #aedf35;
    opacity: 1;
    margin: 24px 0;
  }

/* Thread exchanges */
.ai-exchange + .ai-exchange {
  margin-top: 25px;
  padding-top: 25px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.ai-exchange {
  animation: aiAnswerIn 0.25s ease both;
}

@keyframes aiAnswerIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-exchange {
    animation: none;
  }
}

.ai-question {
  margin: 0 0 16px;
  font-size: 1.125em;
  font-weight: 600;
  color: #aedf35;
}

.ai-answer-error {
  color: #ffd7d7;
}

@media (min-width: 768px) {
  .ai-results-body {
    padding: 32px;
    padding-top: 16px;
  }
}

@media (min-width: 1200px) {
  .ai-results-body {
    padding: 64px;
    padding-top: 16px;
  }
}

/* Results Content — Grid & Recommendations */
.ai-results-content .ai-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  list-style: none;
  padding: 0;
}

.ai-results-content .ai-grid li {
  padding: 0;
}

@media (max-width: 500px) {
  .ai-results-content .ai-grid {
    grid-template-columns: 1fr;
  }
}

.ai-results-content .ai-grid a.aiRecommendation {
  position: relative;
  overflow: hidden;
  padding: 14px 16px;
  border-radius: 10px;
  color: #f1f5f9;
  text-decoration: none;
  display: flex;
  gap: 10px;
  background-color: #003b43;
  transition: all 0.2s;
  z-index: 2;
}

  .ai-results-content .ai-grid a.aiRecommendation:hover {
    background-color: #003037;
    text-decoration: none;
  }

/* Results Scrollbar */
.ai-results-body::-webkit-scrollbar {
  width: 12px;
}

.ai-results-body::-webkit-scrollbar-track {
  background: #004853;
  border-radius: 6px;
}

.ai-results-body::-webkit-scrollbar-thumb {
  background: #fff;
  border-radius: 6px;
  border: 2px solid #004853;
}

  .ai-results-body::-webkit-scrollbar-thumb:hover {
    background: #ccc;
  }

.ai-results-body::-webkit-scrollbar-button {
  background: #004853;
  height: 12px;
}

  .ai-results-body::-webkit-scrollbar-button:vertical:decrement {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 8L6 4l4 4' stroke='%23ffffff' stroke-width='2' fill='none'/%3E%3C/svg%3E") center no-repeat;
    background-color: #004853;
  }

  .ai-results-body::-webkit-scrollbar-button:vertical:increment {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4L6 8l4-4' stroke='%23ffffff' stroke-width='2' fill='none'/%3E%3C/svg%3E") center no-repeat;
    background-color: #004853;
  }

/* Firefox */
.ai-results-body {
  scrollbar-width: thin;
  scrollbar-color: #fff #004853;
}


/* ============================================================
   AIBot: show/hide toggle
   ============================================================ */

/* ===== Animated transitions ===== */
.AIBot.styled-new.fixed {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.AIBot.styled-new .ai-search {
  transition: border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s ease, box-shadow 0.35s ease;
  overflow: hidden;
  position: relative;
}

/* Default: hidden on every page except the homepage.
   Depends on body.home being present ONLY on the homepage — if that class
   spreads to other templates, the bar will render expanded there too.
   .ai-open / .ai-closed are user overrides applied by JS. */
body:not(.home):not(.ai-open) .AIBot.styled-new.fixed,
body.ai-closed .AIBot.styled-new.fixed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ===== Reopen tab ===== */
.ai-tab {
  position: fixed;
  bottom: 48px;
  left: 0;
  z-index: 1025;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px 12px 14px;
  border: 0;
  border-radius: 0 20px 20px 0;
  background-color: #aedf35;
  color: #004853;
  line-height: 1;
  box-shadow: 0 4px 27.5px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease, box-shadow 0.35s ease;
}

  .ai-tab:hover {
    box-shadow: 0 4px 49.4px #aedf35;
  }

  .ai-tab:focus-visible {
    outline: 2px solid #004853;
    outline-offset: 2px;
  }

  .ai-tab .vrs-lockup {
    color: inherit;
    --vrs-logo-height: 1.5rem;
  }

body:not(.home):not(.ai-open) .ai-tab,
body.ai-closed .ai-tab {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

@media (max-width: 575px) {
  .ai-tab {
    padding: 12px 14px;
  }

    .ai-tab .ai-tab-label {
      display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
  .AIBot.styled-new.fixed,
  .ai-tab {
    transition: none;
  }
}

/* ===== Close button (inline, right of submit) ===== */
.ai-close-col {
  padding-left: 0 !important;
}

.ai-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #004853;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: color .15s ease;
}

  .ai-close-btn:hover {
    color: #004853;
  }

  .ai-close-btn:focus-visible {
    outline: 2px solid #004853;
    outline-offset: 2px;
  }

@media (max-width: 575px) {
  .ai-close-btn {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
}


/* ========================================
   Speech-to-Text
   ======================================== */

.speech-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  flex: 1;
}

  .speech-input-wrapper input {
    width: 100%;
    padding-right: 40px;
    box-sizing: border-box;
  }

.speech-mic-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  color: #004853;
  font-size: 24px;
  transition: all 0.2s ease;
}

  .speech-mic-btn:hover {
    opacity: 0.75;
  }

  .speech-mic-btn.listening {
    color: #dc3545;
    animation: pulse 1s infinite;
  }

    .speech-mic-btn.listening i {
      animation: micPulse 0.5s infinite alternate;
    }

@keyframes micPulse {
  0% {
    transform: scale(1);
  }

  100% {
    transform: scale(1.2);
  }
}

.speech-mic-btn.listening::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border: 2px solid #dc3545;
  border-radius: 50%;
  animation: ring 1s infinite;
  pointer-events: none;
  margin-top: -2px;
}

@keyframes ring {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}


/* ========================================
   Utility
   ======================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
