/* ═══════════════════════════════════════════════════════════════
   HOGAN STAKES UK — "Ask Hogan" chat widget
   Loaded only on products/** and resources/** launch pages.
   Colour law: yellow is text/accent on DARK surfaces only; the
   input field stays on a WHITE surface so the standard 2px dark
   focus outline stays visible (matches .form-group input:focus).
   ═══════════════════════════════════════════════════════════════ */

.hogan-chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Launcher ─────────────────────────────────────────────────── */
.hogan-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-primary-yellow, #FFB800);
  color: var(--color-primary-black, #000);
  border: none;
  border-radius: var(--radius-lg, 12px);
  padding: 12px 20px;
  font-family: var(--font-family-base, Arial, Helvetica, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}
.hogan-chat-launcher:hover { background: var(--color-primary-yellow-hover, #E5A600); transform: translateY(-2px); }
.hogan-chat-launcher:focus-visible { outline: 2px solid #1A1A1A; outline-offset: 3px; }
.hogan-chat-launcher svg { flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  .hogan-chat-launcher { transition: none; }
  .hogan-chat-launcher:hover { transform: none; }
}

/* ─── Panel ─────────────────────────────────────────────────────── */
/* Deliberately no open/close transition (snap show/hide via [hidden]) — this
   satisfies "no animation" for every visitor, not only prefers-reduced-motion,
   and keeps the widget genuinely lightweight. */
.hogan-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 1500;
  width: 360px;
  max-width: calc(100vw - 40px);
  max-height: min(560px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--color-dark-gray, #1a1a1a);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  font-family: var(--font-family-base, Arial, Helvetica, system-ui, sans-serif);
}
.hogan-chat-panel[hidden] { display: none; }

.hogan-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-primary-black, #000);
  padding: 14px 16px;
  border-bottom: 2px solid var(--color-primary-yellow, #FFB800);
  flex-shrink: 0;
}
.hogan-chat-title {
  margin: 0;
  color: var(--color-primary-yellow, #FFB800);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.hogan-chat-close {
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.hogan-chat-close:hover { color: var(--color-primary-yellow, #FFB800); }
.hogan-chat-close:focus-visible { outline: 2px solid var(--color-primary-yellow, #FFB800); outline-offset: 2px; }

.hogan-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-dark-gray, #1a1a1a);
}

.hogan-chat-msg { max-width: 85%; padding: 10px 14px; border-radius: var(--radius-md, 8px); font-size: 14px; line-height: 1.55; }
.hogan-chat-msg p { margin: 0 0 8px; }
.hogan-chat-msg p:last-child { margin-bottom: 0; }
.hogan-chat-msg ul { margin: 0 0 8px 18px; padding: 0; }
.hogan-chat-msg ul:last-child { margin-bottom: 0; }
.hogan-chat-msg a { text-decoration: underline; text-underline-offset: 2px; }

/* Assistant/system bubbles sit on a WHITE surface — ink text (#1a1a1a) per the
   colour law, never yellow text on that light background. */
.hogan-chat-msg--assistant { align-self: flex-start; background: var(--color-white, #fff); color: #1a1a1a; }
.hogan-chat-msg--assistant a { color: #1a1a1a; font-weight: 700; }
/* User bubbles use yellow as a fill with black text on top — a background
   application, not yellow-as-text-on-white, so it stays outside the ban. */
.hogan-chat-msg--user { align-self: flex-end; background: var(--color-primary-yellow, #FFB800); color: #000; }
.hogan-chat-msg--user a { color: #000; font-weight: 700; }
.hogan-chat-msg--system { align-self: stretch; background: #2a2a2a; color: #ddd; font-size: 13px; }
.hogan-chat-msg--system a.hogan-chat-contact-link {
  display: inline-block;
  margin-top: 8px;
  background: var(--color-primary-yellow, #FFB800);
  color: #000;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: var(--radius-sm, 4px);
  text-decoration: none;
  letter-spacing: 0.3px;
}
.hogan-chat-msg--system a.hogan-chat-contact-link:hover { background: var(--color-primary-yellow-hover, #E5A600); }
.hogan-chat-msg--system a.hogan-chat-contact-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.hogan-chat-thinking { align-self: flex-start; color: #aaa; font-size: 13px; margin: 0; padding: 4px 14px; }

.hogan-chat-verifying { margin: 0; padding: 0 16px 8px; font-size: 12px; color: #999; }
.hogan-chat-verifying[hidden] { display: none; }

.hogan-chat-turnstile { padding: 0 16px; flex-shrink: 0; }
.hogan-chat-turnstile:empty { padding: 0; }

.hogan-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #333;
  background: #141414;
  flex-shrink: 0;
}
.hogan-chat-input {
  flex: 1;
  resize: none;
  max-height: 96px;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm, 4px);
  background: var(--color-white, #fff);
  color: var(--color-dark-gray, #1a1a1a);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
}
.hogan-chat-input:focus { outline: 2px solid #1A1A1A; outline-offset: 2px; border-color: var(--color-primary-yellow, #FFB800); }
.hogan-chat-input:disabled { background: #eee; color: #888; }

.hogan-chat-send {
  background: var(--color-primary-yellow, #FFB800);
  color: #000;
  border: none;
  border-radius: var(--radius-sm, 4px);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.hogan-chat-send:hover:not(:disabled) { background: var(--color-primary-yellow-hover, #E5A600); }
.hogan-chat-send:disabled { background: #555; color: #999; cursor: not-allowed; }
.hogan-chat-send:focus-visible { outline: 2px solid #1A1A1A; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .hogan-chat-send { transition: none; }
}

/* ─── Mobile bottom sheet ───────────────────────────────────────── */
@media (max-width: 640px) {
  .hogan-chat-launcher { right: 14px; bottom: 14px; padding: 10px 16px; font-size: 13px; }
  .hogan-chat-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: min(80vh, calc(100vh - 20px));
    border-radius: 16px 16px 0 0;
  }
}
