/* ================================================
   LOJA PAGE — Mobile First
   ================================================ */

/* ------------------------------------------------
   CATEGORY NAV BAR (topo, scroll horizontal)
   ------------------------------------------------ */
.shop-cat-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.shop-cat-bar::-webkit-scrollbar { display: none; }

.shop-cat-inner {
  display: flex;
  align-items: center;
  white-space: nowrap;
  padding: 0 16px;
  min-width: max-content;
}
.shop-cat-inner a {
  display: inline-block;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.shop-cat-inner a:hover,
.shop-cat-inner a.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* ------------------------------------------------
   SHOP BANNER
   ------------------------------------------------ */
.shop-banner {
  overflow: hidden;
  max-height: 160px;
}
.shop-banner img {
  width: 100%;
  object-fit: cover;
  display: block;
}

/* ------------------------------------------------
   SHOP PAGE WRAPPER
   ------------------------------------------------ */
.shop-page {
  padding: 20px 0 64px;
}

/* ------------------------------------------------
   TOOLBAR (mobile-first)
   ------------------------------------------------ */
.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

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

#filterToggleBtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
#filterToggleBtn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.result-count {
  font-size: 12px;
  color: var(--muted);
}
.result-count strong { color: var(--text); }

.shop-toolbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  background: var(--white);
  color: var(--text);
  outline: none;
  cursor: pointer;
  font-family: var(--font);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2382838E' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.sort-select:focus { border-color: var(--blue); }

/* ------------------------------------------------
   LAYOUT: sidebar + grid
   ------------------------------------------------ */
.shop-layout {
  display: grid;
  grid-template-columns: 1fr; /* mobile: coluna única */
  gap: 24px;
  align-items: start;
}

/* ------------------------------------------------
   SIDEBAR — mobile: drawer, desktop: sticky column
   ------------------------------------------------ */
.shop-sidebar {
  background: var(--white);

  /* Mobile: drawer fixo */
  position: fixed;
  top: 0; left: 0;
  width: min(300px, 85vw);
  height: 100dvh;
  z-index: 500;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 24px rgba(0,0,0,.12);
  border-right: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.shop-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}
.sidebar-header h3 {
  font-family: var(--font-alt);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.sidebar-close-btn {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}
.sidebar-close-btn:hover { background: var(--black); color: var(--white); }

/* Category list inside sidebar */
#categoryList {
  padding: 12px 0 24px;
}

.cat-sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.cat-sidebar-btn:hover {
  background: var(--bg);
  color: var(--blue);
}
.cat-sidebar-btn.active {
  color: var(--blue);
  font-weight: 800;
  border-left-color: var(--blue);
  background: rgba(1,112,185,.04);
}

.cat-count {
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
}
.cat-sidebar-btn.active .cat-count {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* Price filter inside sidebar */
.sidebar-section {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}
.sidebar-section h4 {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 12px;
}
.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.price-inputs input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  font-family: var(--font);
  color: var(--text);
}
.price-inputs input:focus { border-color: var(--blue); }
.price-inputs span { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.price-apply-btn {
  margin-top: 10px;
  width: 100%;
  padding: 9px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity .2s;
  font-family: var(--font);
}
.price-apply-btn:hover { opacity: .8; }

/* ------------------------------------------------
   PRODUCT GRID — mobile first
   ------------------------------------------------ */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* mobile: 2 colunas */
  gap: 12px;
}

/* Skeleton loaders */
.product-card.skeleton {
  pointer-events: none;
}
.skeleton-img {
  aspect-ratio: 1;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-body { padding: 12px; }
.skeleton-line {
  height: 12px;
  border-radius: 4px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
.skeleton-line.short { width: 60%; }
.skeleton-line.price { width: 40%; height: 16px; }

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ------------------------------------------------
   Error / Empty states
   ------------------------------------------------ */
.shop-api-error,
.shop-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.shop-api-error i {
  font-size: 2.5rem;
  color: var(--red);
  margin-bottom: 16px;
}
.shop-api-error h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.shop-api-error p { font-size: 13px; margin-bottom: 6px; }
.shop-api-error code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.api-hint { margin-top: 12px; margin-bottom: 20px; }

/* ------------------------------------------------
   PAGINATION
   ------------------------------------------------ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px; height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}
.page-btn:hover,
.page-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--white);
}
.page-dots {
  color: var(--muted);
  font-size: 14px;
  line-height: 38px;
  padding: 0 4px;
}

/* ================================================
   TABLET — 640px+
   ================================================ */
@media (min-width: 640px) {
  .shop-banner { max-height: 200px; }
  .shop-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .shop-banner img { max-height: 200px; }
}

/* ================================================
   DESKTOP — 1024px+
   ================================================ */
@media (min-width: 1024px) {
  .shop-banner { max-height: 240px; }

  .shop-layout {
    grid-template-columns: 240px 1fr;
    gap: 32px;
  }

  /* Sidebar: vira coluna fixa no desktop */
  .shop-sidebar {
    position: sticky;
    top: 90px;
    height: auto;
    max-height: calc(100vh - 110px);
    transform: none !important;
    box-shadow: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow-y: auto;
  }

  /* Esconde botão de toggle e overlay no desktop */
  #filterToggleBtn { display: none; }
  .sidebar-close-btn { display: none; }
  .sidebar-overlay { display: none !important; }

  .shop-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

@media (min-width: 1280px) {
  .shop-layout { grid-template-columns: 260px 1fr; }
  .shop-grid { grid-template-columns: repeat(4, 1fr); }
}
