/*
 * Chatbot iframe embed wrapper.
 * Used by [chatbot_iframe] shortcode and raw-HTML iframe embeds inside
 * dashboard-grid project pages.
 *
 * Desktop: inline at fixed height set by --ll-chat-embed-height.
 * Mobile (<= 768px): adds an expand button that promotes the wrapper to
 * full-screen fixed overlay via .is-expanded.
 */

.ll-chat-embed {
  position: relative;
  width: 100%;
  height: var(--ll-chat-embed-height, 600px);
  max-height: 85vh;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 4px 4px 0 rgba(0, 113, 64, 0.15);
}

.ll-chat-embed__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* Expand + close buttons — hidden on desktop, shown on mobile.
 * Close button also shown when in expanded state on desktop (fallback). */
.ll-chat-embed__expand,
.ll-chat-embed__close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 113, 64, 0.92);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  z-index: 2;
  transition: background 0.15s ease, transform 0.15s ease;
}

.ll-chat-embed__expand:hover,
.ll-chat-embed__close:hover {
  background: #005a34;
  transform: scale(1.05);
}

.ll-chat-embed__expand:focus-visible,
.ll-chat-embed__close:focus-visible {
  outline: 2px solid #FF9900;
  outline-offset: 2px;
}

@media (max-width: 768px) {
  .ll-chat-embed__expand {
    display: flex;
  }
  .ll-chat-embed.is-expanded .ll-chat-embed__expand {
    display: none;
  }
  .ll-chat-embed.is-expanded .ll-chat-embed__close {
    display: flex;
  }
}

/* Expanded state — promote wrapper to full-viewport overlay. Uses 100dvh so
 * the iOS URL bar doesn't clip the composer. */
.ll-chat-embed.is-expanded {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-height: none;
  border-radius: 0;
  z-index: 10000;
  box-shadow: none;
}

.ll-chat-embed.is-expanded .ll-chat-embed__frame {
  border-radius: 0;
}

/* Body scroll lock while a chat is expanded. */
body.ll-chat-expanded {
  overflow: hidden;
  touch-action: none;
}
