/* =========================================================================
   CENTURY AUTO TRAVELS — AI ASSISTANT
   Loaded on every page. Entirely self-contained (its own fixed-position
   button + window), so it can never affect the layout of anything else
   on the page. Reuses the site's existing colour tokens (--gold, --bg-
   elevated, --border-strong, etc. from style.css) so it looks like a
   native part of the site rather than a bolted-on widget.
   ========================================================================= */

/* On the homepage only, the hero's own "Scroll" cue sits bottom-right of
   the first screen (site-wide .hero-footer-row, untouched here) — right
   where a plain bottom-right button would land. Rather than move that
   existing element, the button/window lift by this one extra amount
   only on body.page-home, clearing it while staying put on every other
   page. Every offset below is written off this single variable so the
   lift never has to be duplicated per breakpoint. */
:root{ --cat-lift: 0px; }
body.page-home{ --cat-lift: 42px; }

.cat-chat-toggle{
  position: fixed;
  right: 22px;
  bottom: calc(22px + var(--cat-lift));
  z-index: 800;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,9,6,.9);
  border: 1px solid var(--gold);
  color: var(--gold);
  cursor: pointer;
  box-shadow: 0 16px 40px -14px rgba(0,0,0,.7), 0 0 0 1px rgba(230,199,102,.15);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s;
}
.cat-chat-toggle:hover{
  transform: translateY(-3px);
  box-shadow: 0 20px 46px -14px rgba(201,169,98,.5), 0 0 0 1px rgba(230,199,102,.3);
}
/* Nudged up whenever js/chatbot.js detects the button is currently
   overlapping a page control that must stay fully clickable (e.g. Book
   Now's full-width Confirm Booking button) — see initCollisionAvoidance. */
body.cat-chat-avoid .cat-chat-toggle{ transform: translateY(-74px); }
body.cat-chat-avoid .cat-chat-toggle:hover{ transform: translateY(-77px); }
.cat-chat-toggle-icon,
.cat-chat-toggle-close{
  width: 26px;
  height: 26px;
  position: absolute;
  transition: opacity .25s ease, transform .25s ease;
}
.cat-chat-toggle-close{ opacity: 0; transform: scale(.6) rotate(-45deg); }
.cat-chat-toggle.is-active .cat-chat-toggle-icon{ opacity: 0; transform: scale(.6) rotate(45deg); }
.cat-chat-toggle.is-active .cat-chat-toggle-close{ opacity: 1; transform: scale(1) rotate(0); }

/* One-time attention pulse — a soft expanding gold ring, plays once. */
.cat-chat-toggle-pulse::after{
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  animation: catPulse 1.6s ease-out 2;
}
@keyframes catPulse{
  0%   { transform: scale(1);   opacity: .8; }
  100% { transform: scale(1.55); opacity: 0; }
}

.cat-chat-window{
  position: fixed;
  right: 22px;
  bottom: calc(96px + var(--cat-lift));
  z-index: 800;
  width: min(380px, calc(100vw - 32px));
  height: min(600px, 78vh);
  height: min(600px, 78dvh);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 40px 100px -24px rgba(0,0,0,.75), 0 0 0 1px rgba(230,199,102,.1);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  pointer-events: none;
  transition: opacity .28s var(--ease-out), transform .28s var(--ease-out);
}
.cat-chat-window.is-open{
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.cat-chat-header{
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.1rem;
  background: linear-gradient(120deg, rgba(201,169,98,.14), transparent 70%), var(--bg);
  border-bottom: 1px solid var(--border);
}
.cat-chat-header-info{
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}
.cat-chat-avatar{
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, var(--gold-dark));
}
/* The official logo artwork (assets/logo/logo-mark.png) — the same file
   used site-wide in the header — shown whole via `contain` so it's never
   stretched or cropped; its own dark artwork already reads clearly
   against this gold circle, matching the header's dark/light treatment
   in spirit without needing the header's mask-tint trick (this circle
   never changes with the site's theme toggle). */
.cat-chat-avatar-logo{
  width: 76%;
  height: 76%;
  object-fit: contain;
  display: block;
}
.cat-chat-header-text{ min-width: 0; }
.cat-chat-title{
  font-family: 'Playfair Display', serif;
  font-size: .96rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-chat-subtitle{
  display: flex;
  align-items: center;
  gap: .4em;
  margin-top: .15rem;
  font-size: .7rem;
  color: var(--text-faint);
}
.cat-chat-dot{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #5fd987;
  box-shadow: 0 0 6px rgba(95,217,135,.8);
}
.cat-chat-close{
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: .1em .3em;
  transition: color .3s;
}
.cat-chat-close:hover{ color: var(--gold); }

.cat-chat-body{
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem .6rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  scroll-behavior: smooth;
}

.cat-msg{
  max-width: 86%;
  padding: .62em .85em;
  border-radius: 10px;
  font-size: .86rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.cat-msg-bot{
  align-self: flex-start;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.cat-msg-user{
  align-self: flex-end;
  background: linear-gradient(120deg, var(--gold-light), var(--gold) 60%, var(--gold-dark));
  color: #0a0906;
  font-weight: 500;
  border-bottom-right-radius: 3px;
}
.cat-msg-in{ animation: catMsgIn .28s var(--ease-out); }
@keyframes catMsgIn{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: translateY(0); }
}

.cat-typing{
  display: flex;
  gap: 4px;
  align-items: center;
  padding: .8em 1em;
}
.cat-typing span{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .6;
  animation: catTypingBounce 1.1s ease-in-out infinite;
}
.cat-typing span:nth-child(2){ animation-delay: .15s; }
.cat-typing span:nth-child(3){ animation-delay: .3s; }
@keyframes catTypingBounce{
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.cat-chat-quickreplies{
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0 1rem .8rem;
}
.cat-chip{
  padding: .5em .9em;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: .76rem;
  cursor: pointer;
  transition: border-color .25s, color .25s, background .25s;
}
.cat-chip:hover{
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-soft);
}

.cat-chat-inputrow{
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .8rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.cat-chat-input{
  flex: 1;
  min-width: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: .7em .9em;
  border-radius: 20px;
  font-family: 'Montserrat', sans-serif;
  font-size: .88rem;
  color-scheme: dark;
}
.cat-chat-input:focus{ outline: none; border-color: var(--gold); }
.cat-chat-input::placeholder{ color: var(--text-faint); }
.cat-chat-send{
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  background: linear-gradient(135deg, var(--gold-light), var(--gold) 60%, var(--gold-dark));
  color: #0a0906;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.cat-chat-send:hover{ transform: scale(1.06); box-shadow: 0 8px 20px -8px rgba(201,169,98,.6); }
.cat-chat-send svg{ width: 17px; height: 17px; }

/* ---------------------------------------------------------------------
   MOBILE — near-full-screen sheet, sized against the *visual* viewport
   (dvh) so the on-screen keyboard never hides the input, comfortably
   clear of anything else on the page.
   --------------------------------------------------------------------- */
@media (max-width: 640px){
  .cat-chat-toggle{
    right: 16px;
    bottom: calc(16px + var(--cat-lift));
    width: 54px;
    height: 54px;
  }
  .cat-chat-toggle-icon,
  .cat-chat-toggle-close{ width: 23px; height: 23px; }
  .cat-chat-window{
    right: 10px;
    left: 10px;
    bottom: calc(10px + var(--cat-lift));
    width: auto;
    height: min(640px, calc(100vh - 90px - var(--cat-lift)));
    height: min(640px, calc(100dvh - 90px - var(--cat-lift)));
  }
}
@media (max-width: 380px){
  .cat-chat-toggle{ bottom: calc(6px + var(--cat-lift)); }
  .cat-chat-window{
    right: 6px;
    left: 6px;
    bottom: calc(6px + var(--cat-lift));
    height: calc(100vh - 78px - var(--cat-lift));
    height: calc(100dvh - 78px - var(--cat-lift));
    border-radius: 10px;
  }
}

@media (prefers-reduced-motion: reduce){
  .cat-chat-window,
  .cat-msg-in,
  .cat-chat-toggle,
  .cat-typing span{ animation: none !important; transition: none !important; }
  .cat-chat-toggle-pulse::after{ display: none; }
}
