/* Sellvia Chat widget — minimal, self-contained styles. */

#sellvia-chat-root {
  --sc-brand: #ff4f1a;          /* Sellvia orange — adjust to match brand */
  --sc-brand-dark: #e03a00;
  --sc-bg: #ffffff;
  --sc-surface: #f7f7f8;
  --sc-text: #1d1d1f;
  --sc-text-muted: #6b6b70;
  --sc-border: #e5e5ea;
  --sc-radius: 14px;
  --sc-shadow: 0 8px 32px rgba(0,0,0,.15);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999999;
  color: var(--sc-text);
  line-height: 1.4;
}

/* -------- Toggle button -------- */
#sc-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--sc-brand);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--sc-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background-color .15s;
}
#sc-toggle:hover {
  background: var(--sc-brand-dark);
  transform: scale(1.05);
}

/* -------- Panel -------- */
#sc-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 560px;
  max-height: calc(100vh - 100px);
  background: var(--sc-bg);
  border-radius: var(--sc-radius);
  box-shadow: var(--sc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--sc-border);
}
/* ID specificity (100) would otherwise override the UA [hidden] rule.
   Restore it so the panel stays collapsed until the user opens it. */
#sc-panel[hidden] { display: none; }

#sc-header {
  background: var(--sc-brand);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#sc-header .sc-title { font-weight: 600; font-size: 15px; }
#sc-header .sc-subtitle { font-size: 12px; opacity: .85; }

#sc-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
#sc-close:hover { opacity: .8; }

/* -------- Messages area -------- */
#sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--sc-surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.sc-msg-user {
  align-self: flex-end;
  background: var(--sc-brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.sc-msg-assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--sc-border);
  border-bottom-left-radius: 4px;
}

.sc-action-btn {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--sc-brand);
  color: var(--sc-brand);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.sc-action-btn:hover {
  background: var(--sc-brand);
  color: #fff;
}

.sc-system-note {
  align-self: center;
  font-size: 12px;
  color: var(--sc-text-muted);
  font-style: italic;
  margin: 4px 0;
}

/* -------- Typing indicator -------- */
.sc-typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
}
.sc-typing span {
  width: 6px;
  height: 6px;
  background: var(--sc-text-muted);
  border-radius: 50%;
  animation: sc-bounce 1.2s infinite;
}
.sc-typing span:nth-child(2) { animation-delay: .15s; }
.sc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sc-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* -------- Input form -------- */
#sc-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--sc-border);
  background: #fff;
}
#sc-input {
  flex: 1;
  border: 1px solid var(--sc-border);
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
#sc-input:focus { border-color: var(--sc-brand); }

#sc-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--sc-brand);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .15s;
}
#sc-send:hover:not(:disabled) { background: var(--sc-brand-dark); }
#sc-send:disabled { opacity: .5; cursor: not-allowed; }

/* -------- Mobile -------- */
@media (max-width: 480px) {
  #sellvia-chat-root { bottom: 12px; right: 12px; }
  #sc-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 90px);
    bottom: 72px;
  }
}
