/* Silver AI Support Bot — chat widget for nicsilver.com
 * Floating button bottom-right, expandable chat panel.
 * Self-contained styles. No framework dependency. Inherits Playfair + Inter
 * already loaded by the host page.
 */

.sai-widget-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--coral, #f24b2e);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.sai-widget-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.sai-widget-launcher:focus-visible {
  outline: 3px solid #c17817;
  outline-offset: 2px;
}

.sai-widget-launcher svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sai-widget-launcher .sai-badge-new {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c17817;
  border: 2px solid #fff;
  animation: sai-pulse 2.4s ease-in-out infinite;
}

@keyframes sai-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.75; }
}

.sai-widget-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #faf7f4;
  border: 1px solid #e8e2de;
  border-radius: 4px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  z-index: 9999;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: #3d2b1f;
  overflow: hidden;
}

.sai-widget-panel.sai-open {
  display: flex;
  animation: sai-slide-in 0.18s ease-out;
}

@keyframes sai-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.sai-widget-header {
  background: #3d2b1f;
  color: #f5f1ee;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sai-widget-header-title {
  font-family: "Playfair Display", ui-serif, Georgia, serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sai-widget-header-sub {
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 241, 238, 0.6);
  margin-top: 2px;
}

.sai-widget-close {
  background: transparent;
  border: none;
  color: rgba(245, 241, 238, 0.7);
  cursor: pointer;
  padding: 4px;
  font-family: inherit;
}

.sai-widget-close:hover {
  color: #fff;
}

.sai-widget-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.sai-widget-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #faf7f4;
}

.sai-msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.sai-msg-bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e8e2de;
  color: #3d2b1f;
}

.sai-msg-user {
  align-self: flex-end;
  background: #f24b2e;
  color: #fff;
}

.sai-msg-system {
  align-self: center;
  background: transparent;
  color: #8b7b6e;
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 4px 0;
}

.sai-msg-error {
  align-self: stretch;
  background: rgba(242, 75, 46, 0.08);
  border: 1px solid rgba(242, 75, 46, 0.3);
  color: #d63d22;
  font-size: 13px;
}

.sai-typing {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e8e2de;
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.sai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b7b6e;
  opacity: 0.4;
  animation: sai-typing 1.2s infinite;
}

.sai-typing span:nth-child(2) { animation-delay: 0.2s; }
.sai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sai-typing {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.sai-book-pill {
  align-self: flex-start;
  background: #c17817;
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.sai-book-pill:hover {
  background: #a06414;
}

.sai-widget-footer {
  border-top: 1px solid #e8e2de;
  padding: 10px 12px;
  background: #ffffff;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.sai-input {
  flex: 1;
  resize: none;
  border: 1px solid #e8e2de;
  border-radius: 3px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  color: #3d2b1f;
  background: #faf7f4;
  max-height: 100px;
  min-height: 38px;
}

.sai-input:focus {
  outline: 2px solid #f24b2e;
  outline-offset: -1px;
  border-color: #f24b2e;
}

.sai-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sai-send {
  background: #f24b2e;
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 0 14px;
  height: 38px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sai-send:hover:not(:disabled) {
  background: #d63d22;
}

.sai-send:disabled {
  background: #d4cdc7;
  cursor: not-allowed;
}

.sai-disclaimer {
  font-size: 10px;
  color: #8b7b6e;
  text-align: center;
  padding: 6px 12px 8px;
  border-top: 1px solid #f0ece8;
  background: #ffffff;
  line-height: 1.4;
}

.sai-disclaimer a {
  color: #c17817;
  text-decoration: none;
}

@media (max-width: 480px) {
  .sai-widget-panel {
    right: 8px;
    left: 8px;
    bottom: 78px;
    width: auto;
    max-width: none;
  }
  .sai-widget-launcher {
    right: 16px;
    bottom: 16px;
  }
}
