/* ==========================================================
   EPC — Mapa de Questões
   Versão layout corrigido
   Escopado em .epc-mq para não afetar Astra/WooCommerce
   ========================================================== */

.epc-mq {
  --epc-mq-navy: #0b2447;
  --epc-mq-navy-deep: #07142a;
  --epc-mq-blue: #1f5fa8;
  --epc-mq-blue-2: #2f6eaf;
  --epc-mq-blue-soft: #eaf4ff;
  --epc-mq-orange: #EB1D36;
  --epc-mq-green: #16a34a;
  --epc-mq-green-soft: #e9f9ef;
  --epc-mq-red: #EB1D36;
  --epc-mq-red-soft: #fff1f1;
  --epc-mq-text: #172033;
  --epc-mq-muted: #65758b;
  --epc-mq-border: #dbe4ef;
  --epc-mq-bg: #f6f9fc;
  --epc-mq-card: #ffffff;
  --epc-mq-shadow: 0 18px 45px rgba(11, 36, 71, 0.10);
  --epc-mq-shadow-soft: 0 12px 30px rgba(11, 36, 71, 0.07);
  --epc-mq-radius: 18px;

  width: 100%;
  max-width: 1496px;
  margin: 0 auto;
  padding: 0 24px 56px;
  color: var(--epc-mq-text);
  font-family: inherit;
}

.epc-mq *,
.epc-mq *::before,
.epc-mq *::after {
  box-sizing: border-box;
}

/* ==========================================================
   Hero
   ========================================================== */

.epc-mq-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  margin: 0 0 24px;
  padding: 42px 48px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.16), transparent 34%),
    linear-gradient(135deg, var(--epc-mq-navy), #123d72 58%, #2f5f99);
  color: #ffffff;
  box-shadow: var(--epc-mq-shadow);
  overflow: hidden;
}

.epc-mq-eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.epc-mq-hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(2.2rem, 4vw, 3.45rem);
  line-height: 1.02;
  font-weight: 900;
}

.epc-mq-subtitle {
  max-width: 780px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.02rem;
  line-height: 1.55;
}

.epc-mq-hero-badge {
  flex: 0 0 auto;
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

/* ==========================================================
   Layout principal
   Sidebar + conteúdo
   ========================================================== */

.epc-mq-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1200px);
  gap: 24px;
  align-items: start;
  justify-content: center;
  width: 100%;
}

.epc-mq-main {
  width: 100%;
  max-width: 1200px;
  min-width: 0;
}

.epc-mq-sidebar,
.epc-mq-table-card,
.epc-mq-kpi-card {
  border: 1px solid var(--epc-mq-border);
  background: var(--epc-mq-card);
  border-radius: var(--epc-mq-radius);
  box-shadow: var(--epc-mq-shadow-soft);
}

.epc-mq-sidebar {
  position: sticky;
  top: 110px;
  width: 100%;
  padding: 18px;
  align-self: start;
}

.epc-mq-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.epc-mq-sidebar h2,
.epc-mq-table-card h2 {
  margin: 0;
  color: var(--epc-mq-navy);
  font-size: 1.05rem;
  line-height: 1.2;
  font-weight: 900;
}

.epc-mq-clear {
  appearance: none;
  border: 1px solid var(--epc-mq-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--epc-mq-blue);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 8px 10px;
  line-height: 1;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.epc-mq-clear:hover,
.epc-mq-clear:focus-visible {
  border-color: var(--epc-mq-blue);
  background: var(--epc-mq-blue-soft);
  color: var(--epc-mq-navy);
  transform: translateY(-1px);
}

/* ==========================================================
   Campos dos filtros
   ========================================================== */

.epc-mq-field {
  display: block;
  margin-bottom: 12px;
}

.epc-mq-field span {
  display: block;
  margin-bottom: 6px;
  color: var(--epc-mq-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.epc-mq-field input,
.epc-mq-field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--epc-mq-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--epc-mq-text);
  font: inherit;
  font-size: 0.91rem;
  padding: 9px 11px;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.epc-mq-field input::placeholder {
  color: #9aa8bb;
}

.epc-mq-field input:focus,
.epc-mq-field select:focus {
  border-color: var(--epc-mq-blue);
  box-shadow: 0 0 0 4px rgba(31, 95, 168, 0.12);
}

/* ==========================================================
   Status
   ========================================================== */

.epc-mq-status {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--epc-mq-border);
  border-radius: 14px;
  background: var(--epc-mq-blue-soft);
  color: var(--epc-mq-navy);
  font-size: 0.91rem;
  font-weight: 700;
}

.epc-mq-status.is-visible {
  display: block;
}

.epc-mq-status.is-error {
  border-color: rgba(220, 38, 38, 0.22);
  background: var(--epc-mq-red-soft);
  color: #8a1f1f;
}

/* ==========================================================
   KPIs
   ========================================================== */

.epc-mq-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  margin-bottom: 18px;
}

.epc-mq-kpi-card {
  min-height: 104px;
  padding: 18px;
  border-left: 5px solid var(--epc-mq-blue);
}

.epc-mq-kpi-card span {
  display: block;
  color: var(--epc-mq-muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.epc-mq-kpi-card strong {
  display: block;
  margin-top: 10px;
  color: var(--epc-mq-navy);
  font-size: clamp(1.55rem, 2.4vw, 2.2rem);
  line-height: 1;
  font-weight: 950;
}

.epc-mq-kpi-card--covered {
  border-left-color: var(--epc-mq-green);
}

.epc-mq-kpi-card--percent {
  border-left-color: var(--epc-mq-orange);
}

/* ==========================================================
   Tabela
   ========================================================== */

.epc-mq-table-card {
  width: 100%;
  overflow: hidden;
}

.epc-mq-table-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--epc-mq-border);
}

.epc-mq-table-header p {
  margin: 5px 0 0;
  color: var(--epc-mq-muted);
  font-size: 0.92rem;
}

.epc-mq-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.epc-mq-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #ffffff;
}

.epc-mq-table th,
.epc-mq-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--epc-mq-border);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}

.epc-mq-table th {
  background: #f8fbff;
  color: var(--epc-mq-navy);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.epc-mq-table tbody tr:hover {
  background: #fbfdff;
}

.epc-mq-table td:nth-child(1) {
  width: 25%;
}

.epc-mq-table td:nth-child(2) {
  width: 12%;
}

.epc-mq-table td:nth-child(3) {
  width: 8%;
  text-align: center;
}

.epc-mq-table td:nth-child(4) {
  width: 12%;
}

.epc-mq-table td:nth-child(5) {
  width: 22%;
}

.epc-mq-table td:nth-child(6) {
  width: 17%;
}

.epc-mq-table td:nth-child(7) {
  width: 4%;
  text-align: center;
}

.epc-mq-topic-title {
  display: block;
  color: var(--epc-mq-navy);
  font-weight: 900;
  line-height: 1.25;
}

.epc-mq-topic-meta,
.epc-mq-small-list,
.epc-mq-coverage-line {
  color: var(--epc-mq-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.epc-mq-topic-meta {
  margin-top: 5px;
}

.epc-mq-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--epc-mq-blue-soft);
  color: var(--epc-mq-navy);
  font-weight: 950;
}

.epc-mq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  margin-bottom: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 950;
  white-space: nowrap;
}

.epc-mq-badge--covered {
  background: var(--epc-mq-green-soft);
  color: #116b34;
}

.epc-mq-badge--uncovered {
  background: var(--epc-mq-red-soft);
  color: #9b1c1c;
}

.epc-mq-course-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--epc-mq-orange);
  color: #ffffff !important;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
  transition:
    transform 0.18s ease,
    filter 0.18s ease,
    box-shadow 0.18s ease;
}

.epc-mq-course-link:hover,
.epc-mq-course-link:focus-visible {
  color: #ffffff !important;
  filter: brightness(0.96);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(249, 115, 22, 0.22);
}

.epc-mq-no-link {
  color: var(--epc-mq-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.epc-mq-empty {
  padding: 26px;
  color: var(--epc-mq-muted);
  text-align: center;
  font-weight: 800;
}

/* ==========================================================
   Responsividade
   ========================================================== */

@media (max-width: 1500px) {
  .epc-mq {
    max-width: 100%;
  }

  .epc-mq-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .epc-mq-main {
    max-width: 100%;
  }
}

@media (max-width: 1280px) {
  .epc-mq {
    padding-left: 20px;
    padding-right: 20px;
  }

  .epc-mq-hero {
    padding: 36px 34px;
  }

  .epc-mq-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .epc-mq-layout {
    grid-template-columns: 245px minmax(0, 1fr);
    gap: 18px;
  }

  .epc-mq-sidebar {
    padding: 16px;
  }

  .epc-mq-table {
    min-width: 920px;
  }
}

@media (max-width: 920px) {
  .epc-mq {
    padding: 0 16px 44px;
  }

  .epc-mq-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 28px 24px;
    border-radius: 20px;
  }

  .epc-mq-layout {
    display: block;
  }

  .epc-mq-sidebar {
    position: static;
    margin-bottom: 20px;
  }

  .epc-mq-main {
    max-width: 100%;
  }

  .epc-mq-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .epc-mq-table {
    min-width: 860px;
  }
}

@media (max-width: 620px) {
  .epc-mq {
    padding: 0 14px 38px;
  }

  .epc-mq-hero {
    padding: 24px 20px;
    border-radius: 18px;
  }

  .epc-mq-hero h1 {
    font-size: clamp(2rem, 12vw, 2.75rem);
  }

  .epc-mq-subtitle {
    font-size: 0.96rem;
  }

  .epc-mq-hero-badge {
    font-size: 0.76rem;
  }

  .epc-mq-sidebar-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .epc-mq-clear {
    width: 100%;
    min-height: 38px;
  }

  .epc-mq-kpis {
    grid-template-columns: 1fr;
  }

  .epc-mq-kpi-card {
    min-height: 92px;
  }

  .epc-mq-table-header {
    padding: 18px;
  }

  .epc-mq-table {
    min-width: 820px;
  }

  .epc-mq-table th,
  .epc-mq-table td {
    padding: 13px 12px;
    font-size: 0.86rem;
  }
}


.epc-mq.is-ms-ready select[data-epc-filter],
.epc-mq.is-ms-ready select[data-epc-coverage-filter] {
  display: none !important;
}

.epc-mq-field--multiselect {
  position: relative;
}

.epc-mq-ms {
  position: relative;
  width: 100%;
}

.epc-mq-ms-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--epc-mq-border);
  border-radius: 12px;
  background: #ffffff;
  color: var(--epc-mq-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.91rem;
  line-height: 1.25;
  padding: 9px 11px;
  text-align: left;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.epc-mq-ms-toggle:hover,
.epc-mq-ms-toggle:focus-visible,
.epc-mq-ms.is-open .epc-mq-ms-toggle {
  border-color: var(--epc-mq-blue);
  box-shadow: 0 0 0 4px rgba(31, 95, 168, 0.12);
}

.epc-mq-ms.has-selection .epc-mq-ms-toggle {
  border-color: rgba(31, 95, 168, 0.58);
  background: #fbfdff;
}

.epc-mq-ms-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.epc-mq-ms-count {
  flex: 0 0 auto;
  min-width: 23px;
  height: 23px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--epc-mq-blue-soft);
  color: var(--epc-mq-navy);
  font-size: 0.74rem;
  font-weight: 950;
  line-height: 23px;
  text-align: center;
}

.epc-mq-ms-arrow {
  flex: 0 0 auto;
  color: var(--epc-mq-muted);
  font-size: 0.85rem;
  transition: transform 0.18s ease;
}

.epc-mq-ms.is-open .epc-mq-ms-arrow {
  transform: rotate(180deg);
}

.epc-mq-ms-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  left: 0;
  width: min(360px, calc(100vw - 48px));
  max-width: 100%;
  border: 1px solid var(--epc-mq-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 20px 48px rgba(11, 36, 71, 0.16);
  overflow: hidden;
}

.epc-mq-sidebar .epc-mq-field:nth-last-child(-n+3) .epc-mq-ms-panel {
  top: auto;
  bottom: calc(100% + 8px);
}

.epc-mq-ms-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--epc-mq-border);
  background: #f8fbff;
}

.epc-mq-ms-search {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--epc-mq-border);
  border-radius: 11px;
  background: #ffffff;
  color: var(--epc-mq-text);
  font: inherit;
  font-size: 0.88rem;
  padding: 8px 10px;
  outline: none;
}

.epc-mq-ms-search:focus {
  border-color: var(--epc-mq-blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 168, 0.10);
}

.epc-mq-ms-actions {
  display: flex;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--epc-mq-border);
  background: #ffffff;
}

.epc-mq-ms-mini {
  appearance: none;
  flex: 1 1 0;
  min-height: 30px;
  border: 1px solid var(--epc-mq-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--epc-mq-blue);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  padding: 7px 8px;
}

.epc-mq-ms-mini:hover,
.epc-mq-ms-mini:focus-visible {
  border-color: var(--epc-mq-blue);
  background: var(--epc-mq-blue-soft);
  color: var(--epc-mq-navy);
}

.epc-mq-ms-options {
  max-height: 260px;
  overflow: auto;
  padding: 6px;
}

.epc-mq-ms-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  margin: 0;
  padding: 9px 8px;
  border-radius: 10px;
  color: var(--epc-mq-text);
  cursor: pointer;
  font-size: 0.86rem;
  line-height: 1.35;
}

.epc-mq-ms-option:hover {
  background: #f4f8fd;
}

.epc-mq-ms-option input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 1px 0 0;
  accent-color: var(--epc-mq-blue);
}

.epc-mq-ms-option span {
  display: block;
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-weight: 650;
  letter-spacing: 0;
}

.epc-mq-ms-option em {
  color: var(--epc-mq-red);
  font-style: normal;
  font-weight: 850;
}

.epc-mq-ms-option.is-unavailable {
  opacity: 0.72;
}

.epc-mq-ms-empty {
  padding: 18px 12px;
  color: var(--epc-mq-muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 920px) {
  .epc-mq-ms-panel {
    position: relative;
    top: auto;
    bottom: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
  }

  .epc-mq-sidebar .epc-mq-field:nth-last-child(-n+3) .epc-mq-ms-panel {
    top: auto;
    bottom: auto;
  }
}

/* ==========================================================
   EPC — Correção Multiselect
   Compatibilização JS/CSS
   ========================================================== */

.epc-mq .epc-mq-ms-panel {
  display: none;
}

.epc-mq .epc-mq-ms.is-open > .epc-mq-ms-panel {
  display: block;
}

.epc-mq .epc-mq-ms-count[hidden],
.epc-mq .epc-mq-ms-empty[hidden],
.epc-mq .epc-mq-ms-option[hidden] {
  display: none !important;
}

.epc-mq .epc-mq-ms-option.is-unavailable {
  opacity: 0.58;
  cursor: not-allowed;
}

.epc-mq .epc-mq-ms-option.is-unavailable:hover {
  background: transparent;
}

.epc-mq .epc-mq-ms-option.is-unavailable span {
  color: var(--epc-mq-muted);
}

.epc-mq .epc-mq-ms-search-wrap {
  display: block;
}

.epc-mq .epc-mq-ms.is-open {
  z-index: 80;
}

.epc-mq .epc-mq-ms-panel {
  z-index: 90;
}

.epc-mq .epc-mq-ms-toggle {
  min-height: 42px;
}

.epc-mq .epc-mq-ms-options {
  scrollbar-width: thin;
}

/* ==========================================================
   EPC — Gráficos do Mapa de Questões
   ========================================================== */

.epc-mq-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  width: 100%;
  margin: 0 0 18px;
}

.epc-mq-chart-card {
  min-width: 0;
  border: 1px solid var(--epc-mq-border);
  border-radius: var(--epc-mq-radius);
  background: var(--epc-mq-card);
  box-shadow: var(--epc-mq-shadow-soft);
  overflow: hidden;
}

.epc-mq-chart-card--wide {
  grid-column: 1 / -1;
}

.epc-mq-chart-head {
  padding: 18px 20px 10px;
}

.epc-mq-chart-head h2 {
  margin: 0;
  color: var(--epc-mq-navy);
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 900;
}

.epc-mq-chart-head p {
  margin: 6px 0 0;
  color: var(--epc-mq-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.epc-mq-chart-box {
  position: relative;
  width: 100%;
  height: 320px;
  padding: 8px 16px 18px;
}

.epc-mq-chart-card--wide .epc-mq-chart-box {
  height: 390px;
}

.epc-mq-chart-box canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 920px) {
  .epc-mq-charts {
    grid-template-columns: 1fr;
  }

  .epc-mq-chart-card--wide {
    grid-column: auto;
  }

  .epc-mq-chart-box,
  .epc-mq-chart-card--wide .epc-mq-chart-box {
    height: 330px;
  }
}

@media (max-width: 620px) {
  .epc-mq-chart-head {
    padding: 16px 16px 8px;
  }

  .epc-mq-chart-box,
  .epc-mq-chart-card--wide .epc-mq-chart-box {
    height: 300px;
    padding: 6px 12px 16px;
  }
}