/* Gabe chat widget — minimal, Apple-style, mobile-friendly. */

#gabe-chat {
  --gc-accent: #0071e3;
  --gc-bg: #ffffff;
  --gc-bg-soft: #f5f5f7;
  --gc-text: #1d1d1f;
  --gc-text-soft: #6e6e73;
  --gc-border: #d2d2d7;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  color: var(--gc-text);
}

.gc-launcher {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--gc-accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  z-index: 9998;
  box-shadow: 0 6px 24px rgba(0, 113, 227, 0.35);
  transition: transform 80ms ease, box-shadow 80ms ease;
}
/* Make the `hidden` HTML attribute actually win over the explicit display
   rules above. Without this, setting el.hidden=true has no visual effect —
   that's why earlier "fixes" to wire up the close button didn't actually
   close the panel. */
.gc-launcher[hidden],
.gc-panel[hidden] { display: none !important; }
.gc-launcher:hover  { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(0, 113, 227, 0.45); }
.gc-launcher:active { transform: scale(0.97); }
.gc-launcher-icon { font-size: 18px; line-height: 1; }
.gc-launcher-text { font-size: 14px; }

.gc-panel {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 360px;
  height: min(560px, 80vh);
  max-height: calc(100vh - 100px);
  background: var(--gc-bg);
  border: 1px solid var(--gc-border);
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  animation: gc-pop-in 160ms ease-out;
}
@keyframes gc-pop-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--gc-border);
  background: var(--gc-bg-soft);
}
.gc-header-text { flex: 1; min-width: 0; }
.gc-title { font-weight: 600; font-size: 15px; }
.gc-sub   { font-size: 12px; color: var(--gc-text-soft); margin-top: 2px; }
.gc-close {
  background: rgba(0, 0, 0, 0.05);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gc-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 80ms ease;
}
.gc-close:hover  { background: rgba(0, 0, 0, 0.1); }
.gc-close:active { background: rgba(0, 0, 0, 0.18); }
.gc-close svg { display: block; }

.gc-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--gc-bg);
}
.gc-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.gc-msg-user      { background: var(--gc-accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.gc-msg-assistant { background: var(--gc-bg-soft); color: var(--gc-text); align-self: flex-start; border-bottom-left-radius: 6px; }
.gc-msg-system    { background: #fff3e0; color: #b25000; align-self: stretch; max-width: 100%; text-align: center; font-size: 13px; }
.gc-typing        { font-size: 18px; letter-spacing: 2px; opacity: 0.6; }

.gc-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--gc-border);
  background: var(--gc-bg);
}
.gc-form textarea {
  flex: 1;
  border: 1px solid var(--gc-border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  background: var(--gc-bg);
  color: var(--gc-text);
}
.gc-form textarea:focus {
  outline: none;
  border-color: var(--gc-accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18);
}
.gc-send {
  background: var(--gc-accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 40px;
  height: 40px;
  align-self: flex-end;
  cursor: pointer;
  font-size: 16px;
}
.gc-send:disabled { opacity: 0.4; cursor: not-allowed; }

.gc-footer {
  padding: 8px 14px 10px;
  font-size: 11px;
  color: var(--gc-text-soft);
  text-align: center;
  border-top: 1px solid var(--gc-border);
  background: var(--gc-bg-soft);
}
.gc-footer a { color: var(--gc-accent); }

/* Mobile: full-width sheet sliding up from the bottom. */
@media (max-width: 500px) {
  .gc-launcher { bottom: 16px; right: 16px; padding: 10px 14px; }
  .gc-panel {
    right: 8px;
    left: 8px;
    bottom: 76px;
    width: auto;
    height: min(70vh, 600px);
    border-radius: 16px;
  }
}
