/* Superset AI Widget - 浮动按钮 + 侧栏 + 设置弹窗 */

#sai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #20a7c9;
  color: #fff;
  font-size: 28px;
  border: none;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
#sai-fab:hover { transform: scale(1.08); }

#sai-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  width: 420px;
  max-width: calc(100vw - 48px);
  height: 70vh;
  max-height: 720px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  z-index: 9998;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

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

.sai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #20a7c9;
  color: #fff;
  font-weight: 600;
}
.sai-header-actions { display: flex; gap: 8px; }
.sai-icon-btn {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
}
.sai-icon-btn:hover { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sai-body { flex: 1; overflow-y: auto; padding: 16px; background: #fafafa; }

.sai-msg { margin-bottom: 12px; }
.sai-msg-user, .sai-msg-bot {
  padding: 10px 14px;
  border-radius: 10px;
  max-width: 85%;
  word-break: break-word;
}
.sai-msg-user {
  background: #20a7c9;
  color: #fff;
  margin-left: auto;
}
.sai-msg-bot {
  background: #fff;
  color: #333;
  border: 1px solid #e0e0e0;
}

.sai-footer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e0e0e0;
}
.sai-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.sai-input:focus { border-color: #20a7c9; }
.sai-send-btn {
  padding: 8px 16px;
  background: #20a7c9;
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.sai-send-btn:disabled { background: #ccc; cursor: not-allowed; }

/* 设置面板 */
#sai-settings {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
#sai-settings.open { display: flex; }

.sai-modal {
  background: #fff;
  border-radius: 12px;
  width: 600px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}
.sai-modal h2 { margin-top: 0; }
.sai-modal h3 {
  margin: 20px 0 8px 0;
  font-size: 15px;
  color: #666;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}

.sai-field { margin-bottom: 12px; }
.sai-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: #555;
}
.sai-field input,
.sai-field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.sai-btn-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.sai-btn {
  padding: 8px 18px;
  border-radius: 6px;
  border: 0;
  cursor: pointer;
  font-size: 14px;
}
.sai-btn-primary { background: #20a7c9; color: #fff; }
.sai-btn-secondary { background: #eee; color: #333; }

.sai-status {
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}
.sai-status.ok { background: #e6f7e6; color: #2d7a2d; border: 1px solid #b5e0b5; display: block; }
.sai-status.err { background: #fde8e8; color: #b32a2a; border: 1px solid #f0b5b5; display: block; }

.sai-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.sai-preset {
  padding: 4px 10px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
}
.sai-preset:hover { background: #e0e0e0; }
