/* ============================================================
   Panorama PRO — Explorador de Mercado (Perspective) e
   gráfico interativo do resumo da moeda (Lightweight Charts)
   ============================================================ */

/* ---------- Explorador de Mercado ---------- */
#market-explorer .mx-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
#market-explorer .mx-sub { margin: 6px 0 0 16px; font-size: 11px; color: #6b7280; }
#market-explorer .mx-ao-vivo { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 2px 8px; border-radius: 999px;
    font-size: 9px; letter-spacing: .14em; color: #34d399; background: rgba(16, 185, 129, .1); border: 1px solid rgba(16, 185, 129, .25); }
#market-explorer .mx-ao-vivo i { width: 6px; height: 6px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); animation: mx-pulso 1.8s infinite; }
@keyframes mx-pulso { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

#market-explorer .mx-acoes { display: flex; gap: 8px; }
#market-explorer .mx-acoes button,
#market-explorer .mx-rodape button {
    font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #fff;
    padding: 6px 12px; border-radius: 6px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); transition: background .2s, border-color .2s;
}
#market-explorer .mx-acoes button:hover,
#market-explorer .mx-rodape button:hover { background: rgba(251, 191, 36, .12); border-color: rgba(251, 191, 36, .4); }

#market-explorer .mx-presets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: thin; }
#market-explorer .mx-presets button {
    flex: none; font-size: 11px; font-weight: 600; color: #9ca3af; padding: 7px 12px; border-radius: 8px;
    background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .07); transition: color .2s, background .2s, border-color .2s;
}
#market-explorer .mx-presets button:hover { color: #fff; border-color: rgba(251, 191, 36, .35); }
#market-explorer .mx-presets button.ativo { color: #111; background: linear-gradient(135deg, #fcd34d, #f59e0b); border-color: #f59e0b; }

#market-explorer .mx-palco { position: relative; height: min(70vh, 640px); min-height: 420px; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .06); background: #0b0f16; }
#market-explorer perspective-viewer {
    position: absolute; inset: 0; width: 100%; height: 100%;
    --plugin--background: #0b0f16;
    --interface-monospace--font-family: "JetBrains Mono", ui-monospace, monospace;
    --theme-name: "Pro Dark";
}
/* esqueleto de carregamento até o Perspective ficar pronto */
#market-explorer .mx-carregando { position: absolute; inset: 0; display: grid; gap: 10px; align-content: start; padding: 16px; pointer-events: none; transition: opacity .4s; }
#market-explorer .mx-carregando span,
#market-explorer .mx-carregando::before,
#market-explorer .mx-carregando::after { content: ""; display: block; height: 14px; border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,.03) 0%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.03) 100%); background-size: 200% 100%; animation: mx-brilho 1.4s linear infinite; }
#market-explorer .mx-carregando span { height: 300px; }
@keyframes mx-brilho { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#market-explorer.mx-pronto .mx-carregando { opacity: 0; }

#market-explorer .mx-rodape { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; font-size: 10.5px; color: #6b7280; font-family: "JetBrains Mono", monospace; }
#market-explorer .mx-erro { color: #f87171; }

@media (max-width: 640px) {
    #market-explorer .mx-palco { height: 70vh; min-height: 380px; }
    #market-explorer .mx-sub { margin-left: 0; }
}

/* ---------- Resumo da moeda: gráfico interativo (Lightweight Charts) ---------- */
.ir-spark.ir-spark--lwc { height: 230px; margin: -6px 0 16px; background-image: none; }
.ir-spark--lwc .ir-lwc-chart { position: absolute; left: 0; right: 0; top: 30px; bottom: 0; }
.ir-lwc-barra { position: absolute; left: 0; right: 0; top: 4px; display: flex; align-items: center; gap: 4px; z-index: 3; }
.ir-lwc-barra button { font: 700 9.5px/1 "JetBrains Mono", monospace; letter-spacing: .08em; color: #8b93a1; padding: 5px 7px; border-radius: 4px; border: 1px solid transparent; background: transparent; cursor: pointer; }
.ir-lwc-barra button:hover { color: #fff; border-color: rgba(255, 255, 255, .15); }
.ir-lwc-barra button.ativo { color: #111; background: #f59e0b; }
.ir-lwc-var { margin-left: auto; font: 700 10.5px/1 "JetBrains Mono", monospace; }
.ir-lwc-dica { position: absolute; z-index: 4; pointer-events: none; padding: 6px 8px; border-radius: 6px; background: rgba(10, 14, 20, .94); border: 1px solid rgba(255, 255, 255, .12);
    font: 11px/1.35 "JetBrains Mono", monospace; color: #e5e7eb; white-space: nowrap; display: none; box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.ir-lwc-dica b { color: #fff; }
.ir-lwc-dica small { display: block; color: #8b93a1; }
.ir-lwc-msg { position: absolute; inset: 30px 0 0; display: grid; place-items: center; font: 10px "JetBrains Mono", monospace; color: #8b93a1; z-index: 2; }

/* ---------- Gráfico do ativo clicado no explorador (brasil, eua, ouro) ---------- */
#market-explorer .mxd { position: relative; height: 420px; margin-top: 14px; border-radius: 10px; border: 1px solid rgba(251, 191, 36, .18); background: #0b0f16; overflow: hidden; animation: mxd-entra .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes mxd-entra { from { opacity: 0; transform: translateY(8px); } }
#market-explorer .mxd-topo { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
#market-explorer .mxd-nome b { color: #fff; font-size: 14px; }
#market-explorer .mxd-nome span { margin-left: 8px; font: 11px "JetBrains Mono", monospace; color: #fbbf24; }
#market-explorer .mxd-preco b { font: 700 15px "JetBrains Mono", monospace; color: #fff; }
#market-explorer .mxd-preco span { margin-left: 8px; font: 11px "JetBrains Mono", monospace; }
#market-explorer .mxd-periodos { display: flex; gap: 4px; margin-left: auto; }
#market-explorer .mxd-periodos button { font: 700 10px "JetBrains Mono", monospace; color: #8b93a1; padding: 5px 8px; border-radius: 5px; }
#market-explorer .mxd-periodos button:hover { color: #fff; background: rgba(255, 255, 255, .06); }
#market-explorer .mxd-periodos button.ativo { color: #111; background: #f59e0b; }
#market-explorer .mxd-fechar { width: 26px; height: 26px; border-radius: 6px; color: #6b7280; }
#market-explorer .mxd-fechar:hover { color: #fff; background: rgba(255, 255, 255, .08); }
#market-explorer .mxd-legenda { position: absolute; left: 12px; top: 58px; z-index: 3; font: 10.5px "JetBrains Mono", monospace; color: #9ca3af; pointer-events: none; }
#market-explorer .mxd-grafico { position: absolute; left: 0; right: 0; top: 76px; bottom: 0; }
#market-explorer .mxd-msg { position: absolute; inset: 52px 0 0; display: grid; place-items: center; font: 11px "JetBrains Mono", monospace; color: #9ca3af; z-index: 4; background: rgba(11, 15, 22, .6); }
#market-explorer .mxd-up { color: #00d26a; }
#market-explorer .mxd-down { color: #ff433d; }
@media (max-width: 640px) {
    #market-explorer .mxd { height: 380px; }
    #market-explorer .mxd-periodos { margin-left: 0; width: 100%; justify-content: space-between; }
    #market-explorer .mxd-legenda { top: 92px; }
    #market-explorer .mxd-grafico { top: 108px; }
    #market-explorer .mxd-msg { inset: 86px 0 0; }
}

/* o display:grid acima não pode anular o atributo hidden */
#market-explorer .mxd-msg[hidden], .ir-lwc-msg[hidden] { display: none; }
