:root{
  --bg:#f3f5f7;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --primary:#c96f3a; /* warm */
  --primary-2:#b85d2a;
  --pay:#a9b84a;
  --danger:#ef4444;
  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --radius:14px;
}

.woopos{font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif; color:var(--text);}
.woopos *{box-sizing:border-box;}

.woopos-top{
  display:flex; align-items:center; gap:18px;
  background:var(--card); border:1px solid var(--line);
  border-radius: var(--radius);
  padding:14px 16px;
  box-shadow: var(--shadow);
}
.woopos-brand{display:flex; gap:12px; align-items:center; min-width:220px;}
.woopos-logo{width:40px; height:40px; border-radius:12px; background:linear-gradient(135deg,var(--primary),#f2b38a); display:grid; place-items:center; color:#fff; font-weight:800;}
.woopos-title{font-weight:800; line-height:1.1}
.woopos-sub{color:var(--muted); font-size:12px; margin-top:2px}

.woopos-search{display:flex; gap:10px; align-items:center; flex:1;}
.woopos-search input{
  width:100%; height:42px; border:1px solid var(--line); border-radius:999px;
  padding:0 14px; outline:none; background:#fff;
}
.woopos-search input:focus{border-color:#cbd5e1; box-shadow:0 0 0 4px rgba(201,111,58,.10)}

.woopos-right{min-width:160px; display:flex; justify-content:flex-end;}
.woopos-checkbox{display:flex; gap:10px; align-items:center; color:var(--muted); font-size:13px;}
.woopos-checkbox input{width:18px; height:18px;}

.woopos-main{display:grid; grid-template-columns: 2.15fr 1fr; gap:18px; margin-top:16px;}
.woopos-panel{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow: var(--shadow); overflow:hidden;}

.woopos-panel-left{display:flex; flex-direction:column; min-height: calc(100vh - 180px);}
.woopos-toolbar{display:flex; gap:12px; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--line); background:#fff;}
.woopos-tabs{display:flex; gap:10px; flex-wrap:wrap;}
.woopos-tab{
  border:1px solid var(--line); background:#fff; color:var(--text);
  height:36px; padding:0 14px; border-radius:999px; cursor:pointer;
  font-weight:600; font-size:13px;
}
.woopos-tab.is-active{border-color: rgba(201,111,58,.35); background: rgba(201,111,58,.08); color: var(--primary-2);}

.woopos-grid{padding:16px; display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap:14px; overflow:auto;}

.woopos-card{
  border:1px solid var(--line); border-radius:16px; overflow:hidden;
  background:#fff; cursor:pointer; transition: transform .08s ease, box-shadow .08s ease;
}
.woopos-card:hover{transform: translateY(-1px); box-shadow: 0 10px 25px rgba(17,24,39,.10)}
.woopos-card__img{height:130px; background:#f1f5f9; position:relative;}
.woopos-card__img img{width:100%; height:100%; object-fit:cover; display:block;}
.woopos-badge{
  position:absolute; top:10px; left:10px;
  background: rgba(17,24,39,.85); color:#fff; font-size:12px; padding:4px 8px; border-radius:999px;
}
.woopos-badge.stock{left:auto; right:10px; background: rgba(16,185,129,.90)}
.woopos-badge.oos{left:auto; right:10px; background: rgba(239,68,68,.92)}
.woopos-badge.var{background: rgba(79,70,229,.90)}

.woopos-card__body{padding:12px 12px 14px; display:flex; flex-direction:column; gap:8px;}
.woopos-card__name{font-weight:800; font-size:13px; line-height:1.2; min-height:34px;}
.woopos-card__price{font-weight:800;}
.woopos-card__meta{color:var(--muted); font-size:12px; display:flex; justify-content:space-between; gap:8px;}

.woopos-panel-right{display:flex; flex-direction:column; min-height: calc(100vh - 180px);}
.woopos-cart-tabs{padding:12px 12px 10px; border-bottom:1px solid var(--line); background:#fff;}

.woopos-cart-body{padding:10px 12px; flex:1; overflow:auto;}
.woopos-empty{border:1px dashed var(--line); border-radius:16px; padding:22px; text-align:center; color:var(--muted); margin-top:12px;}
.woopos-empty span{font-size:12px; display:block; margin-top:6px}

.woopos-cart{display:flex; flex-direction:column; gap:10px;}
.woopos-item{display:grid; grid-template-columns:56px 1fr auto; gap:10px; align-items:center; border:1px solid var(--line); border-radius:16px; padding:10px; background:#fff;}
.woopos-item img{width:56px; height:56px; object-fit:cover; border-radius:12px; border:1px solid var(--line)}
.woopos-item__name{font-weight:800; font-size:13px;}
.woopos-item__sub{color:var(--muted); font-size:12px; margin-top:2px}
.woopos-item__controls{display:flex; align-items:center; gap:10px; justify-content:flex-end}
.woopos-qty{display:flex; align-items:center; gap:8px;}
.woopos-qty button{width:32px; height:32px; border-radius:10px; border:1px solid var(--line); background:#fff; cursor:pointer; font-weight:900;}
.woopos-qty .n{min-width:18px; text-align:center; font-weight:800}
.woopos-link{border:none; background:none; color:#2563eb; cursor:pointer; font-weight:700; font-size:12px}

.woopos-totals{border-top:1px solid var(--line); padding:12px 14px; background:#fff;}
.woopos-row{display:flex; justify-content:space-between; align-items:center; color:var(--muted); font-size:12px; padding:6px 0}
.woopos-row strong{color:var(--text); font-size:14px}
.woopos-row-total span{color:var(--text); font-weight:900; font-size:14px}
.woopos-row-total strong{font-size:20px}

.woopos-actions{padding:10px 12px; display:grid; grid-template-columns:1fr 1fr; gap:10px; background:#fff; border-top:1px solid var(--line);}
.woopos-pill{height:40px; border:1px solid var(--line); border-radius:999px; background:#fff; cursor:pointer; font-weight:700; color:var(--muted)}
.woopos-pill:hover{border-color:#cbd5e1; color:var(--text)}

.woopos-paybar{display:grid; grid-template-columns: 1fr 1fr; gap:12px; padding:12px; background:#fff; border-top:1px solid var(--line);}

.woopos-btn{height:42px; border-radius:999px; border:1px solid var(--line); background:#fff; cursor:pointer; font-weight:800; padding:0 16px;}
.woopos-btn-ghost:hover{border-color:#cbd5e1}
.woopos-btn-primary{background:var(--primary); border-color:var(--primary); color:#fff;}
.woopos-btn-primary:hover{background:var(--primary-2); border-color:var(--primary-2)}
.woopos-btn-danger{border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); color:#b91c1c;}
.woopos-btn-danger:hover{background: rgba(239,68,68,.12)}
.woopos-btn-pay{background:var(--pay); border-color:var(--pay); color:#fff; font-size:16px;}
.woopos-btn-pay:hover{filter:brightness(.98)}

/* Modal */
.woopos-modal{position:fixed; inset:0; display:none; z-index:99999;}
.woopos-modal.is-open{display:block;}
.woopos-modal__backdrop{position:absolute; inset:0; background: rgba(15,23,42,.55);}
.woopos-modal__panel{position:absolute; top:50%; left:50%; transform: translate(-50%,-50%); width:min(720px, 92vw); max-height: 82vh; background:#fff; border-radius:20px; overflow:hidden; box-shadow: 0 25px 80px rgba(0,0,0,.25)}
.woopos-modal__head{display:flex; align-items:center; justify-content:space-between; padding:14px 16px; border-bottom:1px solid var(--line)}
.woopos-modal__title{font-weight:900}
.woopos-modal__body{padding:14px 16px; overflow:auto; max-height: 60vh}
.woopos-modal__foot{padding:12px 16px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px}

.woopos-varlist{display:flex; flex-direction:column; gap:10px;}
.woopos-var{display:grid; grid-template-columns:56px 1fr auto; gap:10px; align-items:center; border:1px solid var(--line); border-radius:16px; padding:10px;}
.woopos-var img{width:56px; height:56px; border-radius:12px; object-fit:cover; border:1px solid var(--line)}
.woopos-var .n{font-weight:900; font-size:13px}
.woopos-var .m{color:var(--muted); font-size:12px; margin-top:2px}

@media (max-width: 980px){
  .woopos-main{grid-template-columns:1fr;}
  .woopos-panel-left,.woopos-panel-right{min-height:auto;}
}


/* =====================================================
   FIX DEFINITIF – PRODUITS LISIBLES + ASCENSEUR
   ===================================================== */

#woopos-app {
  height: 100vh;
  overflow: hidden;
}

#woopos-app .woopos-main {
  
  overflow: hidden;
}

#woopos-app .woopos-panel-left {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#woopos-app .woopos-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: minmax(130px, auto);
  gap: 12px;

  padding-bottom: 24px;
}

#woopos-app .woopos-product {
  height: auto;
  min-height: 130px;
  display: flex;
  align-items: flex-end;
}

#woopos-app .woopos-panel-right {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#woopos-app .woopos-cart-body {
  overflow-y: auto;
}


/* =====================================================
   FIX FINAL – AUCUN DÉBORDEMENT BAS
   ===================================================== */

#woopos-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#woopos-app .woopos-top {
  flex: 0 0 auto;
}

#woopos-app .woopos-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}


/* =====================================================
   v1.7.0 – MODE A (POS PRO PLEIN ÉCRAN)
   - Pas de scroll page
   - POS fixe plein écran
   - Scroll interne produits + panier
   - Totaux + PAYER toujours visibles
   ===================================================== */

html.woopos-pos,
body.woopos-pos{
  height: 100% !important;
  overflow: hidden !important;
}

body.woopos-pos #woopos-app{
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  z-index: 999999 !important;
  background: #f6f7f9;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

/* Header */
body.woopos-pos #woopos-app .woopos-top{
  flex: 0 0 auto;
}

/* Zone centrale */
body.woopos-pos #woopos-app .woopos-main{
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  margin-top: 0 !important; /* annule marge éventuelle */
}

/* Colonne produits */
body.woopos-pos #woopos-app .woopos-panel-left{
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
body.woopos-pos #woopos-app .woopos-grid{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Colonne panier */
body.woopos-pos #woopos-app .woopos-panel-right{
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
body.woopos-pos #woopos-app .woopos-cart-tabs{
  flex: 0 0 auto;
}
body.woopos-pos #woopos-app .woopos-cart-body{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
body.woopos-pos #woopos-app .woopos-totals,
body.woopos-pos #woopos-app .woopos-actions,
body.woopos-pos #woopos-app .woopos-paybar{
  flex: 0 0 auto;
}


/* =====================================================
   v1.7.1 – FIX BARRE ADMIN WORDPRESS
   - Évite que le header POS passe sous la admin bar
   ===================================================== */

body.admin-bar.woopos-pos #woopos-app{
  top: 32px !important;
  height: calc(100vh - 32px) !important;
}

@media screen and (max-width: 782px){
  body.admin-bar.woopos-pos #woopos-app{
    top: 46px !important;
    height: calc(100vh - 46px) !important;
  }
}


/* =====================================================
   v1.7.6 – Badge prix TTC sur l'image
   ===================================================== */
.woopos-badge--price{
  left: 10px;
  right: auto;
  top: auto;
  bottom: 10px;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-weight: 800;
}


/* =====================================================
   v2.1.1 – cards body layout (minimal, non-destructive)
   ===================================================== */

/* remove black overlay price bubble if still present */
.woopos-badge--price{ display:none !important; }

/* keep spacing between cards without changing theme layout too much */
#wooposProducts.woopos-grid, .woopos-grid{
  gap:16px !important;
}

/* body styles */
.woopos-card__body{
  padding:10px 12px 14px !important;
}
.woopos-card__name{
  font-weight:700 !important;
  font-size:14px !important;
  line-height:1.25 !important;
  margin:0 0 6px 0 !important;
  color:#111 !important;
}
.woopos-card__price{
  font-weight:700 !important;
  font-size:13px !important;
  color:#444 !important;
}


/* v3.4.1 uniform cards */
#wooposProducts.woopos-grid, .woopos-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 18px !important;
  align-content: start;
}

.woopos-card{
  display:flex !important;
  flex-direction:column !important;
  background:#fff !important;
  border-radius:16px !important;
  overflow:hidden !important;
  box-shadow:0 6px 18px rgba(0,0,0,.08) !important;
}

.woopos-card__img{
  position:relative !important;
  aspect-ratio: 1 / 1 !important;
  overflow:hidden !important;
  background:#f1f5f9 !important;
}
.woopos-card__img img{
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
  display:block !important;
}

.woopos-card__body{
  display:flex !important;
  flex-direction:column !important;
  gap:6px !important;
  padding:12px 14px !important;
  min-height:72px !important;
  justify-content:space-between !important;
  background:#fff !important;
}
.woopos-card__name{
  font-weight:700 !important;
  font-size:13px !important;
  line-height:1.2 !important;
  margin:0 !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}
.woopos-card__price{
  font-weight:800 !important;
  color: var(--woopos-muted, #374151) !important;
  margin:0 !important;
}

/* remove legacy overlay price badge */
.woopos-badge--price{ display:none !important; }


/* === WooPOS Cards Uniform (v3.4.2) === */
#wooposProducts.woopos-grid{
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)) !important;
  grid-auto-rows: auto !important;
  gap: 18px !important;
  padding: 16px !important;
}

#wooposProducts .woopos-card{
  display: flex !important;
  flex-direction: column !important;
  height: 305px !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: #fff !important;
}

#wooposProducts .woopos-card__img{
  height: 165px !important;
  flex: 0 0 165px !important;
}

#wooposProducts .woopos-card__body{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  padding: 12px 12px 14px !important;
  display: flex !important;
  flex-direction: column !important;
}

#wooposProducts .woopos-card__name{
  font-weight: 800 !important;
  font-size: 14px !important;
  line-height: 1.25 !important;
  margin: 0 0 8px 0 !important;
  color: #111 !important;

  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  min-height: 36px !important;
}

#wooposProducts .woopos-card__price{
  margin-top: auto !important;
  font-weight: 800 !important;
  color: #475569 !important;
}

#wooposProducts .woopos-badge--price{
  display: none !important;
}

