/* ============================================================
   Nova Performance — identidade clínica
   Azul-petróleo #17364A · off-white #F6FAF9 · teal #2E8F83
   Tema claro é o padrão; o escuro é a mesma paleta invertida.
   ============================================================ */
:root {
  /* marca */
  --petroleo: #17364a;
  --petroleo-2: #1f4a63;
  --teal: #2e8f83;
  --teal-claro: #49b6b4;
  --offwhite: #f6faf9;

  /* superfícies e texto (tema claro) */
  --bg: var(--offwhite);
  --bg-topo: #ffffff;
  --painel: #ffffff;
  --painel-2: #fbfdfd;
  --linha: #e0eae9;
  --linha-forte: #cfdedc;
  --tinta: #45606f;
  --tinta-forte: var(--petroleo);
  --fraco: #83969f;
  --acento: var(--teal);
  --acento-suave: rgba(46, 143, 131, 0.1);
  --sombra-card: 0 1px 2px rgba(23, 54, 74, 0.04);
  --sombra-hover: 0 10px 30px rgba(23, 54, 74, 0.1);
  --tile: #ffffff;
  --tile-linha: #eef4f3;
  --logo-claro: none;
  --logo-escuro: block;

  --raio: 12px;
  --lateral: 268px;
  --topo-h: 88px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: Manrope, "Segoe UI", system-ui, sans-serif;
}

/* ---------- tema escuro: mesma marca, superfícies invertidas ---------- */
:root[data-theme="dark"] {
  --bg: #0b1e2a;
  --bg-topo: #081821;
  --painel: #10293a;
  --painel-2: #143349;
  --linha: #1d4257;
  --linha-forte: #27556e;
  --tinta: #a9c4cf;
  --tinta-forte: #eaf3f5;
  --fraco: #6f8b99;
  --acento: var(--teal-claro);
  --acento-suave: rgba(73, 182, 180, 0.14);
  --sombra-card: none;
  --sombra-hover: 0 12px 32px rgba(0, 0, 0, 0.45);
  --tile: #ffffff;
  --tile-linha: transparent;
  --logo-claro: block;
  --logo-escuro: none;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--tinta);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 220ms var(--ease), color 220ms var(--ease);
}

button,
input,
select {
  font: inherit;
}

/* ---------------- topo ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 26px;
  height: var(--topo-h);
  padding: 0 32px;
  background: var(--bg-topo);
  border-bottom: 1px solid var(--linha);
}

.brand {
  display: flex;
  align-items: center;
  height: 100%;
}

.brand img {
  display: block;
  height: 46px;
  width: auto;
}
.brand .logo-escuro {
  display: var(--logo-escuro);
}
.brand .logo-claro {
  display: var(--logo-claro);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 11px;
  max-width: 440px;
  width: 100%;
  justify-self: center;
  height: 42px;
  padding: 0 17px;
  border: 1px solid var(--linha);
  border-radius: 999px;
  background: var(--painel);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.search-field:focus-within {
  border-color: var(--acento);
  box-shadow: 0 0 0 3px var(--acento-suave);
}

.search-icon {
  position: relative;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 1.8px solid var(--fraco);
  border-radius: 50%;
}
.search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 1.8px;
  border-radius: 999px;
  background: var(--fraco);
  transform: rotate(-45deg);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--tinta-forte);
  background: transparent;
  font-size: 14px;
}
.search-field input::placeholder {
  color: var(--fraco);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

/* botão do pedido */
.cart-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 21px;
  color: #fff;
  background: var(--petroleo);
  border: 0;
  border-radius: 999px;
  font-family: Jost, Manrope, sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 180ms var(--ease), transform 160ms var(--ease),
    box-shadow 180ms var(--ease);
}
.cart-button:hover {
  background: var(--petroleo-2);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(23, 54, 74, 0.22);
}
:root[data-theme="dark"] .cart-button {
  background: var(--teal);
  color: #062028;
}
:root[data-theme="dark"] .cart-button:hover {
  background: var(--teal-claro);
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--teal);
  border: 2px solid var(--bg-topo);
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
}
:root[data-theme="dark"] .cart-badge {
  background: var(--petroleo);
  color: #eaf3f5;
}

/* toggle de tema */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 64px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--linha-forte);
  border-radius: 999px;
  background: var(--painel);
  cursor: pointer;
  transition: border-color 160ms var(--ease);
}
.theme-toggle:hover {
  border-color: var(--acento);
}
.theme-toggle svg {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}
.theme-toggle .sun {
  color: #d9a323;
}
.theme-toggle .moon {
  color: var(--fraco);
}
:root[data-theme="dark"] .theme-toggle .sun {
  color: var(--fraco);
}
:root[data-theme="dark"] .theme-toggle .moon {
  color: var(--teal-claro);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--acento-suave);
  border: 1px solid var(--acento);
  transition: left 220ms var(--ease);
}
:root[data-theme="dark"] .toggle-thumb {
  left: 35px;
}

/* ---------------- layout ---------------- */
.catalog-shell {
  display: grid;
  grid-template-columns: var(--lateral) minmax(0, 1fr);
  min-height: calc(100vh - var(--topo-h));
}

.categories {
  position: sticky;
  top: var(--topo-h);
  height: calc(100vh - var(--topo-h));
  overflow: auto;
  padding: 30px 18px 48px 32px;
  border-right: 1px solid var(--linha);
  scrollbar-width: thin;
}
.categories::-webkit-scrollbar {
  width: 4px;
}
.categories::-webkit-scrollbar-thumb {
  background: var(--linha-forte);
  border-radius: 4px;
}

.categories h1 {
  margin: 0 0 18px;
  color: var(--fraco);
  font-family: Jost, sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

#categoryList {
  display: grid;
  gap: 1px;
}

.category-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 9px 12px 9px 15px;
  border: 0;
  border-radius: 8px;
  color: var(--tinta);
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: color 150ms var(--ease), background 150ms var(--ease);
}
.category-button:hover {
  color: var(--tinta-forte);
  background: var(--acento-suave);
}
.category-button.is-active {
  color: var(--tinta-forte);
  background: var(--acento-suave);
  font-weight: 700;
}
.category-button.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2.5px;
  border-radius: 999px;
  background: var(--acento);
}

/* ---------------- catálogo ---------------- */
.catalog {
  padding: 30px 36px 76px;
  min-width: 0;
}

.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--linha);
}

.catalog h2 {
  margin: 0;
  color: var(--tinta-forte);
  font-family: Jost, sans-serif;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fraco);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.sort-control select {
  height: 36px;
  padding: 0 30px 0 12px;
  color: var(--tinta-forte);
  border: 1px solid var(--linha);
  border-radius: 8px;
  background: var(--painel);
  cursor: pointer;
}

.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 20px;
}

.product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  background: var(--painel);
  box-shadow: var(--sombra-card);
  overflow: hidden;
  transition: transform 200ms var(--ease), border-color 200ms var(--ease),
    box-shadow 200ms var(--ease);
}
.product-card:hover {
  transform: translateY(-3px);
  border-color: var(--acento);
  box-shadow: var(--sombra-hover);
}

.card-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 170px;
  margin: 12px 12px 0;
  padding: 12px;
  background: var(--tile);
  border: 1px solid var(--tile-linha);
  border-radius: 9px;
}
.card-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  padding: 14px 16px 16px;
}

.card-category {
  color: var(--acento);
  font-family: Jost, sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card-body h3 {
  margin: 0;
  color: var(--tinta-forte);
  font-size: 14px;
  line-height: 1.42;
  font-weight: 600;
}

.card-foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
}

.card-price {
  color: var(--tinta-forte);
  font-family: "JetBrains Mono", monospace;
  font-size: 17.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid var(--petroleo);
  border-radius: 8px;
  color: var(--petroleo);
  background: transparent;
  font-family: Jost, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.add-btn:hover {
  background: var(--petroleo);
  color: #fff;
}
.add-btn:active {
  transform: scale(0.985);
}
:root[data-theme="dark"] .add-btn {
  border-color: var(--teal);
  color: var(--teal-claro);
}
:root[data-theme="dark"] .add-btn:hover {
  background: var(--teal);
  color: #062028;
}

/* stepper */
.qty-stepper {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: stretch;
  height: 40px;
  border: 1px solid var(--acento);
  border-radius: 8px;
  background: var(--acento-suave);
  overflow: hidden;
}
.qty-stepper button {
  border: 0;
  color: var(--acento);
  background: transparent;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.qty-stepper button:hover {
  background: var(--acento-suave);
}
.qty-stepper .qty-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tinta-forte);
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 500;
}

.empty-state {
  display: grid;
  gap: 8px;
  max-width: 460px;
  margin-top: 52px;
  color: var(--fraco);
}
.empty-state strong {
  color: var(--tinta-forte);
  font-family: Jost, sans-serif;
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

/* ---------------- rodapé ---------------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 36px;
  border-top: 1px solid var(--linha);
  color: var(--fraco);
  font-size: 12px;
}
.site-footer span:first-child {
  font-family: Jost, sans-serif;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--tinta-forte);
}

/* ---------------- carrinho ---------------- */
.cart-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(11, 30, 42, 0.42);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 220ms var(--ease);
}
.cart-overlay.is-open {
  opacity: 1;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(430px, 100vw);
  background: var(--painel);
  border-left: 1px solid var(--linha);
  transform: translateX(103%);
  transition: transform 280ms var(--ease);
  box-shadow: -20px 0 60px rgba(23, 54, 74, 0.16);
}
.cart-drawer.is-open {
  transform: translateX(0);
}

.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--linha);
}
.cart-head h2 {
  margin: 0;
  color: var(--tinta-forte);
  font-family: Jost, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cart-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--linha);
  border-radius: 8px;
  color: var(--tinta);
  background: transparent;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 150ms var(--ease), color 150ms var(--ease);
}
.cart-close:hover {
  border-color: var(--acento);
  color: var(--tinta-forte);
}

.cart-items {
  flex: 1;
  overflow: auto;
  padding: 8px 24px;
}

.cart-item {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--linha);
}

.cart-item-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 5px;
  background: var(--tile);
  border: 1px solid var(--tile-linha);
  border-radius: 8px;
}
.cart-item-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.cart-item-info {
  min-width: 0;
}
.cart-item-info h4 {
  margin: 0 0 3px;
  color: var(--tinta-forte);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.38;
}
.cart-item-info .unit {
  color: var(--fraco);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
}

.cart-item-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.cart-item .qty-stepper {
  height: 30px;
  grid-template-columns: 28px 32px 28px;
}
.cart-item .qty-stepper button {
  font-size: 15px;
}

.cart-item-subtotal {
  color: var(--tinta-forte);
  font-family: "JetBrains Mono", monospace;
  font-size: 13.5px;
  font-weight: 500;
}

.cart-item-remove {
  border: 0;
  padding: 0;
  color: var(--fraco);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}
.cart-item-remove:hover {
  color: #c0574f;
}

.cart-empty {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 52px 24px;
  text-align: center;
  color: var(--fraco);
}
.cart-empty strong {
  color: var(--tinta-forte);
  font-family: Jost, sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.06em;
}
.cart-drawer.is-empty .cart-empty {
  display: flex;
}

.cart-foot {
  display: grid;
  gap: 12px;
  padding: 20px 24px 24px;
  border-top: 1px solid var(--linha);
  background: var(--painel-2);
}

.cart-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--fraco);
  font-family: Jost, sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.cart-total strong {
  color: var(--tinta-forte);
  font-family: "JetBrains Mono", monospace;
  font-size: 21px;
  font-weight: 500;
}

.cart-note {
  margin: 0;
  color: var(--fraco);
  font-size: 12px;
  line-height: 1.5;
}

.wa-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--petroleo);
  font-family: Jost, sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms var(--ease), transform 160ms var(--ease);
}
.wa-button:hover {
  background: var(--petroleo-2);
}
.wa-button:active {
  transform: scale(0.99);
}
:root[data-theme="dark"] .wa-button {
  background: var(--teal);
  color: #062028;
}
:root[data-theme="dark"] .wa-button:hover {
  background: var(--teal-claro);
}

.cart-clear {
  border: 0;
  padding: 4px;
  color: var(--fraco);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}
.cart-clear:hover {
  color: #c0574f;
}

/* ---------------- responsivo ---------------- */
@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    padding: 14px 18px;
    row-gap: 12px;
  }
  .brand img {
    height: 38px;
  }
  .search-field {
    grid-column: 1 / -1;
    max-width: none;
  }
  .topbar-actions {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    gap: 10px;
  }
  .cart-button span:not(.cart-badge) {
    display: none;
  }
  .cart-button {
    padding: 0 14px;
  }
  .catalog-shell {
    display: block;
  }
  .categories {
    position: static;
    height: auto;
    padding: 18px 18px 4px;
    border-right: 0;
  }
  #categoryList {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    scrollbar-width: none;
  }
  #categoryList::-webkit-scrollbar {
    display: none;
  }
  .category-button {
    width: auto;
    flex: 0 0 auto;
    padding: 8px 15px;
    border: 1px solid var(--linha);
    border-radius: 999px;
    white-space: nowrap;
  }
  .category-button.is-active {
    border-color: var(--acento);
  }
  .category-button.is-active::before {
    display: none;
  }
  .catalog {
    padding: 18px 18px 56px;
  }
  .catalog-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .catalog h2 {
    font-size: 21px;
  }
  .product-list {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 13px;
  }
  .card-media {
    height: 126px;
  }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
}
