/* ============================================================
   aqb_console_embed
   ------------------------------------------------------------
   Two concerns in this file:

   1. Host-page styles (.aqbc-embed-wrap, .aqbc-embed-iframe,
      .aqbc-embed-guest*) — applied to whatever Web Page hosts
      the aqb_console_embed Web Template block.

   2. In-iframe toggles (.aqbc-embed-mode[data-show-*])  — applied
      *inside* the iframe; live alongside the existing portal
      styles in the same bundle.
   ============================================================ */

/* ── 1. Host-page wrapper + guest placeholder ──────────────── */

.aqbc-embed-wrap {
    width: 100%;
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: var(--aqb-radius-card);
    background: var(--aqb-card);
    box-shadow: var(--aqb-shadow);
}

.aqbc-embed-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.aqbc-embed-guest {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    padding: 2rem;
    text-align: center;
    background: var(--aqb-surface-header);
    color: var(--aqb-text-strong);
}

.aqbc-embed-guest-img {
    max-width: 60%;
    max-height: 60%;
    object-fit: contain;
    opacity: 0.85;
}

.aqbc-embed-guest-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.aqbc-embed-guest-text {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--aqb-text);
}

.aqbc-embed-guest-cta {
    min-width: 9rem;
}

/* ── 2. In-iframe component toggles ────────────────────────── */

/* Embed mode runs without the site chrome and without the aqb_console
   top-bar; collapse the outer padding so the chat fills the iframe. */
.aqb-console-portal.aqbc-embed-mode {
    padding: 0;
    margin: 0;
    height: 100vh;
}

/* Full height chain: the iframe body → the portal wrapper → the chat
   container → the main column → the messages area must ALL be able to
   shrink to their parent. Without min-height:0 at every flex step,
   flex-1 falls back to min-content and the whole thing overflows.
   `:has()` walks up to html/body since we can't add classes there. */
html:has(> body .aqb-console-portal.aqbc-embed-mode),
body:has(> .aqb-console-portal.aqbc-embed-mode),
body:has(.aqb-console-portal.aqbc-embed-mode) {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    margin: 0;
}
.aqb-console-portal.aqbc-embed-mode {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.aqb-console-portal.aqbc-embed-mode .aqbc-chat-container {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: 100%;
    border-radius: 0;
    border: 0;
}
.aqb-console-portal.aqbc-embed-mode .aqbc-main {
    min-height: 0;       /* let the flex column shrink */
}
.aqb-console-portal.aqbc-embed-mode .aqbc-messages {
    min-height: 0;       /* let flex-1 actually be constrained */
    overflow-y: auto;
}
.aqb-console-portal.aqbc-embed-mode .aqbc-input-area {
    flex: 0 0 auto;      /* pin the composer to the bottom */
}
/* Welcome hero eats vertical space and pushes the input off screen
   on tight tiles. Shrink it heavily in embed-mode. */
.aqb-console-portal.aqbc-embed-mode .aqbc-welcome {
    padding: 12px 8px !important;
}
.aqb-console-portal.aqbc-embed-mode .aqbc-welcome .aqbc-title {
    font-size: 1rem;
    margin: 0 0 4px;
}
.aqb-console-portal.aqbc-embed-mode .aqbc-welcome .aqbc-subtitle {
    font-size: 0.85rem;
    margin: 0;
}
/* Header pickers keep their default padding — trim them so the
   remaining height goes to messages. */
.aqb-console-portal.aqbc-embed-mode .aqbc-chat-header {
    padding: 6px 10px;
}

/* Sidebar (Recent / New Chat) */
.aqb-console-portal[data-show-sidebar="0"] .aqbc-sidebar {
    display: none !important;
}

/* Header pickers */
.aqb-console-portal[data-show-llm-picker="0"] #aqbc-llm-select {
    display: none !important;
}
.aqb-console-portal[data-show-project-picker="0"] #aqbc-project-select {
    display: none !important;
}

/* Input row (composer + mic) */
.aqb-console-portal[data-show-input="0"] .aqbc-input-area {
    display: none !important;
}

/* In-input toolbar (mic, attachments etc.) — keep the textarea, drop the actions column */
.aqb-console-portal[data-show-toolbar="0"] .aqbc-input-actions {
    display: none !important;
}
