/* ============================================================
 * Size Slider — Card moderno de personalização do tamanho
 * Vermelho: #ef2020 | Cinza claro: #d8d8d8 | Borda: #e5e5e5
 * ============================================================ */

.ma-size-slider-section {
  margin: 8px 0 !important;
  padding: 14px !important;
  border: 1px solid #e5e5e5 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

/* ---------- Header: título + badges ---------- */
.ma-size-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  max-width: 100%;
  min-width: 0;
}

.ma-size-title-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap;
}

.ma-size-title {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: rgb(58, 58, 58);
  letter-spacing: 0.2px;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}

/* ---------- Ícone de informação + tooltip ---------- */
.ma-size-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef2020;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
  user-select: none;
}

.ma-size-info::after {
  content: "?";
  line-height: 1;
}

.ma-size-info .ma-size-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 220px;
  padding: 10px 12px;
  background: rgb(58, 58, 58);
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  border-radius: 8px;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Setinha do tooltip (aponta para cima, para o ícone) */
.ma-size-info .ma-size-tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgb(58, 58, 58);
}

.ma-size-info:hover .ma-size-tooltip,
.ma-size-info:focus .ma-size-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Badges (Largura / Altura) ---------- */
.ma-size-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
  max-width: 100%;
}

.ma-size-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #ef2020;
  color: #ffffff;
  line-height: 1.2;
  min-width: 84px;
}

.ma-size-badge-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  opacity: 0.85;
}

.ma-size-badge-value {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- Slider ---------- */
.ma-size-slider-wrap {
  position: relative;
  padding: 4px 0 0;
}

.ma-size-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  max-width: 100%;
  height: 5px;
  border-radius: 999px;
  background: #ef2020;
  outline: none;
  margin: 0;
  padding: 0;
  cursor: grab;
  position: relative;
  z-index: 1;
  transition: background 0.15s ease;
  box-sizing: border-box;
}

.ma-size-range:active {
  cursor: grabbing;
}

/* WebKit thumb */
.ma-size-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #ef2020;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.ma-size-range::-webkit-slider-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 3px 10px rgba(239, 32, 32, 0.35);
}

.ma-size-range::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

/* Firefox thumb */
.ma-size-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid #ef2020;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.ma-size-range::-moz-range-thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 3px 10px rgba(239, 32, 32, 0.35);
}

.ma-size-range::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

/* Firefox track */
.ma-size-range::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: #ef2020;
}

/* ---------- Referências fixas abaixo do slider ---------- */
.ma-size-references {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 6px;
  font-size: 10px;
  color: #999;
  line-height: 1.3;
  width: 100%;
  min-width: 0;
}

.ma-size-reference {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: center;
  min-width: 0;
  flex: 1;
}

.ma-size-reference .ma-size-ref-size {
  font-weight: 600;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ma-size-reference .ma-size-ref-pct {
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ma-size-reference.ma-size-ref-center {
  color: rgb(58, 58, 58);
}

.ma-size-reference.ma-size-ref-center .ma-size-ref-size {
  color: #ef2020;
  font-weight: 700;
}

.ma-size-reference.ma-size-ref-center .ma-size-ref-pct {
  color: rgb(58, 58, 58);
  font-weight: 600;
}

/* ---------- Balão de comparação de tamanho (prévia proporcional) ---------- */
.ma-size-compare {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #d8d8d8;
  border-radius: 10px;
  background: #fafafa;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Palco de comparação em escala real.
   Altura NÃO fixa (usa min-height) para que o label "ADESIVO" nunca seja
   cortado no topo quando o adesivo é alto. O cálculo de pxPerCm no JS usa
   o min-height declarado como referência de escala (estável/responsivo). */
.ma-size-compare-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 150px;
  padding: 8px 4px 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f2f2f2 100%);
  border: 1px solid #e5e5e5;
  overflow: visible;
  box-sizing: border-box;
}

/* Container dos objetos lado a lado (adesivo + lata) */
.ma-size-compare-objects {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 8px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Cada item (adesivo ou lata) */
.ma-size-compare-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
}

.ma-size-compare-item-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
}

/* Retângulo do adesivo (proporcional às dimensões) */
.ma-size-compare-sticker {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  background: rgba(239, 32, 32, 0.12);
  border: 2px dashed #ef2020;
  border-radius: 4px;
  box-sizing: border-box;
  transition:
    width 0.15s ease,
    height 0.15s ease;
}

.ma-size-compare-sticker-text {
  font-size: 9px;
  font-weight: 700;
  color: #ef2020;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
}

/* Área onde a lata fica (referência de escala real). A altura é definida
   inline pelo JS (em pxPerCm) para manter a proporção real relativa ao
   adesivo. Mantemos um fallback de altura no CSS caso o JS falhe. */
.ma-size-compare-can-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 130px;
  min-height: 0;
  max-height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

.ma-size-compare-can {
  display: block;
  height: 100%;
  width: auto;
  max-height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
  user-select: none;
  -webkit-user-drag: none;
}

/* Régua de escala (mostra o tamanho real em cm) */
.ma-size-compare-scale {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  font-size: 10px;
  color: #999;
  white-space: nowrap;
}

.ma-size-scale-legend {
  font-size: 10px;
  font-weight: 600;
  color: #999;
}

/* ---------- Responsividade ---------- */
@media (max-width: 768px) {
  .ma-size-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .ma-size-title-wrap {
    width: 100%;
  }

  .ma-size-title {
    font-size: 13px;
  }

  .ma-size-badges {
    width: 100%;
  }

  .ma-size-badge {
    flex: 1 1 0;
    min-width: 0;
    width: 50%;
    max-width: 100%;
  }

  .ma-size-slider-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Tooltip limitado à largura do card no mobile */
  .ma-size-info .ma-size-tooltip {
    width: min(220px, calc(100vw - 40px));
    left: 0;
    transform: translateY(-4px);
  }

  .ma-size-info:hover .ma-size-tooltip,
  .ma-size-info:focus .ma-size-tooltip {
    transform: translateY(0);
  }

  .ma-size-info .ma-size-tooltip::before {
    left: 12px;
    transform: none;
  }

  /* Balão de comparação no mobile — altura flexível (não corta o label) */
  .ma-size-compare-stage {
    min-height: 120px;
  }

  .ma-size-compare-objects {
    min-height: 95px;
    gap: 16px;
  }

  .ma-size-compare-can-wrap {
    /* Altura controlada pelo JS (pxPerCm). Não definir min-height aqui
       para não travar a lata num tamanho mínimo e quebrar a escala. */
    min-height: 0;
  }
}
