/**
 * INSIGHT-EXPLORER-002 — estilos do Insight Explorer para superfícies sem saas.css (ex.: /loja).
 * Variáveis com fallback alinhado ao tema PerfumeOS.
 */
:root {
  --ie-bg: var(--bg, #0a0908);
  --ie-bg2: var(--bg2, #12100e);
  --ie-bg3: var(--bg3, #1a1714);
  --ie-cream: var(--cream, #f3ede3);
  --ie-muted: var(--muted, #8a7d70);
  --ie-gold: var(--gold, #c9a96e);
  --ie-ok: var(--ok, #7a9e7e);
  --ie-danger: var(--danger, #c47a6a);
  --ie-line: var(--line, rgba(243, 237, 227, 0.12));
  --ie-display: var(--display, "Cormorant Garamond", Georgia, serif);
  --ie-font: var(--font, Outfit, system-ui, sans-serif);
}

body.ie-open { overflow: hidden; }
.ie-root { position: relative; z-index: 80; }
.ie-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 5, 4, 0.72);
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 1rem;
  animation: ie-fade 160ms ease-out;
}
@keyframes ie-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ie-modal {
  width: min(920px, 100%);
  max-height: min(92dvh, 920px);
  overflow: auto;
  background: linear-gradient(180deg, var(--ie-bg2), var(--ie-bg));
  border: 1px solid rgba(201, 169, 110, 0.28);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  animation: ie-rise 200ms ease-out;
  color: var(--ie-cream);
  font-family: var(--ie-font);
}
@keyframes ie-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ie-backdrop, .ie-modal { animation: none; }
  .ie-trigger { transition: none; }
}
.ie-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem 1rem;
  border-bottom: 1px solid var(--ie-line);
  position: sticky;
  top: 0;
  background: rgba(18, 16, 14, 0.96);
  z-index: 2;
}
.ie-head-main {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  min-width: 0;
}
.ie-media {
  width: 72px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ie-line);
  flex-shrink: 0;
  background: var(--ie-bg3);
}
.ie-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ie-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ie-muted);
}
.ie-head h2 { margin: 0; font-size: 1.55rem; font-family: var(--ie-display); font-weight: 400; }
.ie-subtitle { margin: 0.35rem 0 0; font-size: 0.88rem; color: var(--ie-muted); }
.ie-period { margin: 0.35rem 0 0; font-size: 0.82rem; color: var(--ie-muted); }
.ie-desc { margin: 0; font-size: 0.95rem; line-height: 1.5; color: var(--ie-cream); white-space: pre-wrap; }
.ie-head-right { text-align: right; position: relative; padding-right: 2.2rem; min-width: 8rem; }
.ie-value {
  font-family: var(--ie-display);
  font-size: 2rem;
  color: var(--ie-gold);
  line-height: 1.1;
}
.ie-delta { font-size: 0.82rem; margin-top: 0.2rem; }
.ie-delta.up { color: var(--ie-ok); }
.ie-delta.down { color: var(--ie-danger); }
.ie-delta.flat { color: var(--ie-muted); }
.ie-close {
  position: absolute;
  top: -0.15rem;
  right: 0;
  border: 1px solid var(--ie-line);
  background: var(--ie-bg3);
  color: var(--ie-cream);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}
.ie-close:hover { border-color: var(--ie-gold); color: var(--ie-gold); }
.ie-body { padding: 1rem 1.35rem 0.5rem; display: flex; flex-direction: column; gap: 1rem; }
.ie-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ie-muted);
  font-family: var(--ie-font);
  font-weight: 500;
}
.ie-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.ie-chart-svg { width: 100%; height: auto; display: block; min-height: 180px; }
.ie-empty {
  padding: 1rem;
  text-align: center;
  color: var(--ie-muted);
  font-size: 0.85rem;
  border: 1px dashed var(--ie-line);
  border-radius: 12px;
}
.ie-comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.55rem;
}
.ie-comp {
  background: var(--ie-bg3);
  border: 1px solid var(--ie-line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ie-comp .muted { font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ie-muted); }
.ie-meta { display: flex; flex-direction: column; gap: 0.45rem; }
.ie-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}
.ie-meta-track {
  height: 0.45rem;
  background: var(--ie-bg3);
  border: 1px solid var(--ie-line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.ie-meta-fill {
  height: 100%;
  background: var(--ie-gold);
  border-radius: 999px;
}
.ie-intel {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--ie-cream);
  font-size: 0.92rem;
  line-height: 1.45;
}
.ie-bar-row {
  display: grid;
  grid-template-columns: minmax(6rem, 28%) 1fr 4.5rem;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.45rem;
}
.ie-bar-label { font-size: 0.78rem; color: var(--ie-muted); }
.ie-bar-track {
  height: 0.45rem;
  background: var(--ie-bg3);
  border: 1px solid var(--ie-line);
  border-radius: 999px;
  overflow: hidden;
}
.ie-bar-fill { height: 100%; background: var(--ie-gold); border-radius: 999px; }
.ie-bar-value { font-size: 0.78rem; text-align: right; }
.ie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-bottom: 0.35rem;
}
.ie-actions a.ie-btn { text-decoration: none; display: inline-flex; align-items: center; }
.ie-btn-primary {
  border-color: rgba(201, 169, 110, 0.55) !important;
  background: rgba(201, 169, 110, 0.16) !important;
  color: var(--ie-gold) !important;
}
.ie-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.35rem 1.2rem;
  border-top: 1px solid var(--ie-line);
  position: sticky;
  bottom: 0;
  background: rgba(18, 16, 14, 0.96);
}
.ie-nav, .ie-exports { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ie-btn {
  border: 1px solid var(--ie-line);
  background: var(--ie-bg3);
  color: var(--ie-cream);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.ie-btn:hover:not(:disabled) { border-color: var(--ie-gold); color: var(--ie-gold); }
.ie-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ie-trigger {
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.ie-trigger:hover,
.ie-trigger:focus-visible {
  border-color: rgba(201, 169, 110, 0.55);
  box-shadow: 0 0 0 1px rgba(201, 169, 110, 0.2);
  transform: translateY(-1px);
  outline: none;
}
@media (max-width: 860px) {
  .ie-grid-2 { grid-template-columns: 1fr; }
  .ie-head { flex-direction: column; }
  .ie-head-right { text-align: left; padding-right: 2.2rem; }
  .ie-bar-row { grid-template-columns: 1fr; }
  .ie-foot { flex-direction: column; align-items: stretch; }
}
@media print {
  .ie-backdrop { position: static; background: none; backdrop-filter: none; padding: 0; }
  .ie-modal { box-shadow: none; border: 0; max-height: none; width: 100%; }
  .ie-close, .ie-foot { display: none !important; }
}
