/* ==========================================================================
   Componentes — peças reutilizadas em várias páginas
   ========================================================================== */

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: var(--r);
  border: 1px solid var(--ink); background: var(--bg); color: var(--ink);
  font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn--primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn--primary:hover { background: var(--yellow-hover); border-color: var(--yellow-hover); color: var(--ink); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-2); }
.btn--wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn--wa:hover { background: var(--wa-hover); border-color: var(--wa-hover); }
.btn--ghost-dark { background: transparent; border-color: #4A5257; color: var(--on-dark); }
.btn--ghost-dark:hover { background: transparent; border-color: var(--on-dark); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.icon-btn {
  position: relative; flex: none; width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); text-decoration: none;
}
.icon-btn:hover { border-color: var(--ink); }
.badge {
  position: absolute; top: -7px; right: -7px; min-width: 20px; padding: 0 5px;
  background: var(--yellow); color: var(--ink); border-radius: 10px;
  font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.badge[data-count="0"] { display: none; }

.link { font-weight: 600; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.link:hover { color: var(--ink-2); }

/* Cabeçalho de seção */
.sec-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.sec-head h2, .sec-title { font-size: var(--fs-h2); }
.sec-title { margin-bottom: 32px; }
.eyebrow { font-size: 15px; font-weight: 500; color: var(--muted); }

/* Busca */
.search { position: relative; display: flex; min-width: 0; background: #fff; border-radius: var(--r); }
.search__icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search__input {
  flex: 1; min-width: 0; padding: 16px 18px 16px 50px; font-size: 17px;
  border: 1px solid var(--line); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: #fff;
}
.search__input:focus { outline: none; border-color: var(--ink); }
.search__btn { border: 0; padding: 0 26px; background: var(--yellow); color: var(--ink); font-weight: 600; border-radius: 0 var(--r) var(--r) 0; }
.search__btn:hover { background: var(--yellow-hover); }
.search--sm .search__input { padding-block: 11px; font-size: 16px; }
.search--sm .search__btn { padding: 0 16px; }

.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-md);
}
.suggest a { display: grid; grid-template-columns: 44px 1fr auto; gap: 0 14px; align-items: center; padding: 10px 14px; text-decoration: none; border-top: 1px solid var(--soft-2); }
.suggest a:first-child { border-top: 0; }
.suggest a:hover, .suggest a.is-active { background: var(--soft); }
.suggest__thumb { width: 44px; height: 44px; padding: 6px; background: var(--soft); border-radius: var(--r); }
.suggest__name { display: block; font-size: 15px; font-weight: 600; }
.suggest__code { display: block; font-size: 14px; color: var(--muted); letter-spacing: .02em; }
.suggest__brand { font-size: 13px; color: var(--muted); }
.suggest__all { display: block !important; padding: 12px 14px; font-size: 14px; font-weight: 600; background: var(--soft); }
mark { background: none; color: var(--ink); font-weight: 600; box-shadow: inset 0 -6px 0 rgba(242, 183, 5, .5); }

.quick-links { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 15px; color: var(--muted); }
.quick-links a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.quick-links a:hover { border-color: var(--yellow); }

/* Cartão de peça */
.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 40px 24px; }
.product-card { display: flex; flex-direction: column; gap: 14px; }
.product-card__img { position: relative; display: block; aspect-ratio: 1 / 1; padding: 16%; background: var(--soft); border-radius: var(--r); transition: background-color .2s; }
.product-card__img:hover { background: var(--soft-2); }
.product-card__img img { width: 100%; height: 100%; object-fit: contain; }
.stock { position: absolute; left: 12px; top: 12px; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.stock--ok::before { background: var(--ok); }
.product-card__meta { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.product-card__code { color: var(--ink-2); font-weight: 500; letter-spacing: .02em; white-space: nowrap; }
.product-card__name { font-size: 18px; font-weight: 600; line-height: 1.3; text-decoration: none; }
.product-card__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.product-card__eq { font-size: 14px; color: var(--muted); }
.add-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 42px;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--r); background: #fff;
  font-weight: 600; font-size: 15px; transition: border-color .15s, background-color .15s;
}
.add-btn:hover { border-color: var(--ink); }
.add-btn.is-added { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Categoria (sistema) */
.grid-systems { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.system-tile { display: grid; gap: 14px; padding: 22px 18px 20px; background: #fff; text-decoration: none; }
.system-tile__img { aspect-ratio: 1 / 1; padding: 12%; background: var(--soft); border-radius: var(--r); transition: background-color .2s; }
.system-tile__img img { width: 100%; height: 100%; }
.system-tile:hover .system-tile__img { background: var(--soft-2); }
.system-tile__name { font-family: var(--display); font-weight: 600; font-size: 18px; }

/* Marcas */
.grid-brands { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.brand-tile {
  height: 88px; display: grid; place-items: center; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 21px; color: var(--muted);
  transition: color .2s, background-color .2s;
}
.brand-tile + .brand-tile { border-left: 1px solid var(--line); }
.brand-tile:hover { color: var(--ink); background: var(--soft); }
.brand-tile--other { font-family: var(--body); font-size: 16px; color: var(--ink); }

/* Quantidade */
.qty { display: flex; align-items: center; width: max-content; border: 1px solid var(--line); border-radius: var(--r); }
.qty button { width: 44px; height: 46px; border: 0; background: none; font-size: 18px; color: var(--ink-2); }
.qty button:hover { color: var(--ink); }
.qty output, .qty span { min-width: 36px; text-align: center; font-weight: 600; }

/* Formulários */
.field { display: grid; gap: 6px; font-size: 15px; font-weight: 500; }
.field input, .field textarea, .field select {
  font-weight: 400; font-size: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--ink); }

.notice { display: grid; gap: 4px; padding: 14px 16px; border-radius: var(--r); background: var(--wa-soft); color: #0F5C31; font-size: 15px; }
.msg-preview { padding: 14px; background: #fff; border-left: 2px solid var(--wa); font-size: 15px; white-space: pre-wrap; max-height: 280px; overflow: auto; }

/* Trilha de navegação */
.breadcrumb { padding-top: 28px; font-size: 14px; color: var(--muted); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ink); }

/* Estado vazio */
.empty { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 56px 24px; border: 1px solid var(--line); border-radius: var(--r); }
.empty img { width: 120px; height: 120px; }
.empty h2 { font-size: 22px; }
.empty p { max-width: 44ch; color: var(--muted); }

/* Moldura de imagem (até entrar a foto real) */
.photo-frame {
  position: relative; aspect-ratio: 4 / 3; display: flex; align-items: flex-end;
  padding: 6% 4% 2%; border-radius: var(--r); background: var(--dark-2); border: 1px solid var(--dark-line);
}
.photo-frame img { width: 100%; height: auto; }
.photo-frame__tag { position: absolute; top: 12px; left: 12px; font-size: 13px; padding: 3px 8px; border-radius: 2px; background: rgba(242, 183, 5, .18); color: #F7D46B; }

@media (max-width: 1080px) {
  .grid-systems { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-brands { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .brand-tile:nth-child(5) { border-left: 0; }
  .brand-tile:nth-child(n+5) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .grid-systems { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-brands { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-tile { height: 72px; font-size: 18px; }
  .brand-tile:nth-child(odd) { border-left: 0; }
  .brand-tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
  .product-card__name { font-size: 16px; }
  .product-card__meta { flex-direction: column; gap: 0; }
  .product-card__eq { display: none; }
  .add-btn { font-size: 14px; padding: 8px 10px; }
  .search__btn { padding: 0 16px; }
}
