/* SaaSForge Assistant Widget - CSS */
.ssf-widget * { box-sizing: border-box; margin: 0; padding: 0; }

.ssf-fab {
  position: fixed;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--ssf-primary, #2563eb);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
  z-index: 999998;
  transition: transform .15s ease;
}
.ssf-fab:hover { transform: scale(1.06); }
.ssf-fab svg { width: 26px; height: 26px; }
.ssf-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.ssf-fab.bottom-right { right: 20px; bottom: 20px; }
.ssf-fab.bottom-left { left: 20px; bottom: 20px; }

.ssf-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: var(--ssf-secondary, #fff);
  color: var(--ssf-text, #1f2937);
  border-radius: var(--ssf-radius, 18px);
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
  overflow: hidden;
  z-index: 999999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.ssf-window.ssf-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.ssf-window.bottom-right { right: 20px; bottom: 90px; }
.ssf-window.bottom-left { left: 20px; bottom: 90px; }

@media (max-width: 480px) {
  .ssf-window {
    right: 10px !important;
    left: 10px !important;
    bottom: 84px !important;
    width: auto !important;
    height: 70vh !important;
    max-height: 70vh;
  }
}

.ssf-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--ssf-primary, #2563eb);
  color: #fff;
  flex-shrink: 0;
}
.ssf-header img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.ssf-header-titles { flex: 1; min-width: 0; }
.ssf-header-title { font-weight: 600; font-size: 15px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssf-header-subtitle { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssf-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .9;
}
.ssf-close-btn:hover { opacity: 1; }

.ssf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ssf-secondary, #fff);
}

.ssf-msg { display: flex; flex-direction: column; max-width: 82%; }
.ssf-msg.user { align-self: flex-end; align-items: flex-end; }
.ssf-msg.bot { align-self: flex-start; align-items: flex-start; }

.ssf-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ssf-msg.user .ssf-bubble {
  background: var(--ssf-primary, #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ssf-msg.bot .ssf-bubble {
  background: #f1f3f5;
  color: var(--ssf-text, #1f2937);
  border-bottom-left-radius: 4px;
}
.ssf-msg.error .ssf-bubble {
  background: #fee2e2;
  color: #991b1b;
}
.ssf-bubble p { margin: 0 0 6px 0; }
.ssf-bubble p:last-child { margin-bottom: 0; }
.ssf-bubble code {
  background: rgba(0,0,0,.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}
.ssf-bubble pre {
  background: rgba(0,0,0,.08);
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 12.5px;
}
.ssf-bubble a { color: inherit; text-decoration: underline; }
.ssf-bubble strong { font-weight: 700; }
.ssf-bubble ul, .ssf-bubble ol { padding-left: 18px; margin: 0 0 6px 0; }

.ssf-timestamp {
  font-size: 10.5px;
  color: #9ca3af;
  margin-top: 3px;
  padding: 0 4px;
}

.ssf-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #f1f3f5;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}
.ssf-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: ssf-bounce 1.2s infinite ease-in-out;
}
.ssf-typing span:nth-child(2) { animation-delay: .15s; }
.ssf-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ssf-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ssf-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  background: var(--ssf-secondary, #fff);
  flex-shrink: 0;
}
.ssf-input {
  flex: 1;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  max-height: 100px;
  outline: none;
  color: var(--ssf-text, #1f2937);
  background: #fff;
}
.ssf-input:focus { border-color: var(--ssf-primary, #2563eb); }
.ssf-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--ssf-primary, #2563eb);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ssf-send-btn:disabled { opacity: .5; cursor: not-allowed; }
.ssf-send-btn svg { width: 18px; height: 18px; }

/* Tema escuro */
.ssf-window.ssf-theme-dark { background: #1f2937; }
.ssf-window.ssf-theme-dark .ssf-messages { background: #1f2937; }
.ssf-window.ssf-theme-dark .ssf-msg.bot .ssf-bubble { background: #374151; color: #f3f4f6; }
.ssf-window.ssf-theme-dark .ssf-input-bar { background: #1f2937; border-top-color: #374151; }
.ssf-window.ssf-theme-dark .ssf-input { background: #374151; border-color: #4b5563; color: #f3f4f6; }
.ssf-window.ssf-theme-dark .ssf-typing { background: #374151; }
.ssf-window.ssf-theme-dark .ssf-typing span { background: #9ca3af; }

.ssf-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 0;
  background: var(--ssf-secondary, #fff);
  border-top: 1px solid #e5e7eb;
}
.ssf-footer img { max-height: 20px; max-width: 120px; object-fit: contain; opacity: .85; }
.ssf-window.ssf-theme-dark .ssf-footer { background: #1f2937; border-top-color: #374151; }

.ssf-messages::-webkit-scrollbar { width: 6px; }
.ssf-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
