/* =========================================================
   Planeta Jovem - Store UI
   - Topbar marketplace (mobile-first)
   - Grid de produtos estilo marketplace
   - Compatível com AdminLTE
========================================================= */

/* ===== Helpers ===== */
:root {
  --pj-radius: 14px;
  --pj-shadow: 0 10px 22px rgba(0,0,0,.10);
  --pj-shadow-soft: 0 6px 18px rgba(0,0,0,.06);
}

/* =========================================================
   TOPBAR / HEADER (mobile-first)
========================================================= */
.pj-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--pj-shadow-soft);
  background: #fff;
}

/* ✅ AdminLTE: remove o offset do sidebar no header da loja */
.main-header.navbar.pj-topbar,
.main-header.navbar.navbar-white.pj-topbar {
  margin-left: 0 !important;
  width: 100% !important;
  left: 0 !important;
  right: 0 !important;
}

/* Wrapper interno em duas linhas no mobile */
.pj-topbar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Linhas */
.pj-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Brand */
.pj-brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none !important;
  color: inherit !important;
  min-width: 0;
}

.pj-logo {
  height: 34px;
  width: auto;
}

.pj-brand {
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw; /* evita empurrar botões no mobile */
}

/* Search */
.pj-search .form-control {
  border-radius: 12px 0 0 12px;
}

.pj-search .btn {
  border-radius: 0 12px 12px 0;
}

/* Actions */
.pj-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.pj-actions .btn {
  white-space: nowrap;
}

.pj-btn-hide-xs { display: none; } /* esconder "Cadastrar" no mobile bem pequeno */

/* Cart badge */
.pj-cart-btn { position: relative; }

#pj-cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: none;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 0 6px;
  font-size: 12px;
  line-height: 20px;
}

/* Desktop: topbar vira uma linha */
@media (min-width: 992px) {
  .pj-topbar-wrap {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .pj-topbar-row-1 { flex: 0 0 auto; }
  .pj-topbar-row-2 { flex: 1 1 auto; }
  .pj-brand { max-width: none; }
  .pj-btn-hide-xs { display: inline-flex; }
}

/* =========================================================
   CONTEÚDO (evitar espaçamento estranho com topbar sticky)
========================================================= */
.content-wrapper {
  margin-left: 0 !important;
  width: 100%;
  padding-top: 6px;
}

/* (Opcional) se o footer estiver sendo empurrado por sidebar */
.main-footer {
  margin-left: 0 !important;
}

/* =========================================================
   GRID DE PRODUTOS (marketplace)
========================================================= */
.pj-grid {
  row-gap: 16px;
}

/* Card */
.pj-product-card {
  height: 100%;
  border-radius: var(--pj-radius);
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
  border: 1px solid rgba(0,0,0,.06);
}

.pj-product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--pj-shadow);
}

/* Thumb quadrada */
.pj-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #fff;
  display: block;
}

.pj-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Corpo do card com CTA sempre embaixo */
.pj-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Título 2 linhas */
.pj-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
  font-weight: 700;
  color: #111;
  text-decoration: none;
}

.pj-title:hover {
  text-decoration: underline;
}

/* Preço */
.pj-price {
  font-size: 20px;
  font-weight: 800;
}

/* Meta */
.pj-meta {
  color: #6c757d;
  font-size: 12px;
}

/* Bottom: empurra CTA para o rodapé do card */
.pj-bottom {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

/* Inputs e botão */
.pj-bottom .form-control {
  border-radius: 10px;
}

.pj-bottom .btn {
  border-radius: 12px;
}

/* =========================================================
   MICRO AJUSTES (opcional)
========================================================= */
/* deixa imagens mais “alinhadas” na grade */
.card-body.pj-card-body {
  padding: 12px;
}

/* deixa o header da card da listagem menos “pesado” */
.card-header .card-title {
  font-weight: 700;
}

/* =========================================================
   BANNER FULL (hero) - desktop + mobile
========================================================= */
.pj-hero {
  width: 100%;
  margin: 0;
  padding: 0;
}

.pj-hero-inner {
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  background: #f3f4f6;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* Altura responsiva */
.pj-hero-media {
  width: 100%;
  height: clamp(160px, 28vw, 360px);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Overlay opcional */
.pj-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,0) 65%);
  pointer-events: none;
}

/* Conteúdo opcional */
.pj-hero-content {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  color: #fff;
  max-width: 680px;
}

.pj-hero-title {
  font-weight: 900;
  font-size: clamp(20px, 2.4vw, 34px);
  margin: 0 0 6px 0;
  line-height: 1.1;
  text-shadow: 0 6px 18px rgba(0,0,0,.25);
}

.pj-hero-subtitle {
  font-size: clamp(12px, 1.2vw, 16px);
  margin: 0 0 12px 0;
  opacity: .95;
  text-shadow: 0 6px 18px rgba(0,0,0,.25);
}

/* Link clicável */
.pj-hero-link {
  display: block;
  text-decoration: none !important;
  color: inherit !important;
}

.pj-hero-spacer { height: 12px; }

/* ✅ Switch Desktop/Mobile via data-attrs */
.pj-hero-media[data-banner-desktop][data-banner-mobile] {
  background-image: var(--pj-banner-mobile);
}

/* a partir de lg (>=992px), usa desktop */
@media (min-width: 992px) {
  .pj-hero-media[data-banner-desktop][data-banner-mobile] {
    background-image: var(--pj-banner-desktop);
  }
}

@media (max-width: 991.98px) {
  .pj-hero-media {
    height: clamp(220px, 60vw, 420px);
  }
}

/* =========================================================
   PRODUTO (página) - galeria + buybox marketplace
========================================================= */

.pj-product-page{
  border-radius: 16px;
}

.pj-product-title{
  font-weight: 900;
  font-size: clamp(18px, 2.2vw, 28px);
  line-height: 1.1;
  margin: 0 0 12px 0;
}

.pj-gallery{
  display: grid;
  gap: 10px;
}

.pj-gallery-main{
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
}

.pj-gallery-main img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.pj-discount-badge{
  position: absolute;
  top: 12px;
  left: 12px;
  background: #dc3545;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  z-index: 2;
}

.pj-gallery-thumbs{
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.pj-thumb-btn{
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  background: #fff;
  padding: 0;
  width: 72px;
  height: 72px;
  overflow: hidden;
  flex: 0 0 auto;
  cursor: pointer;
  opacity: .9;
}

.pj-thumb-btn img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pj-thumb-btn.is-active{
  border-color: rgba(0,123,255,.9);
  box-shadow: 0 0 0 3px rgba(0,123,255,.15);
  opacity: 1;
}

.pj-buybox{
  display: flex;
  flex-direction: column;
}

.pj-price-area{
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.pj-old-price{
  color: #6c757d;
  text-decoration: line-through;
  font-weight: 700;
}

.pj-current-price{
  font-size: 30px;
  font-weight: 900;
}

.pj-save{
  color: #198754;
  font-weight: 700;
  font-size: 14px;
}

.pj-meta-line{
  color: #6c757d;
  font-size: 13px;
}

.pj-buy-btn{
  border-radius: 14px;
  font-weight: 800;
}

.pj-section-title{
  font-size: 16px;
  font-weight: 900;
  margin: 0 0 10px 0;
}

.pj-desc-text{
  color: #111;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Desktop: dá um “respiro” entre colunas */
@media (min-width: 992px){
  .pj-buybox{ padding-left: 10px; }
}
