
:root{
  --yellow:#F9D43A;
  --blue:#1E3A8A;
  --red:#E11D48;
  --bg:#f5f5f7;
  --text:#0f172a;
  --muted:#6b7280;
  --radius:12px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:Inter,system-ui,Arial,sans-serif;background:var(--bg);color:var(--text)}
a{color:inherit;text-decoration:none}
.container{max-width:1200px;margin:0 auto;padding:16px}
/* Header */
.header{position:sticky;top:0;z-index:100;background:var(--yellow);box-shadow:0 2px 0 rgba(0,0,0,.05)}
.header-inner{display:flex;align-items:center;gap:16px;padding:10px 16px}
.logo{display:flex;align-items:center;gap:8px}
.logo img{height:36px}
.search{flex:1;display:flex;align-items:center;background:#fff;border-radius:24px;padding:8px 12px;gap:8px}
.search input{flex:1;border:none;outline:none;font-size:14px}
.header-icons{display:flex;align-items:center;gap:12px}
.iconbtn{position:relative;border:none;background:#0000;padding:8px;border-radius:50%;cursor:pointer}
.iconbtn .badge{position:absolute;top:-4px;right:-4px;background:var(--red);color:#fff;border-radius:999px;padding:2px 6px;font-size:12px}
.social{display:flex;gap:10px}
.social a{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:999px;background:#fff;outline:1px solid rgba(0,0,0,.05)}
/* Layout */
.layout{display:grid;grid-template-columns:280px 1fr;gap:16px;margin-top:16px}
@media(max-width:900px){.layout{grid-template-columns:1fr} .sidebar{order:2}}
.card{background:#fff;border-radius:var(--radius);box-shadow:0 1px 0 rgba(0,0,0,.06)}
/* Sidebar */
.sidebar{padding:16px}
.section-title{font-weight:700;margin-bottom:8px}
.range{padding:12px;border:1px solid #eee;border-radius:12px}
.range .inputs{display:flex;gap:8px;margin-top:8px}
.range input[type="number"]{width:100%;padding:8px;border:1px solid #ddd;border-radius:8px}
.dual-range{position:relative;height:32px;margin-top:6px}
.dual-range input[type=range]{position:absolute;left:0;right:0;top:0;bottom:0;width:100%;pointer-events:none;background:transparent;-webkit-appearance:none;appearance:none}
.dual-range input::-webkit-slider-thumb{pointer-events:auto;-webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid var(--blue)}
.dual-range input::-moz-range-thumb{pointer-events:auto;width:18px;height:18px;border-radius:50%;background:#fff;border:2px solid var(--blue)}
.track{position:absolute;height:6px;left:0;right:0;top:13px;border-radius:999px;background:#e5e7eb}
.track .fill{position:absolute;height:100%;left:0;right:0;background:var(--yellow);border-radius:999px}
.filters{margin-top:16px}
.category-search{width:100%;padding:8px;border:1px solid #ddd;border-radius:8px;margin-bottom:8px}
.cat-list{display:grid;gap:6px;max-height:260px;overflow:auto;padding-right:6px}
.cat-item{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border:1px solid #eee;border-radius:8px}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.chip{background:#fff3;border:1px dashed #e5e7eb;border-radius:999px;padding:4px 8px;font-size:12px}
/* Topbar */
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.sort{padding:8px;border:1px solid #ddd;border-radius:8px;background:#fff}
/* Grid */
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
@media(max-width:1200px){.grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:900px){.grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:560px){.grid{grid-template-columns:repeat(1,1fr)}}
.product{position:relative;padding:10px}
.product img{width:100%;height:180px;object-fit:cover;border-radius:10px;background:#f3f4f6}
.ribbon{position:absolute;left:10px;top:10px;background:var(--red);color:#fff;padding:4px 8px;border-radius:8px;font-size:12px;font-weight:700}
.badge{position:absolute;right:10px;top:10px;background:var(--yellow);padding:4px 8px;border-radius:8px;border:1px solid var(--blue);font-size:12px}
.product .brand{font-size:12px;color:var(--muted);margin-top:6px}
.product .title{font-weight:700;line-height:1.25;margin:4px 0;min-height:42px}
.price{display:flex;align-items:center;gap:8px;margin:6px 0}
.price .current{color:var(--red);font-weight:800}
.price .old{text-decoration:line-through;color:var(--muted);font-size:12px}
.btn{display:inline-flex;align-items:center;justify-content:center;padding:10px 12px;border:none;border-radius:999px;background:var(--yellow);cursor:pointer;font-weight:700}
.btn:active{transform:translateY(1px)}
/* Mini cart panel */
.drawer{position:fixed;top:0;right:-400px;width:360px;max-width:92vw;height:100dvh;background:#fff;box-shadow:-8px 0 24px rgba(0,0,0,.12);transition:right .25s ease;z-index:120}
.drawer.open{right:0}
.drawer-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #eee}
.drawer-body{padding:12px 16px;display:grid;gap:10px;overflow:auto;height:calc(100dvh - 130px)}
.drawer-footer{position:absolute;bottom:0;left:0;right:0;padding:12px 16px;border-top:1px solid #eee;background:#fff}
.cart-item{display:grid;grid-template-columns:64px 1fr auto;gap:10px;align-items:center}
.qty{display:inline-flex;align-items:center;gap:6px;border:1px solid #eee;border-radius:999px;padding:4px 8px}
.qty button{border:none;background:#0000;padding:4px 8px;cursor:pointer}
/* Overlay detail */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;z-index:110}
.overlay.show{display:block}
.modal{position:fixed;inset:0;display:none;justify-content:center;align-items:start;padding:40px 16px;z-index:111;overflow:auto}
.modal.show{display:flex}
.modal-card{background:#fff;border-radius:16px;max-width:1000px;width:100%;box-shadow:0 8px 30px rgba(0,0,0,.25);padding:16px}
.detail{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:900px){.detail{grid-template-columns:1fr}}
.detail img{width:100%;border-radius:10px;background:#f3f4f6}
.detail .title{font-size:22px;font-weight:800;margin:6px 0}
.sticky-add{position:sticky;bottom:0;background:#fff;padding:10px 0;margin-top:8px}
/* Banner anuncio */
.banner{display:none;align-items:center;justify-content:center;margin:12px 0}
.banner.show{display:flex}
.banner img{width:100%;border-radius:12px}
/* Footer */
.footer{margin-top:20px;padding:20px;text-align:center;color:var(--muted)}

/* Effects layer (SVG background) */
#effects-layer{position:fixed;inset:0;z-index:101;pointer-events:none;background-repeat:no-repeat;background-position:center;background-size:contain;opacity:0.85}

/* Social icons refinement */
.social a img{width:18px;height:18px}

/* Mobile filters button and sheet */
.mobile-filters-bar{display:none;margin:8px 0}
@media(max-width:900px){.mobile-filters-bar{display:block} .sidebar{display:none}}
.sheet{position:fixed;left:0;right:0;bottom:-100%;z-index:112;transition:bottom .25s ease;background:transparent}
.sheet.open{bottom:0}
.sheet-inner{background:#fff;border-top-left-radius:16px;border-top-right-radius:16px;box-shadow:0 -8px 24px rgba(0,0,0,.2);max-height:80vh;display:flex;flex-direction:column}
.sheet-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #eee}
.sheet-body{padding:12px 16px;overflow:auto}
.sheet-footer{padding:12px 16px;border-top:1px solid #eee;background:#fff}

/* --- Mobile fixes --- */
@media(max-width:900px){
  .header-inner{gap:8px}
  .search{min-width:0}
  .product img{height:160px}
  .topbar{gap:8px}
}
/* Sidebar inside sheet should be visible */
.sheet .sidebar{display:block !important; width:100%}

/* Modal close button */
.modal-card{position:relative}
.modal-close{position:absolute;top:8px;right:8px;border:none;background:#111;color:#fff;
  border-radius:999px;width:28px;height:28px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.modal-close:active{transform:translateY(1px)}

/* Floating promo (optional) */
#floating-promo{position:fixed;z-index:105;pointer-events:auto}
#floating-promo .card{padding:0;overflow:hidden}
#floating-promo .close{position:absolute;top:6px;right:6px;background:#111;color:#fff;border:none;border-radius:999px;width:24px;height:24px;cursor:pointer}
#floating-promo img{display:block;max-width:100%;height:auto}
/* positions */
#floating-promo.br{right:16px;bottom:16px}
#floating-promo.bl{left:16px;bottom:16px}
#floating-promo.tr{right:16px;top:16px}
#floating-promo.tl{left:16px;top:16px}
@media(max-width:900px){
  #floating-promo{max-width:180px}
}

/* --- Mobile header refinements --- */
@media(max-width:560px){
  .header-inner{flex-wrap:wrap; gap:6px}
  .logo{order:1}
  .social{order:2; display:flex; gap:6px; margin-left:auto}
  #open-cart{order:2}
  .search{order:3; width:100%}
  .social a{width:26px;height:26px}
  .social a img{width:16px;height:16px}
}

.product img{object-fit:contain;background:#f1f3f5;border-radius:10px}
/* Ensure card image height consistent */
@media(min-width:901px){ .product img{height:210px;width:100%} }
@media(max-width:900px){ .product img{height:180px;width:100%} }

/* Mobile header: search goes full width in second row */
@media(max-width:560px){
  .header-inner{flex-wrap:wrap;gap:6px}
  .search{order:3;flex:0 0 100%;width:100%}
  .logo{order:1}
  .social{order:2;margin-left:auto}
  #open-cart{order:2}
}

/* Detail modal gallery */
.detail-left{position:relative;display:flex;flex-direction:column;gap:8px}
.detail-left img#mainImg{width:560px;max-width:40vw;height:420px;object-fit:contain;background:#f1f3f5;border-radius:14px}
.detail-left .thumbs{display:flex;gap:8px;flex-wrap:wrap}
.detail-left .thumbs img{width:64px;height:64px;object-fit:cover;border-radius:8px;border:1px solid #eee;cursor:pointer}
.detail-left .nav{position:absolute;top:45%;transform:translateY(-50%);background:#111;color:#fff;border:none;border-radius:999px;width:36px;height:36px;display:flex;align-items:center;justify-content:center;cursor:pointer;opacity:.85}
.detail-left .nav.prev{left:8px}
.detail-left .nav.next{right:8px}
@media(max-width:900px){
  .detail-left img#mainImg{width:86vw;max-width:86vw;height:46vh}
}
