/* ========================================================================
   SetubalAI — Floating Chat Widget
   Usa la misma paleta que style.css (root vars ya definidas globalmente)
   ======================================================================== */

.saw-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gold-gradient, linear-gradient(120deg, #c9a227, #f4d03f));
  color: #050508;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 24px rgba(244, 208, 63, 0.35);
  z-index: 99998;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: saw-pulse 2.8s ease-in-out infinite;
}

.saw-bubble:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 32px rgba(244, 208, 63, 0.5);
}

.saw-bubble svg {
  width: 26px;
  height: 26px;
}

.saw-bubble .saw-close-icon { display: none; }
.saw-bubble.saw-open .saw-chat-icon { display: none; }
.saw-bubble.saw-open .saw-close-icon { display: block; }

@keyframes saw-pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(244, 208, 63, 0.35); }
  50% { box-shadow: 0 4px 32px rgba(244, 208, 63, 0.6), 0 0 0 8px rgba(244, 208, 63, 0.08); }
}

.saw-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 140px);
  background: #0a0a10;
  border: 1px solid rgba(240, 241, 245, 0.14);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(244, 208, 63, 0.08);
  z-index: 99999;
  opacity: 0;
  transform: scale(0.92) translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.saw-panel.saw-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.saw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(120deg, rgba(201, 162, 39, 0.14), rgba(244, 208, 63, 0.06));
  border-bottom: 1px solid rgba(240, 241, 245, 0.08);
  flex: 0 0 auto;
}

.saw-header-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.saw-header-title strong {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  color: #f0f1f5;
  letter-spacing: -0.01em;
}

.saw-header-title span {
  font-size: 11.5px;
  color: #a0a5b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.saw-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 6px rgba(45, 212, 191, 0.7);
  display: inline-block;
}

.saw-header-close {
  background: transparent;
  border: none;
  color: #a0a5b8;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.saw-header-close:hover {
  background: rgba(240, 241, 245, 0.08);
  color: #f0f1f5;
}

.saw-header-close svg { width: 16px; height: 16px; }

.saw-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 241, 245, 0.16) transparent;
}

.saw-messages::-webkit-scrollbar { width: 6px; }
.saw-messages::-webkit-scrollbar-thumb {
  background: rgba(240, 241, 245, 0.14);
  border-radius: 3px;
}

.saw-msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  font-family: 'Inter', system-ui, sans-serif;
  animation: saw-msg-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes saw-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.saw-msg-agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(240, 241, 245, 0.08);
  color: #f0f1f5;
  border-bottom-left-radius: 4px;
}

.saw-msg-user {
  align-self: flex-end;
  background: linear-gradient(120deg, rgba(201, 162, 39, 0.9), rgba(244, 208, 63, 0.9));
  color: #050508;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}

.saw-msg-error {
  align-self: center;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #a0a5b8;
  font-size: 12.5px;
  text-align: center;
}

.saw-msg-error a { color: #f4d03f; text-decoration: none; }
.saw-msg-error a:hover { text-decoration: underline; }

.saw-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  max-width: 92%;
  margin-top: 2px;
}

.saw-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(240, 241, 245, 0.14);
  color: #f0f1f5;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.saw-chip:hover {
  background: rgba(244, 208, 63, 0.12);
  border-color: rgba(244, 208, 63, 0.4);
  transform: translateY(-1px);
}

.saw-chip:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.saw-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(240, 241, 245, 0.08);
  border-radius: 14px;
}

.saw-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a0a5b8;
  animation: saw-bounce 1.2s ease-in-out infinite;
}

.saw-typing span:nth-child(2) { animation-delay: 0.15s; }
.saw-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes saw-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.saw-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(240, 241, 245, 0.08);
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.015);
}

.saw-input {
  flex: 1 1 auto;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(240, 241, 245, 0.1);
  border-radius: 999px;
  padding: 10px 15px;
  color: #f0f1f5;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.saw-input::placeholder { color: #6b7084; }
.saw-input:focus { border-color: rgba(244, 208, 63, 0.4); }

.saw-send {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: none;
  background: linear-gradient(120deg, #c9a227, #f4d03f);
  color: #050508;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.saw-send:hover { transform: scale(1.06); }
.saw-send:disabled { opacity: 0.5; cursor: default; transform: none; }
.saw-send svg { width: 16px; height: 16px; }

@media (max-width: 480px) {
  .saw-panel {
    right: 12px;
    left: 12px;
    bottom: 88px;
    width: auto;
    height: calc(100vh - 120px);
    max-height: none;
  }
  .saw-bubble { right: 16px; bottom: 16px; }
}
