/* Scout: the floating AI chat (bubble → panel → expanded), shared by every sport's game pages.
   Markup: templates/_scout.html. Behaviour: static/js/scout.js. */


.scout { position: fixed; right: 20px; bottom: 20px; z-index: 300; }
.scout-bubble {
  position: relative; height: 48px; padding: 0 20px 0 16px; border-radius: 999px; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px; color: #fff; overflow: hidden; isolation: isolate;
  font-family: var(--sans); font-size: 14.5px; font-weight: 600; letter-spacing: -0.1px; white-space: nowrap;
  background: linear-gradient(120deg, var(--accent) 0%, #a66bff 55%, #e879c6 100%);
  box-shadow: 0 12px 32px -10px color-mix(in srgb, #a66bff 80%, transparent), 0 0 0 1px rgba(255, 255, 255, .14) inset, var(--shadow);
  transition: transform .2s var(--ease), padding .25s var(--ease), gap .25s var(--ease), box-shadow .2s var(--ease);
}
/* Light sweep every few seconds: reads as "AI", not "help" */
.scout-bubble::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%);
  transform: translateX(-120%); animation: scoutSheen 4.5s var(--ease) 1.2s infinite;
}
@keyframes scoutSheen { 0% { transform: translateX(-120%); } 30%, 100% { transform: translateX(120%); } }
.scout-bubble:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -10px color-mix(in srgb, #a66bff 90%, transparent), 0 0 0 1px rgba(255, 255, 255, .2) inset, var(--shadow); }
.scout-bubble svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.scout-bubble .ic-chat { display: flex; }
.scout-bubble .ai-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px; padding: 2px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .22);
}
.scout-bubble .label { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.scout-bubble .ic-close { display: none; }
.scout:not([data-state="closed"]) .scout-bubble { padding: 0 15px; gap: 0; }
.scout:not([data-state="closed"]) .scout-bubble::before { animation: none; }
.scout:not([data-state="closed"]) .scout-bubble :is(.ic-chat, .label, .ai-tag) { display: none; }
.scout:not([data-state="closed"]) .scout-bubble .ic-close { display: block; }
.scout.has-unread .scout-bubble::after {
  content: ''; position: absolute; top: 8px; right: 10px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .3);
}
@media (prefers-reduced-motion: reduce) { .scout-bubble::before { animation: none; } }

.scout-panel {
  position: fixed; right: 20px; bottom: 80px;
  width: 380px; height: min(560px, calc(100vh - var(--header-h) - 112px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lg);
  transform-origin: bottom right;
  transition: opacity .22s var(--ease), transform .22s var(--ease), width .28s var(--ease), height .28s var(--ease);
}
.scout[data-state="closed"] .scout-panel {
  opacity: 0; transform: translateY(10px) scale(.96); pointer-events: none; visibility: hidden;
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s .18s;
}
.scout[data-state="expanded"] .scout-panel {
  width: min(680px, calc(100vw - 40px)); height: calc(100vh - var(--header-h) - 112px);
}

.scout-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--border);
}
.scout-avatar {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
}
.scout-avatar svg { width: 15px; height: 15px; }
.scout-title { flex: 1; min-width: 0; }
.scout-title .t { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.ai-badge { font-size: 10px; font-weight: 700; letter-spacing: .4px; padding: 1px 6px; border-radius: 5px; color: #fff;
  background: linear-gradient(120deg, var(--accent), #a66bff 60%, #e879c6); }
.scout-title .s { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scout-icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent; color: var(--text3);
  display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s;
}
.scout-icon-btn:hover { background: var(--bg3); color: var(--text); }
.scout-icon-btn svg { width: 16px; height: 16px; }
.scout .ic-shrink { display: none; }
.scout[data-state="expanded"] .ic-grow { display: none; }
.scout[data-state="expanded"] .ic-shrink { display: block; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px;
}
.scout[data-state="expanded"] .chat-messages { padding: 24px 28px; }
.chat-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.chat-msg .content { font-size: 14px; line-height: 1.65; color: var(--text2); overflow-wrap: anywhere; }
.chat-msg.assistant .content { padding-top: 2px; }
.chat-msg.assistant .scout-avatar { width: 24px; height: 24px; border-radius: 8px; }
.chat-msg.assistant .scout-avatar svg { width: 13px; height: 13px; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.user .content {
  color: var(--text); background: var(--bg3); border: 1px solid var(--border);
  padding: 8px 12px; border-radius: 14px 14px 4px 14px; max-width: 85%;
}
.chat-empty { margin: auto; text-align: center; color: var(--text3); font-size: 13.5px; line-height: 1.6; padding: 0 24px; }
.chat-empty b { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin-bottom: 4px; }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 34px; }
.chat-suggestion {
  font-size: 12.5px; color: var(--text2); background: transparent; border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 999px; cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.chat-suggestion:hover { border-color: var(--accent); color: var(--text); background: var(--accentdim); }

.chat-typing { display: inline-flex; gap: 4px; padding: 9px 0; }
.chat-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text3); animation: scoutDot 1.2s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: .15s; }
.chat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes scoutDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chat-input-row {
  display: flex; align-items: center; gap: 8px; margin: 0 12px 12px; padding: 6px 6px 6px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.chat-input-row:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: 0 0 0 3px var(--accentdim); }
.chat-input {
  flex: 1; min-width: 0; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--sans); font-size: 14px; padding: 6px 0;
}
.chat-input:focus-visible { outline: none; }
.chat-input::placeholder { color: var(--text3); }
.chat-send {
  width: 32px; height: 32px; border-radius: 10px; border: none; flex-shrink: 0; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: var(--accent); transition: opacity .15s, transform .15s;
}
.chat-send svg { width: 16px; height: 16px; }
.chat-send:hover:not(:disabled) { transform: translateY(-1px); }
.chat-send:disabled { opacity: .35; cursor: not-allowed; }

@media (max-width: 640px) {
  .scout { right: 16px; bottom: 16px; }
  .scout-panel, .scout[data-state="expanded"] .scout-panel {
    inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: none;
  }
  .scout:not([data-state="closed"]) .scout-bubble { display: none; }
  .scout-bubble .label { max-width: 150px; }
  .scout-expand { display: none !important; }
}
