/* Guild Scaffolding chatbot widget styles
 * Loaded by the index.html <link>, scoped via .gsc- prefix
 */

.gsc-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ===== GSD WIDGET DEFAULTS — defensively force hidden elements to be invisible ===== */
.gsc-panel[hidden], .gsc-bubble[hidden], .gsc-chat[hidden] {
  display: none !important;
}

/* ----- Bubble ----- */
.gsc-bubble {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #2e7d32;
  color: white;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
  z-index: 10000;
}
.gsc-bubble:hover { background: #1b5e20; transform: scale(1.05); }
.gsc-bubble-icon { line-height: 1; }
.gsc-bubble-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #2e7d32;
  animation: gsc-pulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes gsc-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}
.gsc-bounce { animation: gsc-bounce 1.2s ease-in-out 2; }
@keyframes gsc-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ----- Panel ----- */
.gsc-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 18px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e6ebe6;
  animation: gsc-pop 0.18s ease-out;
  z-index: 10000;
}
@keyframes gsc-pop {
  from { transform: scale(0.95) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.gsc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
  color: white;
}
.gsc-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: white;
  color: #2e7d32;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.gsc-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gsc-header-text { flex: 1; min-width: 0; }
.gsc-header-name { font-weight: 800; font-size: 15px; line-height: 1.2; }
.gsc-header-sub { font-size: 12px; opacity: 0.9; line-height: 1.2; margin-top: 2px; }
.gsc-online { color: #a5d6a7; font-size: 11px; }
.gsc-header-hint { color: rgba(255,255,255,0.65); font-size: 10px; margin-left: 6px; font-weight: 600; }
.gsc-header { cursor: pointer; }
.gsc-close {
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  height: 48px;
  min-width: 88px;
  padding: 0 16px 0 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
  flex-shrink: 0;
  z-index: 5;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.gsc-close svg { display: block; }
.gsc-close:hover { background: rgba(255,255,255,0.45); border-color: rgba(255,255,255,0.6); }
.gsc-close:active { transform: scale(0.95); }
.gsc-close-label { letter-spacing: 0.02em; }

/* On small screens, hide the "Close" text and keep just the icon for space */
@media (max-width: 420px) {
  .gsc-close-label { display: none; }
  .gsc-close { min-width: 48px; width: 48px; padding: 0; }
}

/* ----- Messages ----- */
.gsc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fafdfa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gsc-msg { display: flex; }
.gsc-msg-user { justify-content: flex-end; }
.gsc-msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
}
.gsc-msg-bot .gsc-msg-bubble {
  background: white;
  color: #1a1a1a;
  border: 1px solid #e6ebe6;
  border-bottom-left-radius: 4px;
}
.gsc-msg-user .gsc-msg-bubble {
  background: #2e7d32;
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.gsc-typing .gsc-msg-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 14px 16px;
}
.gsc-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #9ab89a;
  animation: gsc-typing 1.2s ease-in-out infinite;
}
.gsc-dot:nth-child(2) { animation-delay: 0.15s; }
.gsc-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes gsc-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ----- Quick replies ----- */
.gsc-quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #fafdfa;
}
.gsc-qr {
  background: white;
  border: 1px solid #2e7d32;
  color: #2e7d32;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.gsc-qr:hover { background: #2e7d32; color: white; }

/* ----- Input ----- */
.gsc-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px 14px;
  background: white;
  border-top: 1px solid #e6ebe6;
}
.gsc-input {
  flex: 1;
  border: 1px solid #e6ebe6;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.gsc-input:focus { border-color: #2e7d32; }
.gsc-send {
  background: #2e7d32;
  color: white;
  border: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.1s;
}
.gsc-send:hover { background: #1b5e20; }
.gsc-send:active { transform: scale(0.95); }

/* ----- Minimize bar (backup close) ----- */
.gsc-minimize {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: #f5f8f5;
  border: none;
  border-top: 1px solid #e6ebe6;
  color: var(--primary-dark, #1b5e20);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.gsc-minimize:hover { background: #e8f0e8; color: #0d3a0d; }
.gsc-minimize:active { background: #d8e6d8; }
.gsc-minimize svg { display: block; }

/* ----- Mobile ----- */
@media (max-width: 720px) {
  .gsc-chat { right: 12px; bottom: 84px; /* sit above the sticky call bar */ }
  .gsc-bubble { width: 56px; height: 56px; font-size: 24px; }
  .gsc-panel {
    right: 8px; bottom: 76px;
    width: calc(100vw - 16px);
    height: calc(100vh - 160px);
    max-height: none;
    border-radius: 14px;
  }
}
