/* === SPECS STYLES === */
:root {
  --rvvs-primary: #D70006;
  --rvvs-neutral: #9A9A9A;
  --rvvs-primary-rgb: 215, 0, 6;
}

.rv-specs-wrapper {
  margin: 40px 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.rv-specs-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 30px;
  color: #333;
  padding-bottom: 15px;
  border-bottom: 3px solid var(--rvvs-primary, #D70006);
}

.rv-specs-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rv-spec-row {
  display: flex;
  /* Baseline keeps label/value aligned even when value wraps */
  align-items: baseline;
  padding: 5px 0;
  border-bottom: none;
  transition: background 0.2s ease;
}

.rv-spec-label {
  font-size: 15px;
  color: #666;
  font-weight: 500;
  min-width: 200px;
  flex-shrink: 0;
}

.rv-spec-dots {
  flex-grow: 1;
  height: 1px;
  background: linear-gradient(to right, #e0e0e0 50%, transparent 50%);
  background-size: 8px 1px;
  margin: 0 6px 0 15px;
  opacity: 0.5;
}

.rv-spec-data {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  text-align: right;

  /* Long values (e.g. ECU list) should wrap instead of overflowing */
  min-width: 0;
  max-width: 56%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

/* columns helper (sem mudar layout original) */
.rv-specs-wrapper.rv-columns-1 .rv-spec-label {
  min-width: 240px;
}

/* === OPTIONS STYLES === */
.rv-options-wrapper {
  margin: 40px 0;
}

.rv-options-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 25px;
  color: #333;
}

/* Cards Style */
.rv-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.rv-option-card {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  border-top: none;
  transition: all 0.3s ease;
}

.rv-option-card:hover {
  transform: none;
  box-shadow: none;
}

.rv-option-section {
  font-size: 20px;
  font-weight: 600;
  color: var(--rvvs-primary, #D70006);
  margin-bottom: 15px;
}

.rv-option-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.rv-option-list li {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  font-size: 15px;
}

.rv-option-list li:before {
  content: "✓";
  color: var(--rvvs-primary, #D70006);
  font-weight: bold;
  margin-right: 10px;
  font-size: 16px;
}

.rv-option-list li:last-child {
  border-bottom: none;
}

/* List Style */
.rv-options-list {
  margin-top: 20px;
}

.rv-section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--rvvs-primary, #D70006);
  margin: 20px 0 15px 0;
}

.rv-simple-list {
  list-style: none;
  padding: 0;
  margin: 0 0 30px 0;
}

.rv-simple-list li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}

.rv-simple-list li:last-child {
  border-bottom: none;
}

.rv-check {
  color: var(--rvvs-primary, #D70006);
  font-weight: bold;
  margin-right: 8px;
  font-size: 16px;
}

/* Options: mini cards grid */
.rv-options-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
}

.rv-option-mini-card {
  background: #fff;
  border-radius: 6px;
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.rv-option-mini-card .rv-check {
  margin-right: 0;
}

.rv-option-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
  text-align: center;
}

/* === TOOLTIP (OPTIONS) === */
.rvvs-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  margin-left: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: #1e6cff;
  background: rgba(30, 108, 255, 0.12);
  border: 1px solid rgba(30, 108, 255, 0.28);
  cursor: pointer;
  user-select: none;
}

.rvvs-tooltip-icon:hover,
.rvvs-tooltip-icon:focus {
  background: rgba(30, 108, 255, 0.18);
  border-color: rgba(30, 108, 255, 0.42);
  outline: none;
}

.rvvs-tooltip-icon:focus-visible {
  outline: 2px solid rgba(30, 108, 255, 0.6);
  outline-offset: 2px;
}

.rvvs-has-tooltip {
  position: relative;
  cursor: help;
}

.rvvs-has-tooltip[data-rvvs-tooltip]::after {
  content: attr(data-rvvs-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(20, 20, 20, 0.96);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 9999;
}

.rvvs-has-tooltip[data-rvvs-tooltip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(20, 20, 20, 0.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 10000;
}

.rvvs-has-tooltip:hover::after,
.rvvs-has-tooltip:hover::before,
.rvvs-has-tooltip:focus::after,
.rvvs-has-tooltip:focus::before {
  opacity: 1;
  visibility: visible;
}

.rvvs-theme-dark .rvvs-has-tooltip[data-rvvs-tooltip]::after {
  background: rgba(0, 0, 0, 0.92);
}

.rvvs-theme-dark .rvvs-has-tooltip[data-rvvs-tooltip]::before {
  border-top-color: rgba(0, 0, 0, 0.92);
}

.rvvs-theme-dark .rvvs-tooltip-icon {
  color: #62a0ff;
  background: rgba(98, 160, 255, 0.16);
  border-color: rgba(98, 160, 255, 0.34);
}

/* === DARK THEME OVERRIDES (use theme="dark") === */
.rvvs-theme-dark .rv-specs-title,
.rvvs-theme-dark .rv-options-title,
.rvvs-theme-dark .rv-power-title,
.rvvs-theme-dark .rv-power-card h3 {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark .rv-spec-label {
  color: rgba(255, 255, 255, 0.72);
}

.rvvs-theme-dark .rv-spec-data {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark .rv-spec-dots {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.24) 50%, transparent 50%);
  opacity: 0.7;
}

.rvvs-theme-dark .rv-option-list li,
.rvvs-theme-dark .rv-simple-list li {
  border-bottom-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

.rvvs-theme-dark .rv-option-section,
.rvvs-theme-dark .rv-section-title {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark .rv-stat {
  background: rgba(255, 255, 255, 0.08);
}

.rvvs-theme-dark .rv-stat .label {
  color: rgba(255, 255, 255, 0.72);
}

.rvvs-theme-dark .rv-stat .value {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark .rv-stat.highlight {
  background: rgba(var(--rvvs-primary-rgb, 215, 0, 6), 0.14);
}

.rvvs-theme-dark .rv-stat.highlight .value {
  color: var(--rvvs-primary, #D70006);
}

.rvvs-theme-dark .rv-stat.gain {
  background: rgba(var(--rvvs-primary-rgb, 215, 0, 6), 0.10);
}

.rvvs-theme-dark .rv-stat.gain .value {
  color: var(--rvvs-primary, #D70006);
}

.rvvs-theme-dark .rv-percentage {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark.rvvs-specs-values,
.rvvs-theme-dark.rvvs-options-values,
.rvvs-theme-dark.rvvs-power-values {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark.rvvs-specs-values li,
.rvvs-theme-dark.rvvs-options-values li,
.rvvs-theme-dark.rvvs-power-values li {
  color: rgba(255, 255, 255, 0.92);
}

/* === POWER STATS STYLES === */
.rv-power-wrapper {
  margin: 40px 0;
}

.rv-power-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 25px;
  color: #333;
  text-align: center;
}

.rv-power-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
}

.rv-power-card {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  transition: transform 0.3s ease;
}

.rv-power-card:hover {
  transform: none;
  box-shadow: none;
}

.rv-power-card h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #333;
}

.rv-power-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 15px;
}

.rv-stat {
  display: flex;
  justify-content: space-between;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.rv-stat .label {
  color: #666;
  font-size: 14px;
}

.rv-stat .value {
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.rv-stat.highlight {
  background: #e3f2fd;
}

.rv-stat.highlight .value {
  color: #1976d2;
}

.rv-stat.gain {
  background: #e8f5e9;
}

.rv-stat.gain .value {
  color: #2e7d32;
  font-weight: 700;
}

.rv-percentage {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: #2e7d32;
  margin-top: 10px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {

  .rv-options-grid,
  .rv-power-grid {
    grid-template-columns: 1fr;
  }

  .rv-specs-title,
  .rv-options-title,
  .rv-power-title {
    font-size: 24px;
  }

  .rv-specs-wrapper {
    padding: 25px 20px;
  }

  .rv-spec-label {
    min-width: 140px;
    font-size: 14px;
  }

  .rv-spec-data {
    font-size: 14px;
    max-width: 62%;
  }

  .rv-spec-dots {
    margin: 0 10px;
  }
}

/* === CHARTS (HP / TORQUE) === */
.rvvs-chart {
  margin: 25px 0;
}

.rvvs-chart-align-center {
  /* Mantido por compatibilidade, mas sem forçar posicionamento.
     Deixe o Elementor/tema definir alinhamento do widget/box. */
  margin-left: 0;
  margin-right: 0;
}

.rvvs-chart-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #333;
}

.rvvs-chart-plot {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  height: 240px;
  grid-template-rows: 1fr auto;
  width: 100%;
}

.rvvs-chart-axis {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  height: 100%;
}

.rvvs-chart-axis-spacer {
  height: 32px;
  grid-column: 1;
  grid-row: 2;
}

.rvvs-chart-axis-tick {
  position: absolute;
  left: 0;
  right: 0;
  transform: translateY(50%);
  font-size: 12px;
  color: #666;
  text-align: right;
  padding-right: 6px;
  line-height: 1;
}

.rvvs-chart-canvas {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-rows: 1fr 32px;
  min-width: 0;
}

.rvvs-chart-plotarea {
  position: relative;
  height: 100%;
  grid-row: 1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.rvvs-chart-gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.rvvs-chart-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(18px, 7vw, 42px);
  padding: 10px 0 0 0;
}

.rvvs-chart-bar {
  position: relative;
  width: clamp(34px, 9vw, 64px);
}

.rvvs-chart-bar-fill {
  width: 100%;
  height: 100%;
  cursor: default;
}

.rvvs-chart-bar-original {
  background: var(--rvvs-neutral, #9A9A9A);
}

.rvvs-chart-bar-tuned {
  background: var(--rvvs-primary, #D70006);
}

/* Dark theme support (use theme="dark" in the shortcode) */
.rvvs-theme-dark .rvvs-chart-title {
  color: rgba(255, 255, 255, 0.92);
}

.rvvs-theme-dark .rvvs-chart-axis-tick,
.rvvs-theme-dark .rvvs-chart-xlabel {
  color: rgba(255, 255, 255, 0.72);
}

.rvvs-theme-dark .rvvs-chart-gridline {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.rvvs-theme-dark .rvvs-chart-plotarea {
  border-bottom-color: rgba(255, 255, 255, 0.18);
}

.rvvs-chart-bar-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -22px;
  text-align: center;
  font-size: 13px;
  color: #666;
}

.rvvs-chart-bar-value {
  display: none;
}

.rvvs-chart-xaxis {
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 7vw, 42px);
  padding: 0;
  box-sizing: border-box;
  pointer-events: none;
  grid-row: 2;
}

.rvvs-chart-xlabel {
  text-align: center;
  font-size: 13px;
  color: #666;
  flex: 0 0 clamp(34px, 9vw, 64px);
}

.rvvs-chart-tooltip {
  position: absolute;
  z-index: 5;
  background: #fff;
  color: #333;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
}

.rvvs-tt-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.rvvs-tt-value {
  font-weight: 600;
}

/* === VEHICLE FILTER === */
.rvvs-filter {
  margin: 20px 0;
  width: 100%;
  background: transparent;
  box-shadow: none;
}

.rvvs-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: stretch;
  background: transparent;
  padding: 0;
  margin: 0;
}

/* Layout Grid (padrão - 2x2 + botão) */
.rvvs-filter-layout-grid .rvvs-filter-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.rvvs-filter-layout-grid .rvvs-filter-submit {
  grid-column: 1;
  margin-top: 8px;
}

/* Layout Inline (tudo em uma linha) */
.rvvs-filter-layout-inline .rvvs-filter-form {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: center;
}

.rvvs-filter-layout-inline .rvvs-filter-field {
  flex: 1 1 0;
  min-width: 160px;
}

.rvvs-filter-layout-inline .rvvs-filter-submit {
  flex: 0 0 auto;
}

/* Campo do filtro */
.rvvs-filter-field {
  position: relative;
  display: flex;
  align-items: center;
  background: transparent;
}

.rvvs-filter-select {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 52px;
  color: #333;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

/* Nice Select integration (tema pode substituir <select> por .nice-select) */
.rvvs-filter .nice-select {
  height: 52px;
  display: flex;
  align-items: center;
  width: 100%;
}

.rvvs-filter .nice-select .current {
  line-height: 1.2;
}

/* Evita seta duplicada quando Nice Select existe */
.rvvs-filter-field .nice-select~.rvvs-filter-arrow {
  display: none;
}

.rvvs-filter-select:hover:not(:disabled) {
  border-color: #999;
}

.rvvs-filter-select:focus {
  outline: none;
  border-color: var(--rvvs-primary, #D70006);
  box-shadow: 0 0 0 3px rgba(var(--rvvs-primary-rgb, 215, 0, 6), 0.12);
}

.rvvs-filter-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f8f8f8;
}

.rvvs-filter-select.rvvs-loading {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 50 50'%3E%3Cpath fill='%23999' d='M25 5A20 20 0 1 0 45 25 20 20 0 0 0 25 5zm0 36A16 16 0 1 1 41 25 16 16 0 0 1 25 41z' opacity='.25'/%3E%3Cpath fill='%23999' d='M25 5V9A16 16 0 0 1 41 25h4A20 20 0 0 0 25 5z'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='.8s' repeatCount='indefinite'/%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 40px) center;
  background-size: 18px 18px;
}

/* Seta customizada */
.rvvs-filter-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  pointer-events: none;
  border: solid #666;
  border-width: 0 2px 2px 0;
  transform: translateY(-65%) rotate(45deg);
}

.rvvs-filter-select:disabled+.rvvs-filter-arrow {
  opacity: 0.4;
}

/* Botão de submit */
.rvvs-filter-submit {
  display: flex;
  align-items: stretch;
}

.rvvs-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 28px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--rvvs-primary, #D70006);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease, opacity 0.2s ease;
  white-space: nowrap;
}

.rvvs-filter-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--rvvs-primary, #D70006) 85%, #000);
  filter: brightness(0.92);
}

.rvvs-filter-button:active:not(:disabled) {
  transform: scale(0.98);
}

.rvvs-filter-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.rvvs-filter-button.rvvs-loading {
  pointer-events: none;
  opacity: 0.8;
}

.rvvs-filter-button.rvvs-loading span:first-child {
  opacity: 0;
}

.rvvs-filter-button.rvvs-loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rvvs-spin 0.7s linear infinite;
}

@keyframes rvvs-spin {
  to {
    transform: rotate(360deg);
  }
}

.rvvs-filter-button-arrow {
  font-size: 16px;
  font-weight: 400;
}

/* Shake animation (validação) */
@keyframes rvvs-shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

.rvvs-shake {
  animation: rvvs-shake 0.4s ease;
}

/* Dark theme */
.rvvs-theme-dark .rvvs-filter-select {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.rvvs-theme-dark .rvvs-filter-select:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.32);
}

.rvvs-theme-dark .rvvs-filter-select:focus {
  border-color: var(--rvvs-primary, #D70006);
}

.rvvs-theme-dark .rvvs-filter-select:disabled {
  background: rgba(255, 255, 255, 0.04);
}

.rvvs-theme-dark .rvvs-filter-arrow {
  border-color: rgba(255, 255, 255, 0.6);
}

/* Fundo branco padrão para opções do select */
.rvvs-filter-select option {
  background: #fff;
  color: #333;
}

.rvvs-theme-dark .rvvs-filter-select option {
  background: #1a1a1a;
  color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
  .rvvs-filter-layout-grid .rvvs-filter-form {
    grid-template-columns: 1fr;
  }

  .rvvs-filter-layout-grid .rvvs-filter-submit {
    grid-column: 1;
  }

  .rvvs-filter-layout-inline .rvvs-filter-form {
    flex-wrap: wrap;
  }

  .rvvs-filter-layout-inline .rvvs-filter-field {
    flex: 1 1 calc(50% - 6px);
    min-width: 140px;
  }

  .rvvs-filter-layout-inline .rvvs-filter-submit {
    flex: 1 1 100%;
  }

  .rvvs-filter-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .rvvs-filter-layout-inline .rvvs-filter-field {
    flex: 1 1 100%;
  }

  .rvvs-filter-select {
    height: 48px;
    font-size: 14px;
    line-height: 48px;
  }

  .rvvs-filter .nice-select {
    height: 48px;
  }

  .rvvs-filter-button {
    height: 48px;
    font-size: 13px;
  }
}