/* =========================================================
   SeedChat Widget — floating button + embed
   Primary color is controlled via --sc-primary CSS variable.
   Default: #1a73e8. Override via Settings → Primary Color.
   ========================================================= */

.sc-hidden { display: none !important; }

/* ----- Floating action button ----- */
.sc-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--sc-primary, #1a73e8);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, box-shadow .2s, filter .2s;
}
.sc-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,.32);
  filter: brightness(0.9);
}

/* ----- Floating panel ----- */
.sc-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 360px;
  height: 500px;
  z-index: 99998;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  background: #fff;
  transform-origin: bottom right;
  animation: sc-pop .2s ease;
}
@keyframes sc-pop {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);    }
}

/* ----- Embed (shortcode) ----- */
.sc-embed {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  min-height: 400px;
}

/* ----- Header ----- */
.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--sc-primary, #1a73e8);
  color: #fff;
  flex-shrink: 0;
}
.sc-title {
  font-size: 15px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.01em;
}
.sc-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.sc-close:hover {
  color: #fff;
  background: rgba(255,255,255,.15);
}

/* ----- Messages area ----- */
.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.sc-messages::-webkit-scrollbar { width: 4px; }
.sc-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ----- Bubbles ----- */
.sc-msg {
  display: flex;
  max-width: 85%;
}
.sc-msg--user { align-self: flex-end; }
.sc-msg--bot  { align-self: flex-start; }

.sc-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  word-break: break-word;
}
.sc-msg--user .sc-bubble {
  background: var(--sc-primary, #1a73e8);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sc-msg--bot .sc-bubble {
  background: #fff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.sc-msg--error .sc-bubble {
  background: #fef2f2;
  color: #dc2626;
}

/* ----- Typing indicator ----- */
.sc-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 3px 0;
}
.sc-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: sc-bounce 1.2s infinite;
}
.sc-typing span:nth-child(2) { animation-delay: .2s; }
.sc-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes sc-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-5px); }
}

/* ----- Input bar ----- */
.sc-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px;
  background: #fff;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.sc-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
  background: #f8fafc;
  transition: border-color .15s, background .15s;
  color: #1e293b;
}
.sc-input:focus {
  border-color: var(--sc-primary, #1a73e8);
  background: #fff;
}
.sc-input::placeholder { color: #94a3b8; }

.sc-send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--sc-primary, #1a73e8);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .15s, transform .1s;
}
.sc-send:hover:not(:disabled) { filter: brightness(0.85); }
.sc-send:active:not(:disabled) { transform: scale(.93); }
.sc-send:disabled { background: #cbd5e1; cursor: not-allowed; }

/* ----- Page-embed block [seedchat_page] shortcode ----- */
.sc-page-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(800px, calc(100% - 32px));
  height: 580px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,.22);
}
@media (max-width: 480px) {
  .sc-page-overlay {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
}

/* ----- Page Template block ----- */
.seedchat-tpl-wrap {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 16px;
}
.seedchat-tpl-block {
  height: 680px;
  min-height: 500px;
}
.seedchat-tpl-notice {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ----- Mobile ----- */
@media (max-width: 480px) {
  .sc-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
  .sc-fab {
    bottom: 16px;
    right: 16px;
  }
}
