:root{
  --bg:#0b0d10;
  --card:#11151b;
  --muted:#8ea0b7;
  --text:#eef2f7;
  --line:rgba(255,255,255,.08);
  --accent:#4aa3ff;
  --ok:#bba15a;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  background: radial-gradient(1000px 700px at 20% -20%, rgba(74,163,255,.18), transparent),
              radial-gradient(900px 500px at 90% -10%, rgba(187,161,90,.12), transparent),
              var(--bg);
  color:var(--text);
}

/* Top */
.topbar{
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; gap:12px;
  padding:10px 12px;
  background: rgba(11,13,16,.85);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
.iconbtn{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
}
.iconbtn:hover{border-color:rgba(255,255,255,.16)}
.brand{flex:1; min-width:0}
.brandTitle{font-weight:700}
.brandSub{font-size:12px; color:var(--muted); margin-top:2px}
.logoBox{width:40px; height:40px; display:grid; place-items:center}
.logoImg{width:28px; height:28px; opacity:.92}

/* Search */
.searchbar{
  position:sticky; top:56px; z-index:45;
  padding:10px 12px;
  background: rgba(11,13,16,.78);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
}
.searchgrid{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap:10px;
  align-items:end;
}
.field label{display:block; font-size:12px; color:var(--muted); margin-bottom:4px}
.field input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  outline:none;
}
.field input:focus{border-color:rgba(74,163,255,.6); box-shadow:0 0 0 3px rgba(74,163,255,.15)}
.actions{display:flex; gap:8px; justify-content:flex-end}
.btn{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(74,163,255,.35);
  background: rgba(74,163,255,.18);
  color:var(--text);
  cursor:pointer;
  font-weight:600;
}
.btn:hover{background: rgba(74,163,255,.24)}
.btn.ghost{
  border-color: var(--line);
  background: rgba(255,255,255,.04);
}
.btn.ghost:hover{border-color:rgba(255,255,255,.16)}

/* Layout */
.layout{
  height: calc(100vh - 56px - 72px);
  display:grid;
  grid-template-columns: 280px minmax(0,1fr) 340px;
  gap:12px;
  padding:12px;
}
.panel{
  border:1px solid var(--line);
  background: rgba(17,21,27,.75);
  backdrop-filter: blur(12px);
  border-radius:18px;
  box-shadow: var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.panelTitle{
  padding:12px 12px 8px;
  font-weight:800;
  border-bottom:1px solid var(--line);
}
.crumbs{
  padding:8px 12px;
  font-size:12px;
  color:var(--muted);
  border-bottom:1px solid var(--line);
  min-height:34px;
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
}

/* Nav lists */
.navBlock{padding:10px 12px; border-bottom:1px solid var(--line)}
.navTitle{font-size:12px; color:var(--muted); margin-bottom:8px}
.navList{display:flex; flex-direction:column; gap:8px; max-height:190px; overflow:auto; padding-right:6px}

.navItem{
  display:flex; justify-content:space-between; align-items:center;
  padding:10px 10px;
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  cursor:pointer;
}
.navItem:hover{border-color:rgba(255,255,255,.16)}
.navItem.active{border-color:rgba(74,163,255,.55); background: rgba(74,163,255,.10)}

.navLeft{display:flex; align-items:center; gap:10px; min-width:0}
.navLabel{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}

.badge{
  font-size:12px;
  color:var(--muted);
  border:1px solid var(--line);
  padding:2px 8px;
  border-radius:999px;
  flex:0 0 auto;
}

/* Mini thumbs (sidebar nav) */
.miniThumbFlag{
  width:22px;
  height:22px;
  border-radius:7px;
  border:1px solid var(--line);
  object-fit:cover;
  flex:0 0 auto;
}
.miniThumbCoin{
  /* ✅ +1.5x (avant 34x17) => 51x25.5 */
  width:51px;
  height:26px;
  border-radius:10px;
  border:1px solid var(--line);
  object-fit:cover;
  flex:0 0 auto;
}

/* Center */
.centerHeader{
  padding:12px 12px 10px;
  border-bottom:1px solid var(--line);
}
.centerTitle{font-weight:900; font-size:16px}
.centerMeta{font-size:12px; color:var(--muted); margin-top:4px}
.centerBody{padding:12px; overflow:auto; min-height:0}

.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:12px;
}
.card{
  border:1px solid var(--line);
  border-radius:18px;
  background: rgba(255,255,255,.03);
  padding:12px;
  cursor:pointer;
}
.card:hover{border-color:rgba(255,255,255,.16)}

.cardRow{display:flex; gap:12px; align-items:center}
.cardTitle{font-weight:800}
.cardSub{font-size:12px; color:var(--muted); margin-top:4px}
.muted{color:var(--muted); font-size:12px}

/* ✅ Thumb base */
.thumb{
  border-radius:14px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.02);
  display:grid; place-items:center;
  overflow:hidden;
  flex:0 0 auto;
}
.thumb img{width:100%; height:100%; object-fit:cover}

/* ✅ Pièce : 2:1 (+1.5x) */
/* avant 110x55 => 165x82.5 */
.thumbCoin{
  width:165px;
  height:83px;
}

/* ✅ Drapeau : carré */
.thumbFlag{
  width:78px;
  height:78px;
  border-radius:16px;
}

/* Model screen */
.modelHero{
  border:1px solid var(--line);
  border-radius:18px;
  background: rgba(255,255,255,.03);
  padding:14px;
  display:flex;
  gap:14px;
  align-items:flex-start;
}
.modelHeroRight{min-width:0; flex:1}
.modelMetaRow{
  margin-top:8px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.kv{
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  color:var(--muted);
}
.bigCta{
  margin-top:10px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(187,161,90,.55);
  background: rgba(187,161,90,.14);
  color:var(--text);
  cursor:pointer;
  font-weight:800;
}
.bigCta:hover{background: rgba(187,161,90,.20)}

/* Variants grid */
.variantsGrid{
  margin-top:12px;
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}
.variantCard{
  border-radius:18px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  padding:12px;
  display:flex;
  gap:12px;
  cursor:pointer;
  position:relative;
}
.variantCard:hover{border-color:rgba(255,255,255,.16)}
.variantCard.inCollection{
  border-color: rgba(187,161,90,.55);
  background: rgba(187,161,90,.12);
}
.variantThumb{
  /* ✅ +1.5x (avant 140x70 => 210x105) */
  width:210px;
  height:105px;
  border-radius:14px;
  border:1px solid var(--line);
  overflow:hidden;
  flex:0 0 auto;
  background: rgba(255,255,255,.02);
  position:relative;
}
.variantThumb img{width:100%; height:100%; object-fit:cover}
.unavailableBand{
  position:absolute;
  inset:auto 0 0 0;
  padding:6px 8px;
  font-size:12px;
  font-weight:800;
  background: rgba(0,0,0,.55);
  color:#fff;
}

/* Buttons */
.smallbtn{
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  padding:8px 10px;
  cursor:pointer;
  font-weight:700;
}
.smallbtn:hover{border-color:rgba(255,255,255,.16)}
.smallbtn.primary{border-color:rgba(74,163,255,.35); background: rgba(74,163,255,.18)}

/* Stock list (base) */
.stockCard{
  border:1px solid var(--line);
  border-radius:18px;
  padding:12px;
  background: rgba(255,255,255,.03);
  display:flex; justify-content:space-between; gap:12px;
  align-items:center;
}
.price{font-weight:900}

/* ✅ Stock list (BIG, adapté aux images DUO paysage) */
.stockCardBig{
  display:grid;
  grid-template-columns: 420px 1fr auto;  /* ✅ plus large qu'avant */
  gap:14px;
  align-items:center;
}
.stockBigImgWrap{
  width:420px;
  height:auto;                 /* ✅ pas de hauteur fixe */
  aspect-ratio: 2 / 1;         /* ✅ image_duo = paysage */
  border-radius:16px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.18);
  overflow:hidden;
  display:grid;
  place-items:center;
}
.stockBigImgWrap img{
  width:100%;
  height:100%;
  object-fit:contain;          /* ✅ pas de crop */
  display:block;
  cursor: zoom-in;
}
.stockBigMeta{min-width:0}
.stockBigRight{display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end}

@media (max-width: 740px){
  .stockCardBig{
    grid-template-columns: 1fr;
    align-items:stretch;
  }
  .stockBigImgWrap{
    width:100%;
    height:auto;
    aspect-ratio: 2 / 1;
  }
  .stockBigRight{justify-content:space-between}
}

/* Right hint */
.rightHint{padding:10px 12px}

/* Drawer */
.drawer{
  position:fixed; top:0; left:0;
  height:100%; width:320px;
  background: rgba(11,13,16,.96);
  border-right:1px solid var(--line);
  transform: translateX(-105%);
  transition: transform .18s ease;
  z-index:80;
  display:flex; flex-direction:column;
}
.drawer.open{transform: translateX(0)}
.drawerHeader{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px;
  border-bottom:1px solid var(--line);
}
.drawerTitle{font-weight:900}
.drawerBody{padding:12px; overflow:auto}
.drawerSection{margin-bottom:14px}
.drawerSectionTitle{font-size:12px; color:var(--muted); margin-bottom:8px}
.drawerLink{
  display:block;
  width:100%;
  text-align:left;
  color:var(--text);
  text-decoration:none;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  padding:10px 10px;
  border-radius:14px;
  margin-bottom:8px;
  cursor:pointer;
  font-weight:800;
}
.drawerLink:hover{border-color:rgba(255,255,255,.16)}
.backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.45);
  opacity:0; pointer-events:none;
  transition: opacity .18s ease;
  z-index:70;
}
.backdrop.open{opacity:1; pointer-events:auto}

@media (max-width: 1100px){
  .layout{grid-template-columns: 260px minmax(0,1fr) 300px}
  .grid{grid-template-columns: repeat(2, minmax(0,1fr))}
}
@media (max-width: 880px){
  .layout{grid-template-columns: 1fr}
  .left,.right{display:none}
  .searchgrid{grid-template-columns: 1fr 1fr; grid-auto-rows:auto}
  .actions{grid-column: 1 / -1; justify-content:stretch}
}

/* ===== Loader global (barre de progression) ===== */
.loaderBar {
  position: fixed;
  left: 0; right: 0; top: 0;
  height: 3px;
  z-index: 99999;
  pointer-events: none;
  background: rgba(255,255,255,0.06);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
}
.loaderBar.on {
  opacity: 1;
  transform: translateY(0);
}
.loaderBar .loaderFill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 0 999px 999px 0;
  transition: width .2s ease;
}
.loaderLabel {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 100000;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  color: rgba(255,255,255,.92);
  background: rgba(17,21,27,.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.loaderLabel.on {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Image zoom plein écran ===== */
.imgZoom{
  position:fixed;
  inset:0;
  z-index: 120000;
  display:none;
}
.imgZoom.open{ display:block; }

.imgZoomBackdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(2px);
}

.imgZoomCard{
  position:absolute;
  inset: 20px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 12px;
}

.imgZoomInner{
  position:relative;
  width: min(1400px, 96vw);
  height: min(92vh, 900px);
  display:flex;
  align-items:center;
  justify-content:center;
}

.imgZoomInner img{
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  border-radius: 16px;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  background: rgba(0,0,0,.25);
}

.imgZoomClose{
  position:absolute;
  top:-6px;
  right:-6px;
  width:42px;
  height:42px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: rgba(17,21,27,.78);
  color: var(--text);
  cursor:pointer;
  display:grid;
  place-items:center;
  font-weight:900;
}
.imgZoomClose:hover{border-color:rgba(255,255,255,.16)}

.imgZoomCaption{
  position:absolute;
  left: 8px;
  bottom: -44px;
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--line);
  background: rgba(17,21,27,.72);
  color: rgba(255,255,255,.92);
  font-size: 12.5px;
  max-width: 92%;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px){
  .imgZoomCard{ inset: 10px; }
  .imgZoomInner{ height: min(92vh, 780px); }
  .imgZoomCaption{ display:none; }
}
