/* Floating widget loader styles (supports both forge* and william* ids) */
:root {
  --forge-widget-z: 2147483000;
  --william-right: 22px;
}

/* In-page pane (glass) */
.william-pane {
  position: fixed;
  right: 24px;
  top: 120px;
  width: 380px;
  height: 540px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(18,22,40,.92), rgba(10,14,26,.88));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 16px 40px rgba(0,0,0,.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: calc(var(--forge-widget-z) - 1);
  padding: 6px;
  display: none;
}

.william-pane.open {
  display: block;
}

/* Keep pane above the fab so it doesn't cover the send button */
.william-pane {
  bottom: 110px;
  top: auto;
}

.william-pane #william-iframe {
  position: static;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  border: none;
  display: block;
}

#forgeWidgetButton,
#william-fab {
  position: fixed;
  right: var(--william-right);
  bottom: 22px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(20,24,40,.9);
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--forge-widget-z);
}

#forgeWidgetButton img,
#william-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: block;
}

#forgeWidgetFrame,
#william-iframe {
  position: fixed;
  right: calc(var(--william-right) - 4px);
  bottom: 96px;
  width: 380px;
  height: 540px;
  border: none;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  background: transparent;
  z-index: calc(var(--forge-widget-z) - 1);
  display: none;
}

#forgeWidgetFrame.is-open,
#william-iframe.open,
#william-panel.open {
  display: block;
}

#william-panel {
  position: fixed;
  right: calc(var(--william-right) - 4px);
  bottom: 96px;
  width: 380px;
  height: 540px;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  background: transparent;
  z-index: calc(var(--forge-widget-z) - 1);
  display: none;
}

#william-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 4, 12, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: calc(var(--forge-widget-z) - 2);
}

#william-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 520px) {
  #forgeWidgetFrame,
  #william-panel,
  #william-iframe {
    right: 10px;
    left: 10px;
    width: auto;
    height: 70vh;
    bottom: 90px;
  }
}
