/* =========================
   Theme (Dark / Light)
   Toggle using: <html data-theme="light">
   ========================= */

/* DARK (default) */
:root{
  --bg:#0b0e14;
  --card:#121826;
  --surface:rgba(255,255,255,.04);
  --surface2:rgba(255,255,255,.06);
  --txt:#e9ecf4;
  --muted:#8b93a7;
  --pri:#4f7cff;
  --bd:rgba(255,255,255,.10);
  --topbar-bg:rgba(11,14,20,.85);
  --input-bg:rgba(255,255,255,.04);
  --shadow: 0 10px 30px rgba(0,0,0,.25);
}

/* LIGHT */
html[data-theme="light"]{
  --bg:#f5f7fb;
  --card:#ffffff;
  --surface:rgba(15,23,42,.04);
  --surface2:rgba(15,23,42,.06);
  --txt:#0f172a;         /* slate-900 */
  --muted:#475569;       /* slate-600 */
  --pri:#2563eb;         /* blue-600 */
  --bd:rgba(15,23,42,.12);
  --topbar-bg:rgba(255,255,255,.85);
  --input-bg:rgba(15,23,42,.04);
  --shadow: 0 10px 30px rgba(2,6,23,.08);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto;
  background:var(--bg);
  color:var(--txt);
  transition: background .18s ease, color .18s ease;
}

a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}

.container{max-width:1100px;margin:0 auto;padding:16px}

/* Topbar */
.topbar{
  position:sticky;top:0;
  background:var(--topbar-bg);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--bd);
  z-index:10;
}
.topbar__inner{display:flex;gap:12px;align-items:center;justify-content:space-between}
.brand{font-weight:800;letter-spacing:.2px}

/* Search */
.search{display:flex;gap:8px;flex:1;max-width:520px}
.search input{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--bd);
  border-radius:10px;
  background:var(--input-bg);
  color:var(--txt);
}
.search button{
  padding:10px 12px;
  border:1px solid var(--bd);
  border-radius:10px;
  background:var(--surface2);
  color:var(--txt);
  cursor:pointer;
}

.cartlink{padding:10px 12px;border:1px solid var(--bd);border-radius:10px;background:var(--surface)}
.cartlink:hover{background:var(--surface2)}

/* Nav cats */
.navcats{border-top:1px solid var(--bd)}
.navcats__inner{display:flex;gap:10px;align-items:center;overflow:auto;padding:10px 16px}
.navcats__inner a{white-space:nowrap;padding:8px 10px;border:1px solid transparent;border-radius:999px}
.navcats__inner a:hover{border-color:var(--bd);background:var(--surface)}
.navspacer{flex:1}
.navlink{color:var(--muted)}
.navlink:hover{color:var(--txt)}

/* Toast */
.toast{
  position:fixed;right:16px;bottom:16px;
  background:var(--surface2);
  border:1px solid var(--bd);
  padding:12px 14px;border-radius:14px;
  backdrop-filter:blur(8px);
  box-shadow:var(--shadow);
}

/* Card + Buttons */
.card{
  background:var(--card);
  border:1px solid var(--bd);
  border-radius:16px;
  padding:16px;
  box-shadow:var(--shadow);
  transition: background .18s ease, border-color .18s ease;
}
.btn{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 14px;border-radius:12px;
  border:1px solid var(--bd);
  background:var(--surface2);
  color:var(--txt);
  cursor:pointer;
}
.btn:hover{background:var(--surface)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn--primary{background:var(--pri);border-color:transparent;color:#fff}
.btn--primary:hover{filter:brightness(.98)}
.btn--ghost{background:transparent}
.muted{color:var(--muted);font-size:.92rem}
.pill{display:inline-block;padding:2px 8px;border:1px solid var(--bd);border-radius:999px;color:var(--muted);font-size:.8rem}
.ok{color:#16a34a}
.bad{color:#dc2626}

.section{margin:18px 0 28px}
.section__head{display:flex;justify-content:space-between;gap:12px;align-items:flex-end;flex-wrap:wrap}
.section__head h1,.section__head h2{margin:0}

/* Hero */
.hero{margin-top:18px}
.hero__inner{
  display:grid;grid-template-columns:1.2fr .8fr;gap:16px;
  background:linear-gradient(135deg, color-mix(in srgb, var(--pri) 18%, transparent), var(--surface));
  border:1px solid var(--bd);
  border-radius:20px;
  padding:18px;
}
.hero h1{margin:0 0 10px;font-size:2rem;line-height:1.1}
.hero__actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.hero__badge{display:flex;flex-direction:column;gap:10px}
.badge{background:var(--surface2);border:1px solid var(--bd);padding:12px;border-radius:16px}

/* Categories + products grid */
.cats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.cat{
  background:var(--surface);
  border:1px solid var(--bd);
  border-radius:16px;
  padding:14px;
  display:flex;flex-direction:column;gap:6px;
}
.cat:hover{background:var(--surface2)}
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}

.pcard{
  border:1px solid var(--bd);
  border-radius:16px;
  overflow:hidden;
  background:var(--surface);
  transition: transform .12s ease, background .18s ease;
}
.pcard:hover{background:var(--surface2); transform: translateY(-1px)}
.pcard__img{display:block;aspect-ratio:4/3;overflow:hidden}
.pcard__img img{width:100%;height:100%;object-fit:cover;transition:transform .18s ease}
.pcard:hover .pcard__img img{transform:scale(1.03)}
.pcard__body{padding:12px}
.pcard__title{display:block;font-weight:650;margin-bottom:8px}
.pcard__meta{display:flex;justify-content:space-between;align-items:center;gap:10px}
.price{font-weight:700}
.price--old{text-decoration:line-through;color:var(--muted);font-weight:600;margin-right:6px}

/* Product page */
.product{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-top:16px}
.product__main{border-radius:16px; width: 100%; border:1px solid var(--bd);background:var(--surface)}
.thumbs{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.thumb{padding:0;border:1px solid var(--bd);border-radius:10px;overflow:hidden;background:transparent;cursor:pointer;width:74px;height:58px}
.thumb:hover{background:var(--surface)}
.thumb img{width:100%;height:100%;object-fit:cover}
.product__price{margin:10px 0 6px;font-size:1.25rem}
.prose{line-height:1.6}

/* Forms */
.form{display:flex;flex-direction:column;gap:10px}
.form input,.form textarea,.filters input,.filters select{
  width:100%;
  padding:10px 12px;
  border:1px solid var(--bd);
  border-radius:12px;
  background:var(--input-bg);
  color:var(--txt);
}
.form textarea{min-height:110px;resize:vertical}
.filters{display:flex;gap:10px;align-items:center}
.row{display:flex;gap:10px;align-items:center;margin-top:10px}
.row--end{justify-content:flex-end}
.gap{gap:12px}

/* Tables / cart */
.table{display:grid;gap:8px}
.thead,.trow{display:grid;grid-template-columns: 2fr 140px 120px 120px 120px;gap:10px;align-items:center}
.thead{color:var(--muted);font-size:.9rem;border-bottom:1px solid var(--bd);padding-bottom:8px}
.trow{padding:10px 0;border-bottom:1px solid var(--bd)}
.trow input{width:100%}

.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:12px}
.list li{display:flex;justify-content:space-between;gap:12px;border-bottom:1px solid var(--bd);padding-bottom:10px}

.pager{display:flex;gap:10px;align-items:center;justify-content:center;margin-top:18px}

/* Footer */
.footer{border-top:1px solid var(--bd);margin-top:24px}
.footer__grid{display:flex;gap:16px;margin-bottom:10px;flex-wrap:wrap}

/* Quantity stepper */
.qty{display:flex;align-items:center;gap:8px;justify-content:flex-end}
.qty__btn{
  width:36px;height:36px;
  border-radius:6px; /* not round */
  border:1px solid var(--bd);
  background:var(--surface2);
  color:var(--txt);
  cursor:pointer;
  font-weight:800;
}
.qty__btn:hover{background:var(--surface)}
.qty__input{
  width:72px;
  text-align:center;
  border-radius:10px;
}

@media (max-width:900px){
  .grid{grid-template-columns:repeat(2,1fr)}
  .cats{grid-template-columns:repeat(2,1fr)}
  .hero__inner{grid-template-columns:1fr}
  .product{grid-template-columns:1fr}
  .grid2{grid-template-columns:1fr}
  .search{display:none}
  .thead{display:none}
  .trow{grid-template-columns:1fr;gap:12px;padding:14px 0}
  .trow > div{display:flex;justify-content:space-between;align-items:center;gap:12px}
  .trow > div:first-child{display:block}
  .qty{justify-content:flex-end}
}

.brand--logo{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand--logo img{
  height:45px;
  width:auto;
  display:block;
}


.btn--primary{
  padding:21px 22px;
  font-size:1rem;
  border-radius:10px;
}

.product__actions{
  display:flex;
  justify-content:center;
  margin-top:16px;
}
@media (max-width:600px){
  .product__form-row{
    flex-direction:column;
    width:100%;
  }

  .product__form-row button{
    width:100%;
  }
}
@media (max-width:900px){

  .thead{display:none}

  .trow{
    grid-template-columns:1fr;
    gap:14px;
    padding:16px 0;
  }

  .trow > div{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
  }

  .trow > div[data-label]::before{
    content: attr(data-label);
    font-size:.9rem;
    color:var(--muted);
  }

  /* Produto vira bloco */
  .trow > div:first-child{
    display:block;
  }

  .qty{
    justify-content:flex-end;
  }

  .qty__input{
    width:80px;
  }

  .trow > div:last-child{
    justify-content:flex-end;
  }

}
.cartprod{
  display:flex;
  align-items:center;
  gap:12px;
}

.cartprod__img{
  width:54px;
  height:54px;
  border-radius:12px;
  overflow:hidden;
  border:1px solid var(--bd);
  background:rgba(255,255,255,.04);
  flex:0 0 auto;
}

.cartprod__img img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.cartprod__img--ph{
  display:block;
}

.cartprod__info{
  min-width:0;
}

.cartprod__name{
  display:block;
  font-weight:650;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:320px;
}

@media (max-width:900px){
  .cartprod__name{width:65px}
}
/* --- Carrinho: produto com imagem --- */
.cartprod{
  display:flex;
  align-items:center;
  gap:12px;
}
.cartprod__img{
  width:54px;
  height:54px;
  border-radius:12px;
  overflow:hidden;
  border:1px solid var(--bd);
  background:rgba(255,255,255,.04);
  flex:0 0 auto;
}
.cartprod__img img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.cartprod__img--ph{display:block}
.cartprod__info{min-width:0}
.cartprod__name{
  display:block;
  font-weight:650;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:320px;
}

/* --- Mobile: transformar cada linha em card + imagem centralizada (máx 64px) --- */
@media (max-width:900px){
  .thead{display:none}

  .trow{
    background:rgba(255,255,255,.03);
    border:1px solid var(--bd);
    border-radius:16px;
    padding:14px;
    margin:10px 0;
    grid-template-columns:1fr;
    gap:12px;
  }

  /* linhas com label e valor */
  .trow > div{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
  }
  .trow > div[data-label]::before{
    content: attr(data-label);
    font-size:.9rem;
    color:var(--muted);
  }

  /* primeira área (produto) vira layout central */
  .trow > div:first-child{
    display:flex;
    flex-direction:column;
    align-items:center;      /* centraliza */
    justify-content:center;
    text-align:center;
    gap:10px;
  }
  .trow > div:first-child::before{
    display:none; /* some "Produto:" */
  }

  /* imagem maior no mobile (até 64px) e central */
  .cartprod{
    flex-direction:column;
    align-items:center;
    gap:10px;
  }
  .cartprod__img{
    width:100px;
    height:100px;
    border-radius:16px;
  }

  .cartprod__name{
    max-width:85vw;
    white-space:normal;
  }

  /* qty alinhada à direita */
  .qty{justify-content:flex-end}
  .qty__input{width:86px}

  /* ações (remover) alinhado à direita */
  .trow > div:last-child{justify-content:flex-end}
}

.thumb.is-active{
  border-color: var(--pri);
  box-shadow: 0 0 0 2px rgba(79,124,255,.25);
}

.product__gallery{position:relative}

.galleryCounter{
  position:absolute;
  right:12px;
  bottom:12px;
  background:rgba(0,0,0,.55);
  color:#fff;
  border:1px solid rgba(255,255,255,.18);
  padding:6px 10px;
  border-radius:999px;
  font-size:.85rem;
  backdrop-filter: blur(8px);
}
[data-theme="light"] .galleryCounter{
  background:rgba(255,255,255,.75);
  color:#111;
  border-color:rgba(0,0,0,.12);
}



/* =========================
   Premium polish
   ========================= */
.pcard{box-shadow:0 10px 30px rgba(0,0,0,.18)}
[data-theme="light"] .pcard{box-shadow:0 10px 30px rgba(0,0,0,.08)}

.product__head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}
.product__head h1{margin:0;font-size:1.8rem;line-height:1.15}
.product__meta{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin-top:8px}
.premiumPrice{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.pill--sale{background:rgba(255,125,125,.12);color:#ff7d7d;border-color:rgba(255,125,125,.25)}
[data-theme="light"] .pill--sale{background:rgba(255,0,0,.08);color:#b00020;border-color:rgba(176,0,32,.18)}

.benefits{list-style:none;margin:12px 0 14px;padding:0;display:flex;flex-direction:column;gap:8px}
.benefits li{display:flex;gap:8px;align-items:center;color:var(--muted)}

.addcart{position:relative}
.addcart__row{justify-content:space-between}
.addcart__qty{max-width:150px}
.addcart__btn{min-width:180px}

.stickyBuy{
  display:none;
  position:fixed;
  left:0;right:0;bottom:0;
  padding:10px 12px;
  background:rgba(11,14,20,.88);
  border-top:1px solid var(--bd);
  backdrop-filter:blur(10px);
  z-index:50;
  gap:10px;
  align-items:center;
}
.stickyBuy__price{font-weight:800}
.stickyBuy__btn{flex:1;justify-content:center}
@media (max-width:900px){
  .stickyBuy{display:flex}
  body{padding-bottom:70px}
}

/* Gallery counter */
.product__gallery{position:relative}
.galleryCounter{
  position:absolute;right:12px;bottom:12px;
  background:rgba(0,0,0,.55);
  color:#fff;
  border:1px solid rgba(255,255,255,.18);
  padding:6px 10px;
  border-radius:999px;
  font-size:.85rem;
  backdrop-filter: blur(8px);
}
[data-theme="light"] .galleryCounter{
  background:rgba(255,255,255,.75);
  color:#111;
  border-color:rgba(0,0,0,.12);
}

/* Carrinho: produto com miniatura (até 64px) */
.cartprod{display:flex;gap:12px;align-items:center}
.cartprod__img{
  width:64px;height:64px;flex:0 0 64px;
  border-radius:14px;
  border:1px solid var(--bd);
  overflow:hidden;
  background:rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  justify-content:center;
}
.cartprod__img img{width:100%;height:100%;object-fit:cover}
.cartprod__img--ph::after{content:'🖼️';opacity:.5}
.cartprod__name{font-weight:700;display:block;margin-bottom:4px}

/* Mobile: mostrar labels da tabela (Preço/Subtotal etc.) */
@media (max-width:900px){
  .trow{padding:14px 0}
  .trow > [data-label]{display:flex;justify-content:space-between;gap:12px}
  .trow > [data-label]::before{
    content: attr(data-label);
    color: var(--muted);
    font-size: .92rem;
  }
}
