/* v0.8.3.1 — Responsive Engine Template Integration */
.vce-responsive-cards,
.vce-auto-responsive-cards {
  display: none;
}

.vce-responsive-hint {
  display: none;
  margin: 8px 0 12px;
  font-size: 0.92rem;
  opacity: .78;
}

.vce-ranking-table-wrap,
.vce-comparator-table-wrap,
.vce-comparator-tco-table-wrap,
.vce-table-wrap {
  max-width: 100%;
}

.vce-ranking-table,
.vce-comparator-table,
.vce-comparator-tco-table,
.vce-tco-dynamic-table,
.vce-responsive-source {
  width: 100%;
}

@media (max-width: 1024px) {
  .vce-ranking-table-wrap,
  .vce-comparator-table-wrap,
  .vce-comparator-tco-table-wrap,
  .vce-table-wrap {
    overflow: visible !important;
  }

  .vce-responsive-hint {
    display: block;
  }

  .vce-ranking-table-wrap .vce-ranking-table,
  .vce-comparator-table-wrap .vce-comparator-table,
  .vce-comparator-tco-table-wrap .vce-comparator-tco-table,
  .vce-comparator-tco-table-wrap .vce-tco-dynamic-table,
  .vce-table-wrap table.vce-responsive-source,
  table.vce-responsive-source.vce-responsive-enhanced {
    display: none !important;
  }

  .vce-responsive-cards,
  .vce-auto-responsive-cards {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 14px 0 18px;
  }

  .vce-responsive-card,
  .vce-auto-responsive-card {
    border: 1px solid rgba(120, 130, 150, .25);
    border-radius: 18px;
    padding: 16px;
    background: var(--vce-card-bg, rgba(255,255,255,.92));
    box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
  }

  .vce-responsive-card h3,
  .vce-auto-responsive-card h3 {
    margin: 0 0 10px;
    font-size: 1rem;
    line-height: 1.3;
  }

  .vce-responsive-card h3 a,
  .vce-auto-responsive-card h3 a {
    text-decoration: none;
  }

  .vce-responsive-card dl,
  .vce-auto-responsive-card dl {
    margin: 0;
    display: grid;
    gap: 8px;
  }

  .vce-responsive-card dl > div,
  .vce-auto-responsive-card dl > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(120, 130, 150, .18);
    padding-top: 8px;
  }

  .vce-responsive-card dt,
  .vce-auto-responsive-card dt {
    font-weight: 600;
    opacity: .72;
  }

  .vce-responsive-card dd,
  .vce-auto-responsive-card dd {
    margin: 0;
    font-weight: 700;
    text-align: right;
  }
}

@media (max-width: 680px) {
  .vce-responsive-cards,
  .vce-auto-responsive-cards {
    grid-template-columns: 1fr;
  }

  .vce-responsive-card,
  .vce-auto-responsive-card {
    border-radius: 16px;
    padding: 14px;
  }
}

/* Dark mode/theme guard */
body.dark .vce-responsive-card,
body.dark .vce-auto-responsive-card,
[data-theme="dark"] .vce-responsive-card,
[data-theme="dark"] .vce-auto-responsive-card {
  background: rgba(15, 23, 42, .92);
  border-color: rgba(148, 163, 184, .22);
}


/* v0.8.3.2 — Container-aware overflow fix
   If the visible content column is too narrow for a ranking/cost table, show
   the responsive cards even on desktop widths. This solves WordPress themes
   with sidebars where viewport >1024px but the content area is ~800px. */
.vce-table-overflow-active {
  overflow: visible !important;
}

.vce-table-overflow-active .vce-ranking-table,
.vce-table-overflow-active .vce-comparator-table,
.vce-table-overflow-active .vce-comparator-tco-table,
.vce-table-overflow-active .vce-tco-dynamic-table,
.vce-table-overflow-active table.vce-responsive-source {
  display: none !important;
}

.vce-table-overflow-active + .vce-responsive-cards,
.vce-table-overflow-active + .vce-auto-responsive-cards {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 18px;
}

.vce-table-overflow-active + .vce-responsive-cards .vce-responsive-card,
.vce-table-overflow-active + .vce-auto-responsive-cards .vce-auto-responsive-card {
  border: 1px solid rgba(120, 130, 150, .25);
  border-radius: 18px;
  padding: 16px;
  background: var(--vce-card-bg, rgba(255,255,255,.92));
  box-shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

@media (max-width: 760px) {
  .vce-table-overflow-active + .vce-responsive-cards,
  .vce-table-overflow-active + .vce-auto-responsive-cards {
    grid-template-columns: 1fr;
  }
}

.vce-ranking-table-wrap:not(.vce-table-overflow-active) {
  overflow-x: auto;
}
