/* Shadow DOM styles for Shluha AI widget */

:host, #shluha-ai-widget-host { all: initial; }

.sai-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2147483647;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.sai-fab {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: var(--sai-fab,#111827);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.sai-fab:hover { filter: brightness(1.05); }
.sai-fab:active { transform: translateY(1px); }

.sai-fab-text {
  font-weight: 700;
  letter-spacing: 0.3px;
  font-size: 14px;
}

.sai-fab-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,0.18);
}

.sai-panel {
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100vw - 36px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--sai-surface,#ffffff);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.22);
  position: absolute;
  right: 0;
  bottom: 70px;
  overflow: hidden;
  display: none;
  border: 1px solid rgba(0,0,0,0.08);
}

.sai-panel.is-open { display: flex; }

.sai-head {
  flex: 0 0 auto;
  background: var(--sai-text,#0f172a);
  color: #fff;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sai-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sai-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  opacity: 0.9;
}

.sai-clear:hover { background: rgba(255,255,255,0.12); opacity: 1; }

.sai-title {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
}

.sai-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}

.sai-close:hover { background: rgba(255,255,255,0.12); }

.sai-body {
  padding: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
overflow: auto;
  background: #f8fafc;
}

.sai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 0 12px;
}

.sai-qbtn {
  appearance: none;
  border: 1px solid var(--sai-border, rgba(0,0,0,0.14));
  background: rgba(0,0,0,0.03);
  color: var(--sai-text,#0f172a);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.sai-qbtn:hover { filter: brightness(1.02); }


.sai-msg {
  display: flex;
  margin: 10px 0;
}

.sai-user { justify-content: flex-end; }
.sai-ai { justify-content: flex-start; }

.sai-bubble {
  max-width: 86%;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.sai-user .sai-bubble {
  background: var(--sai-fab,#111827);
  color: #fff;
  border-color: rgba(255,255,255,0.12);
}

.sai-text {
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.sai-foot {
  flex: 0 0 auto;
  padding: 10px;
  background: var(--sai-surface,#ffffff);
  border-top: 1px solid rgba(0,0,0,0.08);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 10px;
  align-items: stretch;
  box-sizing: border-box;
}

.sai-disclaimer {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 11px;
  line-height: 1.25;
  color: var(--sai-muted, rgba(0,0,0,0.55));
  opacity: 0.85;
}


.sai-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  resize: none;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--sai-border, rgba(0,0,0,0.14));
  outline: none;
  font-size: 13px;
  line-height: 1.3;
}

.sai-input:focus {
  border-color: rgba(59,130,246,0.8);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.12);
}

.sai-send {
  appearance: none;
  box-sizing: border-box;
  min-width: 92px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--sai-primary,#2563eb);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sai-send:hover { filter: brightness(1.03); }
.sai-send:disabled { opacity: 0.6; cursor: not-allowed; }

.sai-small {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--sai-muted,#64748b);
  background: var(--sai-surface,#ffffff);
  border-top: 1px solid rgba(0,0,0,0.06);
}

.sai-citations {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0,0,0,0.14);
}

.sai-user .sai-citations {
  border-top-color: rgba(255,255,255,0.22);
}

.sai-citations-title {
  font-size: 11px;
  opacity: 0.85;
  margin-bottom: 6px;
}

.sai-cite {
  display: block;
  font-size: 12px;
  line-height: 1.25;
  text-decoration: none;
  color: var(--sai-primary,#2563eb);
  margin: 4px 0;
  word-break: break-word;
}

.sai-user .sai-cite { color: #93c5fd; }
.sai-cite:hover { text-decoration: underline; }


/* typing indicator */
.sai-typing .sai-bubble{opacity:.85}
.sai-typing .sai-text{font-style:italic;opacity:.75}
@keyframes saiPulse{0%{opacity:.45}50%{opacity:.9}100%{opacity:.45}}
.sai-typing .sai-text{animation:saiPulse 1.2s ease-in-out infinite}
