@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700&family=Barlow:wght@300;400;500&family=Share+Tech+Mono&display=swap');
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --bg:#0f1117;--bg2:#161b26;--bg3:#1e2535;--bg4:#242d42;
  --border:#2a3148;--accent:#e84040;--accent2:#ff6b35;--green:#3fb950;
  --text:#c8d0e0;--text-dim:#6b7a99;--text-head:#eaf0ff;
  --mono:'Share Tech Mono',monospace;--head:'Barlow Condensed',sans-serif;
  --body:'Barlow',sans-serif;--radius:6px;--shadow:0 4px 24px rgba(0,0,0,.45);
  --header-h:62px;--sidebar-w:240px;
}
html{font-size:16px;scroll-behavior:smooth}
body{background:var(--bg);color:var(--text);font-family:var(--body);line-height:1.6;min-height:100vh}
a{color:var(--accent);text-decoration:none;transition:color .2s}
a:hover{color:var(--accent2)}
img{display:block;max-width:100%}

/* ── LAYOUT ── */
.wrapper{
  display:grid;
  grid-template-columns:var(--sidebar-w) 1fr;
  grid-template-rows:var(--header-h) 1fr auto;
  grid-template-areas:"header header" "sidebar main" "footer footer";
  min-height:100vh;
}

/* ── HEADER ── */
.site-header{
  grid-area:header;background:var(--bg2);
  border-bottom:2px solid var(--accent);
  padding:0 1.2rem;
  display:flex;align-items:center;gap:.8rem;
  height:var(--header-h);position:sticky;top:0;z-index:200;
  box-shadow:var(--shadow);
}
.site-logo{font-family:var(--head);font-size:1.5rem;font-weight:700;letter-spacing:.08em;color:var(--text-head);white-space:nowrap;flex-shrink:0}
.site-logo span{color:var(--accent)}

/* Wyszukiwarka – rośnie, ale nie za bardzo */
.search-form{flex:1 1 0;min-width:0;display:flex;gap:.35rem;max-width:460px}
.search-form input{
  flex:1 1 0;min-width:0;
  background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);
  padding:.42rem .8rem;color:var(--text);font-family:var(--body);font-size:.9rem;
  outline:none;transition:border-color .2s;
}
.search-form input:focus{border-color:var(--accent)}
.search-form input::placeholder{color:var(--text-dim)}
.search-form button{
  flex-shrink:0;background:var(--accent);color:#fff;border:none;
  border-radius:var(--radius);padding:.42rem .9rem;
  font-family:var(--head);font-size:.9rem;font-weight:600;letter-spacing:.03em;
  cursor:pointer;transition:background .2s;white-space:nowrap;
}
.search-form button:hover{background:var(--accent2)}

/* Prawa strona headera – zawsze w jednej linii */
.header-right{
  display:flex;align-items:center;gap:.4rem;
  flex-shrink:0;margin-left:auto;
}
.view-toggle{display:flex;gap:.25rem}
.view-btn{
  background:var(--bg3);border:1px solid var(--border);border-radius:var(--radius);
  padding:.38rem .6rem;color:var(--text-dim);cursor:pointer;
  transition:all .2s;font-size:.95rem;line-height:1;
}
.view-btn.active,.view-btn:hover{background:var(--accent);border-color:var(--accent);color:#fff}

.sidebar-toggle{
  display:none;background:var(--bg3);border:1px solid var(--border);
  border-radius:var(--radius);padding:.38rem .6rem;color:var(--text-dim);
  cursor:pointer;font-size:1rem;line-height:1;
}

.admin-link{
  display:inline-flex;align-items:center;gap:.3rem;
  padding:.32rem .7rem;border:1px solid var(--border);border-radius:var(--radius);
  color:var(--text-dim);font-family:var(--head);font-size:.82rem;font-weight:600;
  letter-spacing:.03em;white-space:nowrap;transition:all .2s;flex-shrink:0;
}
.admin-link:hover{border-color:var(--accent);color:var(--accent)}
.admin-link--logged{border-color:var(--accent);color:var(--accent);background:rgba(232,64,64,.08)}
.admin-link--logged:hover{background:rgba(232,64,64,.18)}

/* ── SIDEBAR ── */
.site-sidebar{
  grid-area:sidebar;background:var(--bg2);border-right:1px solid var(--border);
  position:sticky;top:var(--header-h);height:calc(100vh - var(--header-h));
  overflow-y:auto;overflow-x:hidden;
  display:flex;flex-direction:column;
  scrollbar-width:thin;scrollbar-color:var(--border) transparent;
}
.sidebar-section{border-bottom:1px solid var(--border)}
.sidebar-section:last-child{border-bottom:none}
.sidebar-section-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:.6rem 1rem .45rem;cursor:pointer;user-select:none;
}
.sidebar-section-title{font-family:var(--head);font-size:.7rem;font-weight:700;letter-spacing:.13em;text-transform:uppercase;color:var(--text-dim)}
.sidebar-section-arrow{color:var(--text-dim);font-size:.68rem;transition:transform .2s}
.sidebar-section.collapsed .sidebar-section-arrow{transform:rotate(-90deg)}
.sidebar-section-body{overflow:hidden;transition:max-height .25s ease}
.sidebar-section.collapsed .sidebar-section-body{max-height:0!important}

.sidebar-all-link{
  display:flex;align-items:center;gap:.45rem;
  padding:.45rem 1rem .45rem 1.2rem;color:var(--text-dim);font-size:.87rem;
  border-left:3px solid transparent;transition:all .12s;
}
.sidebar-all-link:hover{color:var(--text);background:var(--bg3);border-left-color:var(--border)}
.sidebar-all-link.active{color:var(--text-head);background:var(--bg3);border-left-color:var(--accent);font-weight:600}

.sidebar-node{display:block}
.sidebar-node-link{
  display:flex;align-items:center;gap:.42rem;padding:.4rem .8rem .4rem 0;
  color:var(--text-dim);font-size:.865rem;border-left:3px solid transparent;
  transition:background .1s,color .1s,border-color .1s;line-height:1.35;
}
.sidebar-node-link:hover{background:var(--bg3);color:var(--text);border-left-color:var(--border)}
.sidebar-node-link.ancestor{color:var(--text);background:rgba(255,255,255,.025)}
.sidebar-node-link.active{background:rgba(232,64,64,.1);color:var(--accent2);border-left-color:var(--accent);font-weight:600}
.sidebar-node-root>.sidebar-node-link{font-family:var(--head);font-size:.8rem;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--text);padding-top:.52rem;padding-bottom:.52rem}
.sidebar-cat-icon{font-size:.88rem;flex-shrink:0}
.sidebar-arrow{margin-left:auto;font-size:.66rem;opacity:.42;flex-shrink:0;padding-right:.5rem;transition:transform .15s}

/* Pola magazynowe – czysta lista */
.shelf-list{padding:.25rem 0 .5rem}
.shelf-item{
  display:flex;align-items:center;
  padding:.38rem 1rem .38rem 1.2rem;
  border-left:3px solid transparent;
  transition:all .12s;cursor:pointer;
  gap:.5rem;
}
.shelf-item:hover{background:var(--bg3);border-left-color:var(--border)}
.shelf-item.active{background:rgba(63,185,80,.08);border-left-color:var(--green)}
.shelf-item-name{
  font-family:var(--mono);font-size:.8rem;color:var(--text);
  flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.shelf-item.active .shelf-item-name{color:var(--green)}
.shelf-item-count{
  font-size:.7rem;font-family:var(--mono);
  background:var(--bg4);color:var(--text-dim);
  padding:.1rem .4rem;border-radius:10px;flex-shrink:0;
}
.shelf-item.active .shelf-item-count{background:rgba(63,185,80,.15);color:var(--green)}
.shelf-search{
  padding:.35rem .8rem;
  display:flex;
}
.shelf-search input{
  width:100%;background:var(--bg3);border:1px solid var(--border);
  border-radius:var(--radius);padding:.3rem .6rem;color:var(--text);
  font-family:var(--mono);font-size:.78rem;outline:none;
}
.shelf-search input:focus{border-color:var(--green)}

/* ── MAIN ── */
.site-main{grid-area:main;padding:1.5rem 2rem}
.page-title{font-family:var(--head);font-size:1.7rem;font-weight:700;letter-spacing:.04em;color:var(--text-head);margin-bottom:.25rem}
.results-info{font-size:.82rem;color:var(--text-dim);margin-bottom:1.2rem}

/* Breadcrumb */
.breadcrumb{display:flex;align-items:center;gap:.4rem;flex-wrap:wrap;font-size:.8rem;color:var(--text-dim);margin-bottom:.8rem}
.breadcrumb a{color:var(--text-dim)}.breadcrumb a:hover{color:var(--accent)}.breadcrumb span{opacity:.5}

/* Belka pola – kategorie na polu */
.shelf-header{
  background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);
  padding:1rem 1.2rem;margin-bottom:1.2rem;
}
.shelf-header-title{font-family:var(--head);font-size:1.1rem;font-weight:700;color:var(--text-head);margin-bottom:.5rem}
.shelf-cats{display:flex;flex-wrap:wrap;gap:.4rem}
.shelf-cat-tag{
  display:inline-flex;align-items:center;gap:.3rem;
  background:var(--bg3);border:1px solid var(--border);border-radius:20px;
  padding:.2rem .7rem;font-size:.78rem;color:var(--text-dim);
  transition:all .15s;
}
.shelf-cat-tag:hover{border-color:var(--accent);color:var(--text)}

/* ── KARTY PRODUKTÓW ── */
.product-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:1rem}
.product-card{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;transition:border-color .2s,box-shadow .2s}
.product-card:hover{border-color:var(--accent);box-shadow:var(--shadow)}
.card-img{background:var(--bg3);aspect-ratio:4/3;overflow:hidden;display:flex;align-items:center;justify-content:center}
.card-img img{width:100%;height:100%;object-fit:contain;transition:transform .3s}
.product-card:hover .card-img img{transform:scale(1.04)}
.card-body{padding:.7rem;flex:1;display:flex;flex-direction:column;gap:.15rem}
.card-index{font-family:var(--mono);font-size:.7rem;color:var(--accent);letter-spacing:.05em}
.card-name{font-size:.88rem;font-weight:500;line-height:1.35}
.card-name a{color:var(--text-head)}.card-name a:hover{color:var(--accent2)}
.card-subtitle{font-size:.76rem;color:var(--text-dim);font-style:italic;line-height:1.3}
.card-shelf{font-family:var(--mono);font-size:.7rem;color:var(--text-dim);margin-top:auto;padding-top:.3rem}

/* ── LISTA ── */
.product-list{display:flex;flex-direction:column;gap:.45rem}
.product-row{display:grid;grid-template-columns:76px 1fr;gap:.75rem;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;transition:border-color .15s}
.product-row:hover{border-color:var(--accent)}
.row-img{background:var(--bg3);display:flex;align-items:center;justify-content:center}
.row-img img{width:76px;height:60px;object-fit:contain}
.row-info{padding:.55rem .75rem .55rem 0;display:flex;flex-direction:column;justify-content:center;gap:.1rem}
.row-index{font-family:var(--mono);font-size:.7rem;color:var(--accent)}
.row-name{font-size:.88rem;font-weight:500}.row-name a{color:var(--text-head)}.row-name a:hover{color:var(--accent2)}
.row-subtitle{font-size:.76rem;color:var(--text-dim);font-style:italic}
.row-desc{font-size:.78rem;color:var(--text-dim);line-height:1.3}
.row-shelf{font-family:var(--mono);font-size:.7rem;color:var(--text-dim)}

/* ── DETAIL ── */
.btn-back{display:inline-flex;align-items:center;gap:.4rem;font-family:var(--head);font-size:.83rem;font-weight:600;letter-spacing:.05em;color:var(--text-dim);margin-bottom:1.2rem;border:1px solid var(--border);border-radius:var(--radius);padding:.28rem .8rem;transition:all .2s}
.btn-back:hover{color:var(--text);border-color:var(--text-dim)}
.product-detail{background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden}
.product-detail-grid{display:grid;grid-template-columns:380px 1fr}
.gallery-column{padding:1.3rem;border-right:1px solid var(--border);background:var(--bg3)}
.main-photo-wrap{position:relative;background:var(--bg2);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;aspect-ratio:4/3;display:flex;align-items:center;justify-content:center;cursor:zoom-in;margin-bottom:.7rem}
.main-photo-wrap img{max-width:100%;max-height:100%;object-fit:contain}
.thumb-row{display:grid;grid-template-columns:repeat(4,1fr);gap:.35rem}
.thumb-item{aspect-ratio:1;background:var(--bg2);border:2px solid var(--border);border-radius:var(--radius);overflow:hidden;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:border-color .15s}
.thumb-item img{width:100%;height:100%;object-fit:contain}
.thumb-item.active{border-color:var(--accent)}.thumb-item:hover{border-color:var(--text-dim)}
.product-info{padding:1.3rem 1.8rem}
.product-index{font-family:var(--mono);font-size:.78rem;color:var(--accent);letter-spacing:.06em;margin-bottom:.3rem}
.product-subtitle-head{font-size:.9rem;color:var(--text-dim);font-style:italic;margin-bottom:.8rem}
.product-info h1{font-family:var(--head);font-size:1.75rem;font-weight:700;color:var(--text-head);line-height:1.2;margin-bottom:.3rem}
.product-meta{display:flex;flex-direction:column;gap:.45rem;margin-bottom:1.2rem}
.meta-row{display:flex;align-items:baseline;gap:.5rem}
.meta-label{font-size:.73rem;color:var(--text-dim);font-family:var(--head);text-transform:uppercase;letter-spacing:.07em;min-width:130px;flex-shrink:0}
.meta-value{font-size:.92rem;color:var(--text)}.meta-value.shelf{font-family:var(--mono);color:var(--accent2)}
.product-description{font-size:.88rem;color:var(--text-dim);line-height:1.6}

/* ── LIGHTBOX ── */
.lightbox{position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,.92);display:flex;align-items:center;justify-content:center;transition:opacity .2s}
.lb-hidden{opacity:0;pointer-events:none}
.lb-img-wrap img{max-width:90vw;max-height:85vh;object-fit:contain;border-radius:var(--radius)}
.lb-close{position:fixed;top:1.3rem;right:1.3rem;background:rgba(255,255,255,.12);border:none;border-radius:50%;width:42px;height:42px;font-size:1.3rem;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}
.lb-close:hover{background:var(--accent)}
.lb-nav{position:fixed;top:50%;transform:translateY(-50%);background:rgba(255,255,255,.1);border:none;border-radius:var(--radius);width:46px;height:76px;font-size:1.8rem;color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .2s}
.lb-nav:hover{background:rgba(255,255,255,.25)}.lb-prev{left:1.2rem}.lb-next{right:1.2rem}
.lb-counter{position:fixed;bottom:1.2rem;left:50%;transform:translateX(-50%);color:rgba(255,255,255,.6);font-size:.8rem}

/* ── KOSZYK ── */
.cart-fab{
  position:fixed;bottom:1.5rem;right:1.5rem;z-index:150;
  background:var(--accent);color:#fff;border:none;border-radius:50px;
  padding:.6rem 1.1rem;font-family:var(--head);font-size:.95rem;font-weight:600;
  letter-spacing:.04em;cursor:pointer;box-shadow:0 4px 20px rgba(232,64,64,.5);
  display:flex;align-items:center;gap:.5rem;transition:background .2s,transform .15s;
}
.cart-fab:hover{background:var(--accent2);transform:translateY(-2px)}
.cart-fab-count{background:rgba(255,255,255,.25);border-radius:20px;padding:.05rem .45rem;font-size:.82rem}

/* ── MISC ── */
.empty-state{text-align:center;padding:4rem 2rem;color:var(--text-dim)}
.empty-state .empty-icon{font-size:3rem;margin-bottom:1rem}
.empty-state p{font-family:var(--head);font-size:1.2rem;letter-spacing:.04em}
.site-footer{grid-area:footer;background:var(--bg2);border-top:1px solid var(--border);padding:.8rem 1.5rem;text-align:center;font-size:.74rem;color:var(--text-dim);font-family:var(--mono)}

/* ── RESPONSIVE ── */
@media(max-width:1024px){
  :root{--sidebar-w:200px}
  .product-detail-grid{grid-template-columns:300px 1fr}
}
@media(max-width:768px){
  .wrapper{grid-template-columns:1fr;grid-template-areas:"header" "main" "footer"}
  .site-sidebar{position:fixed;top:var(--header-h);left:0;height:calc(100vh - var(--header-h));width:280px;z-index:150;transform:translateX(-100%);transition:transform .25s ease;box-shadow:4px 0 24px rgba(0,0,0,.6)}
  .site-sidebar.open{transform:translateX(0)}
  .sidebar-overlay{display:none;position:fixed;inset:0;top:var(--header-h);background:rgba(0,0,0,.55);z-index:140}
  .sidebar-overlay.visible{display:block}
  .sidebar-toggle{display:flex}
  .site-main{padding:1rem}
  .product-detail-grid{grid-template-columns:1fr}
  .gallery-column{border-right:none;border-bottom:1px solid var(--border)}
  .search-form{max-width:none}
}
@media(max-width:480px){
  .site-header{padding:0 .7rem;gap:.5rem}
  .site-logo{font-size:1.15rem}
  .admin-link .admin-link-text{display:none}
  .product-grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:.6rem}
  .product-row{grid-template-columns:60px 1fr}
  .row-shelf{display:none}
}
