/* Copilot IA (chat embed) — chrome do painel flutuante.
 * Carregado via <link> no layout.html. NUNCA inline na shell. */

.notch-copilot-btn i { color: #1E55E8; }

.mad-copilot-panel {
    position: fixed;
    right: 18px; bottom: 18px;
    width: 440px; max-width: calc(100vw - 24px);
    height: min(720px, 82vh);
    background: #15151b;
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .30);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    transition: top .2s ease, left .2s ease, right .2s ease, bottom .2s ease, width .2s ease, height .2s ease;
}
.mad-copilot-panel.open { display: flex; animation: madCopilotIn .18s ease; }
@keyframes madCopilotIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Maximizar: o embed pede via chat:action set_format ao clicar em expandir. */
.mad-copilot-panel.maximized { left: 24px; right: 24px; top: 24px; bottom: 24px; width: auto; height: auto; max-width: 1280px; margin:auto; }

/* Sem header proprio — o iframe (embed) traz o seu. O painel e so a moldura.
 * translateZ(0): camada de compositing propria pro iframe — sem ela o Chromium
 * re-rasteriza o clip arredondado do painel a cada scroll INTERNO do iframe e
 * o painel inteiro pisca (glitch classico de iframe + border-radius). */
.mad-copilot-body { flex: 1 1 auto; min-height: 0; background: #0b0b0f; transform: translateZ(0); }
.mad-copilot-body iframe { border: 0; width: 100%; height: 100%; display: block; }

.mad-copilot-empty { padding: 18px; font-size: 13px; color: #555; line-height: 1.5; background: #fff; height: 100%; box-sizing: border-box; }
.mad-copilot-empty code { background: #eee; padding: 1px 5px; border-radius: 4px; }

@media (max-width: 520px) {
    .mad-copilot-panel { right: 8px; bottom: 8px; left: 8px; width: auto; height: 84vh; }
    .mad-copilot-panel.maximized { left: 8px; right: 8px; top: 8px; bottom: 8px; }
}

/* ============================================================
 * GUARDA: backdrop-filter x iframe cross-origin (Chromium)
 *
 * backdrop-filter em QUALQUER elemento do host + OOPIF (iframe do chat em
 * outra origem) rolando = bug de compositor: camadas sao descartadas e o
 * painel inteiro pisca / fica transparente mostrando a pagina atras.
 *
 * O glassmorphism do tema foi REMOVIDO (notch-menu.css) por causa disso.
 * Esta guarda garante que blur reintroduzido em qualquer lugar (tema novo,
 * mad-ui, pagina gerada) nunca conviva com o copilot aberto
 * (html.mad-copilot-open e setada pelo mad-copilot.js no show/hide).
 * ============================================================ */
html.mad-copilot-open body * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
