:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --navy: #062A5E;
  --accent: #ff7a00;
  --header: 52px;
  --radius: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  background-color: #062A5E;
  background-image: url("fundo.webp");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.47;
  letter-spacing: -0.01em;
  padding-top: var(--header);
}

body.menu-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button, a, input, select {
  -webkit-tap-highlight-color: transparent;
}

main {
  flex: 1;
}

/* Header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 22px;
  z-index: 9000;
  background: rgba(6, 42, 94, 0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo img {
  height: 32px;
  width: auto;
}

.titulo {
  font-size: 13px;
  line-height: 1.2;
  color: #f5f5f7;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.titulo span {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #a1a1a6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.menu {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
}

.menu a {
  text-decoration: none;
  color: #f5f5f7;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 980px;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.menu a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-icon {
  display: none;
}

.btn-loja-nav {
  background: var(--blue) !important;
  color: #fff !important;
  font-weight: 500 !important;
  padding: 7px 14px !important;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 9200;
  width: 44px;
  height: 44px;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #f5f5f7;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.btn-login-header {
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 980px;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.btn-login-header.hidden {
  display: none;
}

.perfil {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 6px 4px 8px;
  border-radius: 980px;
  font-size: 12px;
  color: #fff;
  white-space: nowrap;
}

.perfil.hidden {
  display: none;
}

.icone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

#nomeUsuario {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  margin: 0;
  padding: 5px 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 980px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}

.btn-logout:hover {
  background: #e86e00;
}

/* Page */
.container {
  padding: 28px 22px 80px 10px;
  max-width: none;
  margin: 0;
  width: 100%;
}

.layout-loja {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.menu-lateral {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  position: sticky;
  top: calc(var(--header) + 16px);
  padding-left: 0;
}

.loja-kicker {
  font-size: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  width: 100%;
  text-align: left;
  padding: 0 14px;
  box-sizing: border-box;
}

.loja-intro {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 12px;
  line-height: 1.4;
  width: 100%;
  text-align: left;
  padding: 0 14px;
  box-sizing: border-box;
}

.loja-intro-whats {
  display: block;
  margin-top: 4px;
}

.aba-btn {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  transition: background 0.2s;
}

.aba-btn:hover,
.aba-btn.active {
  background: var(--accent);
}

.filtros {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 8px 4px;
}

.filtros.ativo {
  display: flex;
}

.filtros button {
  padding: 9px 12px;
  border: none;
  border-radius: 980px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-family: inherit;
  color: var(--navy);
  font-weight: 500;
  box-shadow: 0 1px 0 var(--line);
}

.filtros button:hover {
  background: #fff;
}

.conteudo-direita {
  flex: 1;
  min-width: 0;
}

.aba {
  display: none;
}

.aba.ativa {
  display: block;
}

.grid-livro,
.grid-fardamento,
.grid-listas,
.area-kits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}

.cardlivros,
.cardfardamento,
.cardlista,
.cardkit {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  padding: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 240px;
  gap: 6px;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .cardlivros:hover,
  .cardfardamento:hover,
  .cardlista:hover,
  .cardkit:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(6, 42, 94, 0.12);
  }
}

.cardlivros img,
.cardfardamento img,
.cardlista img,
.cardkit img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 12px;
  background: #fff;
}

.cardfardamento img,
.cardlista img {
  object-fit: contain;
}

.cardlivros h3,
.cardfardamento h3,
.cardlista h3,
.cardkit h3 {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 4px 0;
  min-height: 36px;
  color: var(--navy);
}

.cardlivros p,
.cardfardamento p,
.cardlista p,
.cardkit p {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--accent);
}

.cardlivros small,
.cardfardamento small,
.cardlista small,
.cardkit small {
  font-size: 11px;
  text-align: center;
  color: var(--muted);
  min-height: 26px;
}

.btn-download,
.btn-add {
  margin-top: auto;
  background: var(--navy);
  color: #fff;
  padding: 8px 10px;
  border: none;
  border-radius: 980px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  display: block;
  transition: background 0.2s;
}

.btn-download:hover,
.btn-add:hover {
  background: var(--accent);
  transform: none;
}

.preco,
.precoLivro {
  color: var(--navy);
  font-weight: 600;
  font-size: 13px;
}

.cardkit select,
.cardfardamento select,
.cardlivros select {
  width: 100%;
  height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
}

input[type="number"] {
  width: 56px;
  margin: 4px auto 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 6px;
  font-size: 13px;
  display: block;
}

.tag-vendido {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  letter-spacing: 0.04em;
  padding: 4px 7px;
  border-radius: 980px;
  font-weight: 700;
}

.icone-carrinho {
  position: fixed;
  bottom: 22px;
  right: 18px;
  width: 54px;
  height: 54px;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  border: 2px solid #fff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  z-index: 8000;
}

.icone-carrinho:hover {
  transform: scale(1.05);
  color: #fff;
}

.contador {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 980px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icone-carrinho.pulse {
  animation: pulse 0.3s ease;
}

@keyframes pulse {
  50% { transform: scale(1.12); }
}

.fly-item {
  position: fixed;
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 99999;
  transition: all 0.8s cubic-bezier(.5, -0.5, .5, 1.5);
  border-radius: 12px;
}

.carrinho {
  display: none;
  position: fixed;
  top: calc(var(--header) + 12px);
  right: 16px;
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - var(--header) - 28px);
  flex-direction: column;
  background: #ffffff;
  padding: 18px;
  border-radius: 22px;
  z-index: 9100;
  border: 1px solid rgba(6, 42, 94, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  isolation: isolate;
}

.carrinho h3 {
  color: var(--navy);
  text-align: left;
  font-size: 18px;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}

.itensCarrinhoItem {
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.topoItem {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topoItem img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}

#itensCarrinho {
  overflow-y: auto;
  max-height: 42vh;
}

.qtdItem {
  font-size: 12px;
  color: var(--muted);
}

.nomeItem {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.precoItem {
  font-weight: 600;
  color: var(--accent);
}

.removerItem {
  background: #fff;
  color: #d70015;
  border: 1px solid rgba(215, 0, 21, 0.25);
  padding: 6px 8px;
  border-radius: 980px;
  cursor: pointer;
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

#totalCarrinho {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 10px;
  text-align: right;
}

.botoes-carrinho {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.botoes-carrinho button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 980px;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 14px;
}

.btn-whats {
  background: #25D366;
  color: #fff;
}

.btn-cartao {
  background: #ececef;
  color: var(--muted);
  cursor: not-allowed;
  opacity: 1;
}

.mensagem {
  display: none;
  position: fixed;
  top: calc(var(--header) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  border-radius: 980px;
  font-weight: 600;
  font-size: 13px;
  z-index: 99999;
}

.popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 12000;
  padding: 20px;
}

.popup.show {
  display: flex;
}

.popup-box {
  background: #fff;
  padding: 24px 20px;
  border-radius: 22px;
  text-align: center;
  width: 280px;
}

.popup-box p {
  margin-bottom: 16px;
  color: var(--navy);
  font-weight: 600;
}

.popup-box button {
  background: var(--navy);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 980px;
  cursor: pointer;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 90px;
  right: 18px;
  background: #fff;
  color: var(--navy);
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  z-index: 9999;
  max-width: 280px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.rodape {
  background: var(--navy);
  padding: 20px 22px calc(20px + env(safe-area-inset-bottom));
  font-size: 12px;
  text-align: center;
  margin-top: auto;
}

.rodape p {
  color: rgba(255, 255, 255, 0.72);
  margin: 4px 0;
}

.rodape p:last-child {
  color: var(--accent);
}

@media (max-width: 1024px) {
  header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--navy);
  }

  .titulo span {
    display: none;
  }

  .logo-area {
    flex: 1;
    min-width: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .menu {
    position: fixed;
    top: var(--header);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100dvh - var(--header));
    background: var(--navy);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 8px 22px calc(28px + env(safe-area-inset-bottom));
    transform: translateX(100%);
    pointer-events: none;
    transition: transform 0.3s ease;
    overflow-y: auto;
    z-index: 9100;
  }

  .menu.active {
    transform: translateX(0);
    pointer-events: auto;
  }

  .menu a {
    font-size: 20px;
    font-weight: 600;
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    white-space: normal;
  }

  .menu a .nav-icon {
    display: inline-flex;
    width: 22px;
    font-size: 16px;
    margin-right: 12px;
    color: var(--accent);
  }

  .btn-loja-nav {
    margin-top: 24px;
    justify-content: center;
    border-radius: 980px !important;
    border-bottom: none !important;
    font-size: 17px !important;
    min-height: 48px;
  }

  #nomeUsuario {
    max-width: 72px;
  }
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .container {
    padding: 20px 16px 80px;
  }

  .layout-loja {
    flex-direction: column;
  }

  .menu-lateral {
    width: 100%;
    position: static;
  }

  .loja-kicker {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0;
  }

  .loja-intro {
    text-align: left;
    padding: 0 14px;
  }

  .grid-livro,
  .grid-fardamento,
  .grid-listas,
  .area-kits {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .cardlivros,
  .cardfardamento,
  .cardlista,
  .cardkit {
    min-height: 0;
    padding: 10px;
    border-radius: 16px;
  }

  .cardlivros img,
  .cardfardamento img,
  .cardlista img,
  .cardkit img {
    height: 88px;
  }

  .carrinho {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
    border-radius: 22px 22px 0 0;
    max-height: 78dvh;
  }
}

@media (max-width: 360px) {
  .grid-livro,
  .grid-fardamento,
  .grid-listas,
  .area-kits {
    grid-template-columns: 1fr;
  }
}
