/*
 * ================================================================
 *  voltAssistant.css
 *  VoltScore — Volt Electrical Health Assistant
 * ================================================================
 *
 *  All styles and animations for the Volt assistant UI.
 *  Extracted from VoltAssistant.js for easier maintenance.
 *
 *  Load order in HTML:
 *    <link rel="stylesheet" href="voltAssistant.css">
 *    ...scripts...
 *
 *  No behaviour logic lives here — this file is styling only.
 * ================================================================
 */

/* ── Google Fonts ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --va-green:          #0a4a2e;
  --va-green-mid:      #0d6b41;
  --va-green-light:    #12a05e;
  --va-glow:           #1eff8e;
  --va-green-pale:     #e8f7f0;
  --va-yellow:         #f5c800;
  --va-urgent-bg:      #fff5f5;
  --va-urgent-border:  rgba(220,38,38,0.22);
  --va-urgent-text:    #7f1d1d;
  --va-warning-bg:     #fffbf0;
  --va-warning-border: rgba(245,158,11,0.2);
  --va-warning-text:   #7c4a00;
  --va-white:          #ffffff;
  --va-off:            #f4f7f5;
  --va-slate:          #1a2a22;
  --va-muted:          #6b8075;
  --va-border:         rgba(10,74,46,0.11);
  --va-shadow-panel:   0 24px 80px rgba(10,74,46,0.26), 0 4px 16px rgba(0,0,0,0.08);
  --va-font:           'DM Sans', system-ui, -apple-system, sans-serif;
  --va-ease-spring:    0.38s cubic-bezier(0.34,1.22,0.64,1);
  --va-ease-fast:      0.18s ease;
}

/* ══════════════════════════════════════════════════════════════
   LAUNCHER
══════════════════════════════════════════════════════════════ */
#va-launcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.va-launcher-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--va-green-mid) 0%, var(--va-green) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 20px rgba(10,74,46,0.45),
    0 1px 4px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform var(--va-ease-fast), box-shadow var(--va-ease-fast);
  animation: va-launcher-pulse 3.2s ease-in-out infinite;
}

#va-launcher:hover .va-launcher-ring,
#va-launcher:focus .va-launcher-ring {
  transform: scale(1.09) translateY(-2px);
  box-shadow:
    0 8px 30px rgba(10,74,46,0.55),
    0 0 0 6px rgba(30,255,142,0.14);
}

@keyframes va-launcher-pulse {
  0%, 100% {
    box-shadow:
      0 4px 20px rgba(10,74,46,0.45),
      0 0 0 0 rgba(30,255,142,0.35);
  }
  50% {
    box-shadow:
      0 4px 20px rgba(10,74,46,0.45),
      0 0 0 11px rgba(30,255,142,0);
  }
}

.va-launcher-label {
  background: var(--va-green);
  color: rgba(255,255,255,0.92);
  font-family: var(--va-font);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 100px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#va-launcher:hover .va-launcher-label,
#va-launcher:focus .va-launcher-label {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════
   PANEL
══════════════════════════════════════════════════════════════ */
#va-panel {
  position: fixed;
  bottom: 110px;
  right: 28px;
  z-index: 9099;
  width: 380px;
  max-width: calc(100vw - 40px);
  max-height: 82vh;
  background: var(--va-white);
  border-radius: 22px;
  box-shadow: var(--va-shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--va-font);
  /* closed state */
  transform: scale(0.9) translateY(18px);
  transform-origin: bottom right;
  opacity: 0;
  pointer-events: none;
  transition: transform var(--va-ease-spring), opacity 0.22s ease;
}

#va-panel.va-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Panel header ───────────────────────────────────────────── */
.va-header {
  background: linear-gradient(135deg, var(--va-green) 0%, var(--va-green-mid) 100%);
  padding: 16px 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  position: relative;
}

.va-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

.va-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(30,255,142,0.32);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 1;
}

.va-header-text {
  flex: 1;
  position: relative;
  z-index: 1;
}

.va-header-name {
  font-weight: 700;
  font-size: 0.96rem;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.va-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.73rem;
  color: rgba(255,255,255,0.62);
  margin-top: 2px;
}

.va-status-dot {
  width: 6px;
  height: 6px;
  background: var(--va-glow);
  border-radius: 50%;
  animation: va-status-pulse 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes va-status-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.28; }
}

.va-close {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.11);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.68);
  flex-shrink: 0;
  transition: background var(--va-ease-fast), color var(--va-ease-fast);
}
.va-close:hover { background: rgba(255,255,255,0.22); color: #fff; }

/* ── Chat body ──────────────────────────────────────────────── */
.va-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 10px;
  background: var(--va-off);
  display: flex;
  flex-direction: column;
  gap: 11px;
  scroll-behavior: smooth;
}

.va-body::-webkit-scrollbar        { width: 4px; }
.va-body::-webkit-scrollbar-track  { background: transparent; }
.va-body::-webkit-scrollbar-thumb  { background: rgba(10,74,46,0.16); border-radius: 2px; }

/* ── Messages ───────────────────────────────────────────────── */
.va-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: va-msg-in 0.22s ease both;
}

@keyframes va-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.va-msg.volt { flex-direction: row; }
.va-msg.user { flex-direction: row-reverse; }

.va-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.va-msg-avatar.volt-av { background: var(--va-green); }
.va-msg-avatar.user-av { background: rgba(10,74,46,0.38); }

.va-bubble {
  max-width: 83%;
  padding: 11px 14px;
  font-size: 0.862rem;
  line-height: 1.57;
  border-radius: 16px;
}

.va-msg.volt .va-bubble {
  background: var(--va-white);
  color: var(--va-slate);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 10px rgba(10,74,46,0.07);
}

.va-msg.user .va-bubble {
  background: var(--va-green);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

.va-msg.warning .va-bubble {
  background: var(--va-warning-bg);
  border: 1px solid var(--va-warning-border);
  color: var(--va-warning-text);
}

.va-msg.urgent .va-bubble {
  background: var(--va-urgent-bg);
  border: 1.5px solid var(--va-urgent-border);
  color: var(--va-urgent-text);
}

/* CTA link inside bubble */
.va-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 7px 13px;
  background: var(--va-green);
  color: #fff;
  font-family: var(--va-font);
  font-size: 0.77rem;
  font-weight: 600;
  border-radius: 100px;
  text-decoration: none;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  transition: background var(--va-ease-fast), transform var(--va-ease-fast);
}
.va-cta:hover         { background: var(--va-green-mid); transform: translateY(-1px); }
.va-cta.urgent        { background: #dc2626; }
.va-cta.urgent:hover  { background: #b91c1c; }

/* ── Typing indicator ───────────────────────────────────────── */
.va-typing {
  display: flex;
  gap: 4px;
  padding: 9px 12px;
  align-items: center;
}

.va-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--va-muted);
  animation: va-dot-bounce 1.25s ease-in-out infinite;
}
.va-dot:nth-child(2) { animation-delay: 0.15s; }
.va-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes va-dot-bounce {
  0%, 58%, 100% { transform: translateY(0); }
  29%           { transform: translateY(-7px); }
}

/* ── Chips ──────────────────────────────────────────────────── */
.va-chips {
  padding: 8px 13px 7px;
  background: var(--va-off);
  border-top: 1px solid var(--va-border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.va-chip {
  background: var(--va-white);
  border: 1.5px solid var(--va-border);
  color: var(--va-green);
  font-family: var(--va-font);
  font-size: 0.77rem;
  font-weight: 500;
  border-radius: 100px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
  transition:
    background var(--va-ease-fast),
    border-color var(--va-ease-fast),
    transform var(--va-ease-fast);
}
.va-chip:hover {
  background: var(--va-green-pale);
  border-color: var(--va-green-light);
  transform: translateY(-1px);
}

/* ── Input row ──────────────────────────────────────────────── */
.va-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px 9px;
  background: var(--va-white);
  border-top: 1px solid var(--va-border);
  flex-shrink: 0;
}

.va-input {
  flex: 1;
  background: var(--va-off);
  border: 1.5px solid var(--va-border);
  border-radius: 100px;
  padding: 8px 15px;
  font-family: var(--va-font);
  font-size: 0.862rem;
  color: var(--va-slate);
  outline: none;
  transition: border-color var(--va-ease-fast);
  -webkit-appearance: none;
}
.va-input::placeholder { color: var(--va-muted); }
.va-input:focus        { border-color: var(--va-green-light); }

.va-send {
  width: 35px;
  height: 35px;
  background: var(--va-green);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--va-ease-fast), transform var(--va-ease-fast);
}
.va-send:hover { background: var(--va-green-mid); transform: scale(1.07); }

/* ── Footer disclaimer ──────────────────────────────────────── */
.va-footer {
  padding: 7px 14px 11px;
  background: var(--va-white);
  border-top: 1px solid var(--va-border);
  font-size: 0.68rem;
  color: var(--va-muted);
  line-height: 1.45;
  text-align: center;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   HERO SECTION
   Volt injected into #vs-hero-section inside .vs-hero-right.
   Page grid handles 2-col layout. This governs the wrap only.
══════════════════════════════════════════════════════════════ */
.va-hero-wrap {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  padding: 0;
  font-family: var(--va-font);
}

/* Volt image — left side of the row */
.va-hero-volt-wrap {
  flex: 0 0 auto;
  cursor: pointer;
  position: relative;
  z-index: 2;
  order: 1;
  margin-bottom: -8px;
  margin-right: -10px;
}

.va-volt-img {
  display: block;
  width: 230px;
  height: auto;
  animation: va-float 4.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 18px rgba(10,74,46,0.14));
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

/* Speech card — floats right of Volt at shoulder/hand height */
.va-hero-content {
  flex: 1;
  position: relative;
  z-index: 3;
  order: 2;
  padding-top: 60px;
}

.va-speech-bubble {
  background: #fff;
  border: 1px solid #c8ddd0;
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin-top: 0;
  box-shadow: 0 4px 18px rgba(10,74,46,0.11);
}

/* "VOLT · role" eyebrow */
.va-speech-bubble strong {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #0a4a2e;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.va-speech-bubble strong::before {
  content: '';
  width: 5px; height: 5px;
  background: #12a05e;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Body text — dark on pale green card */
.va-speech-text {
  color: #1a2a22;
  font-size: 0.87rem;
  line-height: 1.54;
  font-weight: 400;
  display: block;
}

/* Ask Volt CTA button — hidden in hero; Volt image is clickable */
.va-hero-btn {
  display: none;
}

/* Mobile hero — revert to column */
@media (max-width: 780px) {
  .va-hero-wrap {
    flex-direction: column;
    align-items: center;
  }
  .va-hero-volt-wrap { order: 1; margin-right: 0; }
  .va-hero-content   { order: 2; width: 100%; padding-top: 0; }
}
@media (max-width: 600px) {
  .va-hero-wrap      { padding: 0; }
  .va-hero-volt-wrap { margin-bottom: -4px; }
  .va-volt-img       { width: 170px; }
  .va-speech-bubble  { margin-top: 4px; }
}

/* ══════════════════════════════════════════════════════════════
   VOLT SVG ANIMATIONS
   Applied to SVG elements rendered by VoltAvatar.js
══════════════════════════════════════════════════════════════ */
@keyframes va-float {
  0%, 100% { transform: translateY(0px);   }
  50%       { transform: translateY(-11px); }
}

@keyframes va-glow-pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(30,255,142,0.32)); }
  50%       { filter: drop-shadow(0 0 26px rgba(30,255,142,0.72)); }
}

@keyframes va-eye-blink {
  0%, 87%, 100% { transform: scaleY(1); }
  92%            { transform: scaleY(0.07); }
}

@keyframes va-bolt-glow {
  0%, 100% { opacity: 0.88; filter: drop-shadow(0 0 4px rgba(245,200,0,0.45)); }
  50%       { opacity: 1;    filter: drop-shadow(0 0 14px rgba(245,200,0,0.95)); }
}

/* Full-body hero Volt */
.va-volt-full {
  animation:
    va-float 4.2s ease-in-out infinite,
    va-glow-pulse 3.1s ease-in-out infinite;
  will-change: transform, filter;
}

/* Eye blink groups inside SVG */
.va-eye-l {
  transform-origin: center;
  animation: va-eye-blink 5.2s ease-in-out infinite;
}
.va-eye-r {
  transform-origin: center;
  animation: va-eye-blink 5.2s ease-in-out infinite 0.1s;
}

/* Lightning bolt pulse */
.va-bolt-shape {
  animation: va-bolt-glow 2.6s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════
   ACCESSIBILITY — REDUCED MOTION
══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .va-volt-full,
  .va-volt-img,
  .va-eye-l,
  .va-eye-r,
  .va-bolt-shape,
  .va-launcher-ring,
  .va-status-dot,
  .va-dot {
    animation: none !important;
  }
  #va-panel {
    transition: opacity 0.15s ease !important;
    transform: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE
   Panel full-width. Launcher stays bottom-right, clear of CTA
   (CTA is centred in hero — launcher is fixed bottom-right).
══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  #va-panel    { left: 10px; right: auto; bottom: 90px; width: calc(100vw - 20px); transform-origin: bottom left; }
  #va-launcher { left: 16px; right: auto; bottom: 24px; }
  .va-launcher-ring { width: 56px; height: 56px; }
}
