/* Ashley — on-site assistant. Ported from the Dynamo Auto / Action Towing build.
   Theme per concept via --ash-* custom properties on html[data-ash-theme]. */

.ashley-launcher,
.ashley-panel {
  --ash-accent: #E11D2E;
  --ash-accent-text: #FF3B3B;
  --ash-on-accent: #ffffff;
  --ash-ink: #F6F4F3;
  --ash-surface: #100E0E;
  --ash-line: rgba(255, 255, 255, 0.11);
  --ash-soft: #8E8785;
  --ash-user: #1E1A1A;
  --ash-radius: 20px;
  --ash-radius-sm: 11px;
  position: fixed;
  right: 20px;
  z-index: 1100;
  font-family: inherit;
}

/* ---- per-concept themes ---- */
html[data-ash-theme="v2"] .ashley-launcher,
html[data-ash-theme="v2"] .ashley-panel {
  --ash-ink: #EFEBE4;
  --ash-surface: #0C0B0B;
  --ash-line: rgba(239, 235, 228, 0.13);
  --ash-soft: rgba(239, 235, 228, 0.60);
  --ash-user: #1A1717;
  --ash-radius: 0px;
  --ash-radius-sm: 0px;
}
html[data-ash-theme="v3"] .ashley-launcher,
html[data-ash-theme="v3"] .ashley-panel {
  --ash-ink: #E8E4E4;
  --ash-surface: #0B0A0A;
  --ash-line: #2A2626;
  --ash-soft: #A39D9D;
  --ash-user: #141212;
  --ash-radius: 0px;
  --ash-radius-sm: 0px;
}
/* v3 is a hard-edged build: 2px rules, nothing rounded. */
html[data-ash-theme="v3"] .ashley-launcher,
html[data-ash-theme="v3"] .ashley-panel,
html[data-ash-theme="v3"] .ashley-close,
html[data-ash-theme="v3"] .ashley-chip,
html[data-ash-theme="v3"] .ashley-input,
html[data-ash-theme="v3"] .ashley-list li { border-width: 2px; }
html[data-ash-theme="v3"] .ashley-launcher,
html[data-ash-theme="v3"] .ashley-avatar,
html[data-ash-theme="v3"] .ashley-chip,
html[data-ash-theme="v3"] .ashley-msg,
html[data-ash-theme="v2"] .ashley-launcher,
html[data-ash-theme="v2"] .ashley-msg { border-radius: 0; }

/* The widget hides itself with the `hidden` attribute, but `display:flex` below
   is a class rule and outranks the UA's `[hidden]{display:none}` — without this
   the panel renders on the page even when its state says closed. */
.ashley-panel[hidden],
.ashley-launcher[hidden],
.ashley-scrim[hidden] { display: none !important; }

.ashley-launcher {
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 18px 9px 9px;
  border: 1px solid var(--ash-line);
  border-radius: 999px;
  background: var(--ash-surface);
  color: var(--ash-ink);
  cursor: pointer;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.32s;
}
.ashley-launcher:hover { transform: translateY(-2px); border-color: var(--ash-accent); }
.ashley-launcher:active { transform: translateY(0) scale(0.985); }

.ashley-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 999px;
  background: var(--ash-accent);
  color: var(--ash-on-accent);
  font-weight: 700;
  font-size: 14px;
}

.ashley-launcher-copy { display: grid; text-align: left; line-height: 1.25; }
.ashley-launcher-copy b { font-size: 13.5px; font-weight: 600; }
.ashley-launcher-copy span { font-size: 11.5px; color: var(--ash-soft); }

.ashley-ping {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--ash-accent);
  opacity: 0;
  animation: ashPing 3.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  pointer-events: none;
}
@keyframes ashPing {
  0% { transform: scale(0.9); opacity: 0.7; }
  70%, 100% { transform: scale(1.6); opacity: 0; }
}

.ashley-panel {
  bottom: 20px;
  display: flex;
  flex-direction: column;
  width: min(384px, calc(100vw - 32px));
  height: min(590px, calc(100dvh - 40px));
  border: 1px solid var(--ash-line);
  border-radius: var(--ash-radius);
  background: var(--ash-surface);
  color: var(--ash-ink);
  overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: ashIn 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes ashIn { from { opacity: 0; transform: translateY(14px); } }

.ashley-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 13px;
  border-bottom: 1px solid var(--ash-line);
}
.ashley-head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.ashley-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--ash-soft); display: flex; align-items: center; gap: 6px; }
.ashley-dot { width: 6px; height: 6px; border-radius: 999px; background: #37d67a; box-shadow: 0 0 0 3px rgba(55, 214, 122, 0.16); }
.ashley-dot.is-closed { background: var(--ash-accent-text); box-shadow: 0 0 0 3px rgba(255, 59, 59, 0.16); }

/* 40px keeps the dismiss target reachable with a thumb. */
.ashley-close {
  margin-left: auto;
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ash-line);
  border-radius: var(--ash-radius-sm);
  background: transparent;
  color: var(--ash-soft);
  cursor: pointer;
  font-size: 14px;
  transition: color .22s, border-color .22s, background .22s;
}
.ashley-close:hover { color: var(--ash-ink); border-color: var(--ash-accent); background: rgba(255, 255, 255, .05); }
.ashley-close:active { transform: scale(.94); }

/* Dismiss layer. Desktop closes via the document pointerdown handler, so the
   scrim only materialises on small screens where the panel fills the view. */
.ashley-scrim { display: none; }
@media (max-width: 640px) {
  .ashley-scrim:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1099;
    background: rgba(6, 5, 5, .6);
    animation: ashFade .28s cubic-bezier(0.16, 1, 0.3, 1);
  }
}
@keyframes ashFade { from { opacity: 0; } }

.ashley-log { flex: 1; overflow-y: auto; padding: 16px 14px 6px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.ashley-msg { max-width: 88%; padding: 11px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; animation: ashMsg 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes ashMsg { from { opacity: 0; transform: translateY(6px); } }
.ashley-msg.bot { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--ash-line); border-bottom-left-radius: 5px; align-self: flex-start; }
.ashley-msg.user { background: var(--ash-user); border-bottom-right-radius: 5px; align-self: flex-end; }
.ashley-msg a { color: var(--ash-accent-text); }
.ashley-msg strong { font-weight: 650; }

.ashley-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.ashley-typing i { width: 6px; height: 6px; border-radius: 999px; background: var(--ash-soft); animation: ashBlink 1.15s infinite; }
.ashley-typing i:nth-child(2) { animation-delay: 0.16s; }
.ashley-typing i:nth-child(3) { animation-delay: 0.32s; }
@keyframes ashBlink { 0%, 60%, 100% { opacity: 0.28; } 30% { opacity: 1; } }

.ashley-list { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.ashley-list li {
  padding: 9px 11px;
  border: 1px solid var(--ash-line);
  border-radius: var(--ash-radius-sm);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  line-height: 1.45;
}
.ashley-list b { display: block; font-size: 12.5px; }
.ashley-list span { color: var(--ash-soft); }

.ashley-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px 0; }
.ashley-chip {
  padding: 7px 12px;
  border: 1px solid var(--ash-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ash-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.22s, border-color 0.22s, transform 0.22s;
}
.ashley-chip:hover { color: var(--ash-ink); border-color: var(--ash-accent); }
.ashley-chip:active { transform: scale(0.97); }

.ashley-form { display: flex; gap: 8px; padding: 12px 14px 6px; }
.ashley-input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--ash-line);
  border-radius: var(--ash-radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ash-ink);
  font: inherit;
  font-size: 13.5px;
}
.ashley-input::placeholder { color: var(--ash-soft); }
.ashley-input:focus { outline: 2px solid var(--ash-accent-text); outline-offset: -1px; }
.ashley-send {
  width: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: var(--ash-radius-sm);
  background: var(--ash-accent);
  color: var(--ash-on-accent);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.ashley-send svg { width: 17px; height: 17px; }
.ashley-send:active { transform: scale(0.96); }

.ashley-legal { margin: 0; padding: 8px 16px 13px; font-size: 10.5px; line-height: 1.5; color: var(--ash-soft); }

/* v1 and v3 carry a sticky Call/Directions bar on phones — clear it. */
@media (max-width: 767px) {
  .ashley-launcher { right: 12px; bottom: 76px; }
  .ashley-panel { right: 12px; bottom: 12px; height: calc(100dvh - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  .ashley-launcher, .ashley-panel, .ashley-msg, .ashley-chip, .ashley-scrim { animation: none !important; transition: none !important; }
  .ashley-ping { display: none; }
}
