/* Embeddable dashboard demos — matches dashboard UI, framed for cursor targets */

body.fx-embed-demo {
  overflow: hidden;
  height: 100vh;
  max-height: 100vh;
  min-height: 100vh;
  pointer-events: none;
  user-select: none;
  overscroll-behavior: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  position: relative;
}

/* Same daytime sky + clouds as dashboard / landing */
body.fx-embed-demo .fx-sky-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

body.fx-embed-demo #fx-embed-stage {
  position: relative;
  z-index: 1;
}

/* Glass dashboard UI on top of sky */
body.fx-embed-demo header,
body.fx-embed-demo .form-card,
body.fx-embed-demo .card,
body.fx-embed-demo .fx-chat-sidebar,
body.fx-embed-demo .fx-chat-main {
  background: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-color: rgba(255, 255, 255, 0.65) !important;
  box-shadow: 0 8px 32px rgba(45, 90, 135, 0.08);
}

body.fx-embed-demo .fx-chat-messages {
  background: rgba(250, 251, 252, 0.72) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body.fx-embed-demo .page-title,
body.fx-embed-demo .form-title,
body.fx-embed-demo .card-title {
  color: var(--fx-text, #12121a);
}

/* Override dashboard solid panels — show glass + visible clouds */
body.fx-embed-demo.fx-app-page .form-card,
body.fx-embed-demo.fx-app-page .card,
body.fx-embed-demo.fx-app-page header {
  background: rgba(255, 255, 255, 0.55) !important;
  backdrop-filter: blur(18px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(160%) !important;
}

body.fx-embed-demo.fx-app-page .fx-cloud {
  opacity: 0.92;
}

body.fx-embed-demo.fx-app-page main {
  position: relative;
  z-index: 10;
  background: transparent !important;
}

body.fx-embed-demo.fx-sky .btn-primary,
body.fx-embed-demo .btn-primary {
  background: var(--fx-accent, #12121a) !important;
  color: #fff !important;
  border-color: var(--fx-accent, #12121a) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.fx-embed-demo.fx-sky .btn-secondary,
body.fx-embed-demo .btn-secondary {
  background: var(--fx-bg, #fff) !important;
  color: var(--fx-text, #12121a) !important;
  border: 1px solid var(--fx-border, rgba(0, 0, 0, 0.08)) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.fx-embed-demo .section {
  display: none !important;
}

body.fx-embed-demo.fx-embed-scene-create #section-create,
body.fx-embed-demo.fx-embed-scene-connections #section-connections,
body.fx-embed-demo.fx-embed-scene-chat #section-chat {
  display: block !important;
}

body.fx-embed-demo .fx-embed-extra {
  display: none !important;
}

body.fx-embed-demo.fx-embed-scene-create #section-create .form-group {
  display: block !important;
}

.fx-perm-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.fx-perm-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.fx-perm-option input {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}

.fx-perm-option strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.fx-perm-option small {
  display: block;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.45;
  font-weight: 400;
}

.fx-conn-card .card-footer {
  border-top: none;
  padding-top: 0;
}

.fx-conn-card .card-footer .btn {
  flex: none;
  width: 100%;
}

.fx-conn-card .card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}

.fx-conn-card .card-header .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.fx-conn-card .card-header .card-badge {
  flex-shrink: 0;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  min-height: 22px;
  white-space: nowrap;
  text-align: center;
}

body.fx-embed-demo .btn-signout,
body.fx-embed-demo .fx-settings-gear,
body.fx-embed-demo #link-manage-connections,
body.fx-embed-demo #btn-cancel,
body.fx-embed-demo .form-actions .btn-secondary {
  visibility: hidden;
  pointer-events: none;
}

body.fx-embed-demo #fx-embed-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transform-origin: 0 0;
  will-change: transform;
  width: max-content;
  max-width: 100vw;
  background: transparent;
}

body.fx-embed-demo header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 50;
  flex-shrink: 0;
}

body.fx-embed-demo.fx-embed-has-stage #fx-embed-stage {
  margin-top: var(--fx-nav-h, 72px);
}

body.fx-embed-demo #fx-embed-stage main {
  padding: 20px 28px 28px;
  height: auto;
  max-height: none;
  overflow: visible;
  box-sizing: border-box;
  width: 100%;
}

body.fx-embed-demo.fx-embed-scene-create #fx-embed-stage main,
body.fx-embed-demo.fx-embed-scene-connections #fx-embed-stage main,
body.fx-embed-demo.fx-embed-scene-chat #fx-embed-stage main {
  display: block;
}

body.fx-embed-demo.fx-embed-scene-create #section-create {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

body.fx-embed-demo.fx-embed-scene-create #section-create .form-card {
  max-width: none;
  padding: 24px;
}

body.fx-embed-demo.fx-embed-scene-create .form-title {
  margin-bottom: 16px;
  padding-bottom: 12px;
}

body.fx-embed-demo.fx-embed-scene-create .form-group {
  margin-bottom: 12px;
}

body.fx-embed-demo.fx-embed-scene-create .form-textarea {
  min-height: 72px;
}

body.fx-embed-demo.fx-embed-scene-create #agent-allowed-urls {
  min-height: 64px !important;
}

body.fx-embed-demo.fx-embed-scene-create .fx-perm-option {
  padding: 10px 12px;
}

body.fx-embed-demo.fx-embed-scene-create .form-hint {
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.4;
}

body.fx-embed-demo.fx-embed-scene-create .form-actions {
  margin-top: 4px;
  padding-top: 16px;
}

body.fx-embed-demo.fx-embed-scene-connections #section-connections {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

body.fx-embed-demo.fx-embed-scene-connections #section-connections .page-header .fx-page-desc {
  display: block !important;
}

body.fx-embed-demo.fx-embed-scene-connections .fx-embed-conn-panel {
  margin-bottom: 0;
}

body.fx-embed-demo.fx-embed-scene-connections #oauth-conn-grid.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 0;
}

body.fx-embed-demo.fx-embed-scene-connections .fx-conn-card .card-description {
  font-size: 12px;
  line-height: 1.45;
}

body.fx-embed-demo.fx-embed-scene-connections .fx-conn-card .card-footer .btn {
  font-size: 11px;
  padding: 8px 10px;
  line-height: 1.25;
  white-space: normal;
}

body.fx-embed-demo.fx-embed-scene-chat #section-chat {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

body.fx-embed-demo .fx-embed-chat-layout {
  min-height: 400px;
  height: auto;
  max-height: none;
}

body.fx-embed-demo.fx-embed-scene-chat .fx-chat-main {
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

body.fx-embed-demo.fx-embed-scene-chat .fx-chat-messages {
  flex: 1 1 auto;
  min-height: 240px;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: auto;
}

body.fx-embed-demo.fx-embed-scene-chat .fx-chat-bubble {
  max-width: 92%;
  overflow: visible;
  word-break: break-word;
  overflow-wrap: anywhere;
}

body.fx-embed-demo.fx-embed-scene-chat .fx-chat-compose textarea {
  min-height: 44px;
  max-height: 96px;
  resize: none;
  overflow-y: auto;
  line-height: 1.45;
}

body.fx-embed-demo #section-create .form-card {
  max-width: none;
  margin: 0 auto;
}

.fx-conn-status-connected {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.fx-embed-demo-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  pointer-events: none;
}

.fx-embed-demo-overlay .fx-tutorial-edge-glow {
  display: none !important;
}

.fx-embed-demo-cursor {
  position: fixed;
  z-index: 20002;
  width: 24px;
  height: 24px;
  margin: -2px 0 0 -2px;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
  transition: left 0.7s cubic-bezier(0.33, 1, 0.68, 1),
    top 0.7s cubic-bezier(0.33, 1, 0.68, 1),
    transform 0.12s ease,
    opacity 0.2s ease;
  will-change: left, top;
  opacity: 1;
}

.fx-embed-demo-cursor.is-clicking {
  transform: scale(0.86);
}

.fx-embed-demo-cursor.is-hidden {
  opacity: 0;
}

.fx-embed-demo-flash {
  position: fixed;
  inset: 0;
  z-index: 20001;
  background: rgba(255, 255, 255, 0.35);
  opacity: 0;
  pointer-events: none;
}

.fx-embed-demo-flash.is-on {
  animation: fx-embed-flash 0.35s ease-out;
}

@keyframes fx-embed-flash {
  0% { opacity: 0.12; }
  100% { opacity: 0; }
}

.fx-embed-field-focus .form-input,
.fx-embed-field-focus .form-select,
.fx-embed-field-focus .form-textarea {
  border-color: #156cc2 !important;
  box-shadow: 0 0 0 3px rgba(21, 108, 194, 0.22) !important;
}

.fx-embed-conn-focus.fx-conn-card {
  outline: 3px solid rgba(21, 108, 194, 0.35);
  outline-offset: 2px;
}

.fx-embed-demo-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 20003;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #3d6b5a;
  border-radius: 3px;
  opacity: 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  transition: opacity 0.4s, transform 0.4s cubic-bezier(0.33, 1, 0.68, 1);
}

.fx-embed-demo-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#btn-save.fx-embed-save-pulse {
  box-shadow: 0 0 0 3px rgba(18, 18, 26, 0.25);
}
