/* =========================================================
   CH Comparador de Produtos — Design (v1.2.0)
   ========================================================= */

/* ---------- Fonts (SF Pro Display) ---------- */
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/sf-pro-display-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/sf-pro-display-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Display";
  src: url("fonts/sf-pro-display-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SF Pro Text";
  src: url("fonts/sf-pro-text-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ch-green-1: #2f9f6a;
  --ch-green-2: #63d69a;
  --ch-green-solid: #43c987;
  --ch-green-soft: rgba(67, 201, 135, 0.16);
  --ch-green-soft-2: rgba(67, 201, 135, 0.10);
  --ch-x-color: #184A38;
  --ch-border: #eeeeee;
  --ch-bg-soft: #fafafa;
  --ch-text: #111111;
  --ch-muted: #7a7a7a;
}

/* Force SF Pro Display inside the component */
.ch-comp,
.ch-comp * {
  font-family: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ch-comp {
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--ch-border);
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.06);
}

/* Top bar: only the Clear button */
/* (Removed) topbar / clear button */

/* Form container */
.ch-comp__form {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: var(--ch-bg-soft);
  border: 1px solid var(--ch-border);
  border-radius: 16px;
}

.ch-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--ch-muted);
  margin: 0 0 6px 2px;
}

.ch-field select,
.ch-field input {
  width: 100%;
  height: 42px;
  border-radius: 14px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  padding: 0 12px;
  font-size: 14px;
  color: var(--ch-text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

/* Textarea (Observação) — same visual language as inputs */
.ch-field textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ch-text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  box-sizing: border-box;
  resize: vertical;
}

.ch-field textarea:focus {
  border-color: rgba(67, 201, 135, 0.60);
  box-shadow: 0 0 0 4px rgba(67, 201, 135, 0.22);
}

/* Full-width field inside the grid */
.ch-field--full {
  grid-column: 1 / -1;
}

/* Ensure the "Valor" field looks identical to the other controls
   (Elementor/theme styles sometimes target inputs differently). */
#chValor {
  height: 42px !important;
  border-radius: 14px !important;
  border: 1px solid #e6e6e6 !important;
  background: #ffffff !important;
  padding: 0 12px !important;
}

.ch-field select:disabled {
  background: #f3f3f3;
  color: #999999;
}

.ch-field select:focus,
.ch-field input:focus {
  border-color: rgba(67, 201, 135, 0.60);
  box-shadow: 0 0 0 4px rgba(67, 201, 135, 0.22);
}

/* Buttons (base) */
.ch-btn {
  height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(67, 201, 135, 0.55);
  background: transparent;
  color: var(--ch-green-solid);
  transition: background .15s ease, transform .05s ease, filter .15s ease;
  white-space: nowrap;
}

.ch-btn:hover {
  background: var(--ch-green-soft-2);
}

.ch-btn:active {
  transform: translateY(1px);
}

/* Clear button: keep minimal */
.ch-btn--ghost {
  border-color: rgba(67, 201, 135, 0.45);
}

/* Add button (matches the provided reference) */
#chAdd {
  height: 54px;
  min-width: 220px;
  border-radius: 18px;
  border: 0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--ch-green-1), var(--ch-green-2));
  box-shadow: 0 16px 34px rgba(47, 159, 106, 0.22);
}

#chAdd:hover {
  filter: brightness(0.98);
  background: linear-gradient(90deg, #2b955f, #5fce91);
}

#chAdd:active {
  transform: translateY(1px);
}

.ch-field--btn {
  min-width: 220px;
}

/* Cards */
.ch-comp__cards {
  margin-top: 18px;
  /*
    Centraliza os cards (como na referência):
    - wrapper vira uma coluna
    - os cards ficam com largura máxima e alinhados ao centro
  */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.ch-comp__cards.is-grid-2 {
  /* Mantém o layout centralizado mesmo quando o JS adiciona essa classe */
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ch-card {
  position: relative;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--ch-border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 26px rgba(0,0,0,0.05);
  width: 100%;
  max-width: 620px; /* ajuste fino para ficar "centralizado" e não ocupar a largura toda */
  box-sizing: border-box;
}

.ch-card__logo {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ch-card__logo img {
  max-height: 60px;
  max-width: 160px;
  object-fit: contain;
}

.ch-card__info {
  font-size: 13px;
  color: #222222;
  line-height: 1.35;
}

.ch-card__info b {
  font-weight: 600;
  color: #000000;
}

.ch-card__value {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 800;
  color: #000000;
}

/* Optional note shown on the card */
.ch-card__obs {
  margin-top: 8px;
  font-size: 13px;
  color: #444444;
  line-height: 1.4;
}

/* Optional Observação block (only renders when filled) */
.ch-card__obs {
  margin-top: 0px;
  font-size: 17px;
  color: #333333;
  line-height: 1.35;
}

/* Close button (X) centered */
.ch-card__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 14px;
  border: 1px solid var(--ch-border);
  background: #ffffff;
  color: var(--ch-x-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

/* Responsive */
@media (max-width: 980px) {
  .ch-comp__form {
    grid-template-columns: 1fr 1fr;
  }
  .ch-field--btn {
    grid-column: 1 / -1;
    min-width: auto;
  }
  #chAdd {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .ch-card {
    grid-template-columns: 120px 1fr;
    max-width: 100%;
  }
  .ch-comp__cards,
  .ch-comp__cards.is-grid-2 {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }
  #chAdd {
    font-size: 18px;
    height: 50px;
    border-radius: 16px;
  }
}
