/* sandbox-panel.css
   Shared "sandbox" side panel -- any LFA page that produces output other
   than plain text/voice (an image, generated code/live preview, video)
   opens it here instead of rendering that output inline on the page.
   Include this + sandbox-panel.js on any page that needs it; the panel
   injects its own DOM, so no markup is required in that page's HTML. */

#lfa-sandbox-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: #14171d;
  border-left: 1px solid #2a2e38;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform 0.22s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #f5f5f5;
}

#lfa-sandbox-panel.open {
  transform: translateX(0);
}

#lfa-sandbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

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

@media (min-width: 900px) {
  /* On wide screens the backdrop is unnecessary -- the panel docks
     alongside the page instead of covering it. */
  #lfa-sandbox-backdrop {
    display: none;
  }
}

.lfa-sandbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #2a2e38;
  flex-shrink: 0;
}

.lfa-sandbox-title {
  font-size: 15px;
  font-weight: 600;
}

.lfa-sandbox-close {
  background: transparent;
  border: none;
  color: #a0a0a0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.lfa-sandbox-close:hover {
  background: #1f232c;
  color: #f5f5f5;
}

.lfa-sandbox-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  flex-shrink: 0;
}

.lfa-sandbox-tab {
  background: transparent;
  border: 1px solid #2a2e38;
  color: #a0a0a0;
  border-radius: 14px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.lfa-sandbox-tab.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

.lfa-sandbox-tab.hidden {
  display: none;
}

.lfa-sandbox-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.lfa-sandbox-body img,
.lfa-sandbox-body video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.lfa-sandbox-frame {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 320px;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  background: #fff;
  display: block;
}

.lfa-sandbox-code {
  width: 100%;
  min-height: 320px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  background: #0a0c10;
  border: 1px solid #2a2e38;
  border-radius: 8px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.lfa-sandbox-caption {
  margin-top: 10px;
  font-size: 13px;
  color: #a0a0a0;
}

.lfa-sandbox-empty {
  color: #6b7280;
  font-size: 14px;
  text-align: center;
  padding: 40px 12px;
}

.lfa-sandbox-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.lfa-sandbox-actions a,
.lfa-sandbox-actions button {
  flex: 1;
  text-align: center;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2a2e38;
  background: #1a1d24;
  color: #f5f5f5;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

/* A small floating toggle any page can show if it wants a manual way to
   reopen the panel after the person closes it. Optional -- pages don't
   have to include this element for the panel to work. */
#lfa-sandbox-reopen {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  z-index: 9997;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: none;
}

#lfa-sandbox-reopen.visible {
  display: block;
}
