/* gsd-chat:v1 — PR-C1 widget shell. Static UI only, no LLM yet.
 * Tokens lifted from site.css. No new fonts, no new colors.
 * Performance: no animations on initial paint (only on user interaction),
 * no backdrop-filter, no box-shadow on the bubble (just on the panel).
 */

/* Position above the existing .sticky-cta (which sits at bottom on mobile).
   sticky-cta is approximately 56-64px tall, so the bubble sits 80px from bottom
   on mobile (to clear it) and 24px from bottom on desktop (no sticky-cta there). */

.gsd-chat-bubble,
.gsd-chat-panel {
  font-family: var(--font, 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif);
  box-sizing: border-box;
}

/* === BUBBLE (the floating launcher) === */
.gsd-chat-bubble {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #C6531A; /* var(--orange) */
  color: #FFFFFF;
  border: 0;
  cursor: pointer;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(11, 25, 41, 0.25);
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.gsd-chat-bubble:hover,
.gsd-chat-bubble:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 25, 41, 0.32);
  outline: 0;
}
.gsd-chat-bubble:focus-visible {
  outline: 2px solid #0B1929;
  outline-offset: 2px;
}
.gsd-chat-bubble svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  display: block;
}
.gsd-chat-bubble[hidden] { display: none !important; }

/* Mobile: lift above sticky-cta */
@media (max-width: 768px) {
  .gsd-chat-bubble { bottom: 88px; right: 16px; }
}

/* Unread/attention pulse (off by default, set .has-attention to enable) */
.gsd-chat-bubble.has-attention::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E07A35;
  border: 2px solid #FFFFFF;
}

/* === PANEL (the chat window) === */
.gsd-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #F5F0E4; /* var(--cream) */
  color: #0B1929; /* var(--navy) */
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(11, 25, 41, 0.28);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid rgba(11, 25, 41, 0.08);
}
.gsd-chat-panel[data-open="true"] {
  display: flex;
  animation: gsd-chat-in 160ms ease-out;
}
@keyframes gsd-chat-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
  .gsd-chat-panel {
    right: 16px;
    left: 16px;
    bottom: 156px; /* bubble (88+56) + 12 gap */
    width: auto;
    height: calc(100vh - 200px);
    max-height: 540px;
  }
}

.gsd-chat-header {
  background: #0B1929;
  color: #F5F0E4;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.gsd-chat-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}
.gsd-chat-sub {
  font-size: 12px;
  color: rgba(245, 240, 228, 0.7);
  margin-top: 2px;
}
.gsd-chat-close {
  background: transparent;
  color: inherit;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
  border-radius: 6px;
}
.gsd-chat-close:hover,
.gsd-chat-close:focus-visible {
  background: rgba(245, 240, 228, 0.15);
  outline: 0;
}
.gsd-chat-close:focus-visible {
  outline: 2px solid #E07A35;
  outline-offset: 2px;
}

.gsd-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 25, 41, 0.2) transparent;
}

.gsd-chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14.5px;
  line-height: 1.5;
  word-wrap: break-word;
}
.gsd-chat-msg-bot {
  align-self: flex-start;
  background: #FFFFFF;
  color: #0B1929;
  border-bottom-left-radius: 4px;
}
.gsd-chat-msg-user {
  align-self: flex-end;
  background: #0B1929;
  color: #F5F0E4;
  border-bottom-right-radius: 4px;
}

.gsd-chat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.gsd-chat-quick-btn {
  background: #FFFFFF;
  color: #0B1929;
  border: 1px solid rgba(11, 25, 41, 0.15);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 100ms ease, border-color 100ms ease;
}
.gsd-chat-quick-btn:hover,
.gsd-chat-quick-btn:focus-visible {
  background: #EDE8DA;
  border-color: rgba(11, 25, 41, 0.3);
  outline: 0;
}
.gsd-chat-quick-btn:focus-visible {
  outline: 2px solid #C6531A;
  outline-offset: 2px;
}
.gsd-chat-quick-btn:active {
  background: #0B1929;
  color: #F5F0E4;
}

.gsd-chat-footer {
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid rgba(11, 25, 41, 0.08);
  font-size: 12px;
  color: rgba(11, 25, 41, 0.6);
  text-align: center;
  line-height: 1.5;
}
.gsd-chat-footer a {
  color: #A04015;
  text-decoration: underline;
  font-weight: 500;
}
.gsd-chat-footer a:focus-visible {
  outline: 2px solid #C6531A;
  outline-offset: 2px;
  border-radius: 2px;
}

/* === FREE-TEXT INPUT (PR-C2) === */
.gsd-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #FFFFFF;
  border-top: 1px solid rgba(11, 25, 41, 0.08);
}
.gsd-chat-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 12px;
  font-size: 14.5px;
  font-family: inherit;
  color: #0B1929;
  background: #F5F0E4;
  border: 1px solid rgba(11, 25, 41, 0.15);
  border-radius: 20px;
  outline: 0;
  -webkit-appearance: none;
}
.gsd-chat-input:focus-visible {
  border-color: #C6531A;
  background: #FFFFFF;
}
.gsd-chat-input::placeholder { color: rgba(11, 25, 41, 0.45); }
.gsd-chat-send {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: #C6531A;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 100ms ease;
}
.gsd-chat-send:hover,
.gsd-chat-send:focus-visible {
  background: #A04015;
  outline: 0;
}
.gsd-chat-send:focus-visible {
  outline: 2px solid #0B1929;
  outline-offset: 2px;
}
.gsd-chat-send:disabled {
  background: rgba(11, 25, 41, 0.2);
  cursor: not-allowed;
}

.gsd-chat-typing {
  opacity: 0.6;
  font-style: italic;
}

.gsd-chat-msg-tiny {
  font-size: 12px;
  color: rgba(11, 25, 41, 0.55);
  margin-top: 4px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .gsd-chat-bubble,
  .gsd-chat-panel { transition: none; animation: none; }
}
