/* Catie Bot and the contact form: the chat bubble on shootpick.com and in the app (assets/support.js).
   Same file in assets/ and app/public/assets/ (a test keeps them identical). Everything is scoped
   under .spc so it never touches the page around it. */

.spc {
  --spc-accent: #19C3D6;
  --spc-accent-ink: #12232E;
  --spc-accent-text: #10818D;
  --spc-bg: #FFFFFF;
  --spc-soft: #F5F5F7;
  --spc-bubble: #F0F2F4;
  --spc-ink: #1D1D1F;
  --spc-muted: #6E6E73;
  --spc-line: #E8E8ED;
  --spc-shadow: 0 18px 50px rgba(18, 35, 46, 0.22), 0 2px 8px rgba(18, 35, 46, 0.08);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--spc-ink);
  -webkit-font-smoothing: antialiased;
}
html[data-theme="dark"] .spc {
  --spc-accent-text: #3FD3E3;
  --spc-bg: #1A1D21;
  --spc-soft: #22262B;
  --spc-bubble: #2A2F35;
  --spc-ink: #F5F5F7;
  --spc-muted: #A1A1A6;
  --spc-line: #31363C;
  --spc-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
}
.spc *, .spc *::before, .spc *::after { box-sizing: border-box; }
.spc [hidden] { display: none !important; }

/* ---------- Launcher ---------- */
.spc-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
  width: 60px; height: 60px; padding: 0; border: 3px solid var(--spc-accent); border-radius: 50%;
  background: var(--spc-bg); box-shadow: var(--spc-shadow); cursor: pointer;
  transition: transform .18s ease;
}
.spc-launcher:hover { transform: translateY(-2px) scale(1.03); }
.spc-launcher:focus-visible, .spc button:focus-visible, .spc a:focus-visible, .spc input:focus-visible, .spc textarea:focus-visible, .spc select:focus-visible { outline: 3px solid var(--spc-accent); outline-offset: 2px; }
.spc-launcher img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.spc-launcher .spc-dot { position: absolute; right: 0; bottom: 2px; }
.spc-launcher .spc-close-icon { display: none; }
.spc.is-open .spc-launcher { width: 48px; height: 48px; right: 26px; bottom: 26px; border-color: transparent; background: #12232E; }
.spc.is-open .spc-launcher img, .spc.is-open .spc-launcher .spc-dot { display: none; }
.spc.is-open .spc-launcher .spc-close-icon { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: #fff; }
html[data-theme="dark"] .spc.is-open .spc-launcher { background: #2A2F35; }
.spc-dot { width: 13px; height: 13px; border-radius: 50%; background: #34C759; border: 2px solid var(--spc-bg); }

.spc-teaser {
  position: fixed; right: 20px; bottom: 92px; z-index: 2147483000;
  max-width: 260px; padding: 12px 34px 12px 14px; border-radius: 16px 16px 4px 16px;
  background: var(--spc-bg); color: var(--spc-ink); box-shadow: var(--spc-shadow);
  cursor: pointer; animation: spc-pop .25s ease;
}
.spc-teaser-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--spc-muted); font-size: 18px; line-height: 1; cursor: pointer; }
.spc-teaser-x:hover { background: var(--spc-soft); }

/* ---------- Panel ---------- */
.spc-panel {
  position: fixed; right: 20px; bottom: 96px; z-index: 2147483001;
  display: flex; flex-direction: column;
  width: 380px; height: min(620px, calc(100vh - 124px)); height: min(620px, calc(100dvh - 124px));
  border-radius: 22px; overflow: hidden;
  background: var(--spc-bg); box-shadow: var(--spc-shadow);
  animation: spc-pop .2s ease;
}
@keyframes spc-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.spc-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px; background: #12232E; color: #fff; }
.spc-head-avatar { position: relative; flex: none; width: 44px; height: 44px; }
.spc-head-avatar img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--spc-accent); }
.spc-head-avatar .spc-dot { position: absolute; right: -1px; bottom: -1px; border-color: #12232E; }
.spc-head-text { flex: 1; min-width: 0; }
.spc-head-name { font-weight: 600; font-size: 16px; }
.spc-head-sub { font-size: 12.5px; color: #C9D3D8; }
.spc-head-btn { flex: none; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #C9D3D8; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.spc-head-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.spc-tabs { display: flex; gap: 4px; padding: 0 12px; background: #12232E; }
.spc-tab { flex: 1; padding: 9px 8px 11px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #C9D3D8; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.spc-tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--spc-accent); }

/* ---------- Chat ---------- */
.spc-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.spc-log { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.spc-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.spc-row img { flex: none; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.spc-row.is-me { justify-content: flex-end; }
.spc-msg { max-width: 82%; padding: 10px 13px; border-radius: 18px 18px 18px 6px; background: var(--spc-bubble); white-space: pre-wrap; overflow-wrap: anywhere; }
.spc-row.is-me .spc-msg { border-radius: 18px 18px 6px 18px; background: var(--spc-accent); color: var(--spc-accent-ink); }
.spc-msg a { color: var(--spc-accent-text); text-decoration: underline; }
.spc-row.is-me .spc-msg a { color: inherit; }
.spc-note { align-self: center; max-width: 92%; padding: 8px 12px; border-radius: 12px; background: var(--spc-soft); color: var(--spc-muted); font-size: 13px; text-align: center; }
.spc-typing { display: inline-flex; gap: 4px; padding: 14px 14px; }
.spc-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--spc-muted); animation: spc-blink 1.2s infinite ease-in-out; }
.spc-typing span:nth-child(2) { animation-delay: .15s; }
.spc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes spc-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.spc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px; }
.spc-chip { padding: 7px 12px; border: 1.5px solid var(--spc-accent); border-radius: 980px; background: transparent; color: var(--spc-ink); font: inherit; font-size: 13.5px; cursor: pointer; }
.spc-chip:hover { background: var(--spc-accent); color: var(--spc-accent-ink); }

.spc-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--spc-line); }
.spc-compose textarea { flex: 1; min-height: 42px; max-height: 120px; padding: 10px 14px; border: 1px solid var(--spc-line); border-radius: 21px; background: var(--spc-soft); color: var(--spc-ink); font: inherit; resize: none; }
.spc-send { flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: var(--spc-accent); color: var(--spc-accent-ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.spc-send:disabled { opacity: .45; cursor: default; }
.spc-foot { padding: 0 14px 10px; color: var(--spc-muted); font-size: 11.5px; text-align: center; }
.spc-foot button { padding: 0; border: 0; background: none; color: var(--spc-accent-text); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- Contact form (in the panel and on /contact) ---------- */
.spc-form { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 18px 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.spc-done { flex: 1; }
.spc-form p { margin: 0; color: var(--spc-muted); font-size: 14px; }
.spc-field { display: flex; flex-direction: column; gap: 5px; }
.spc-field span { font-size: 13px; font-weight: 500; }
.spc-field input, .spc-field select, .spc-field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--spc-line); border-radius: 12px;
  background: var(--spc-soft); color: var(--spc-ink); font: inherit;
}
.spc-field textarea { min-height: 120px; resize: vertical; }
.spc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.spc-submit { align-self: flex-start; padding: 11px 22px; border: 0; border-radius: 980px; background: var(--spc-accent); color: var(--spc-accent-ink); font: inherit; font-weight: 600; cursor: pointer; }
.spc-submit:disabled { opacity: .55; cursor: default; }
.spc-error { color: #D70015; font-size: 14px; }
html[data-theme="dark"] .spc-error { color: #FF6961; }
.spc-done { padding: 28px 16px; text-align: center; }
.spc-done strong { display: block; margin-bottom: 6px; font-size: 17px; }

/* The standalone contact page puts the form in a card, no panel around it. */
.spc.spc-page .spc-form { padding: 0; overflow: visible; }

@media (max-width: 520px) {
  .spc-panel { right: 0; bottom: 0; width: 100vw; height: 100%; height: 100dvh; border-radius: 0; }
  .spc.is-open .spc-launcher { display: none; }
  .spc-launcher { right: 16px; bottom: 16px; width: 56px; height: 56px; }
  .spc-teaser { right: 16px; bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .spc-panel, .spc-teaser, .spc-typing span { animation: none; }
  .spc-launcher { transition: none; }
}
@media print { .spc:not(.spc-page) { display: none; } }

/* Text Catie (Sendblue): a bar under the tabs, prominent on phones */
.spc-textus { display: block; margin: 8px 12px 0; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; color: var(--spc-muted); text-align: center; }
.spc-textus a { color: inherit; font-weight: 600; text-decoration: underline; }
.spc-textus.is-phone { background: var(--spc-accent); color: var(--spc-accent-ink); text-decoration: none; text-align: left; }
.spc-textus.is-phone strong { display: block; font-size: 15px; }
.spc-textus.is-phone span { display: block; font-size: 12.5px; opacity: .85; }
