/* Tuotelistaus: kortti */
.product-row{
  width:100%;
  padding:12px 0;
}

.product-card{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:14px;
  align-items:start;
}

.product-card.is-old{ opacity:.5; }

/* Kuva + status-ympyrä */
.product-media{
  width:140px;
}

.product-thumb{
  width:140px;
  height:140px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;   /* TÄRKEÄ */
}

.product-thumb img{
  max-height:120px;
  max-width:120px;
  display:block;
}

/* Statusvärit (taustaympyrä) */
.product-thumb.bg-default{ background:aliceblue; }
.product-thumb.bg-ok{ background:#16a92029; }     /* state 64 */
.product-thumb.bg-warn{ background:#ef7f1a29; }   /* state 256 */

/* Oheisikonit (free shipping, rating, alelappu) */
.product-badges{
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-around;
    align-content: space-around;
}

.product-badges img{ vertical-align:middle; }

/* Sisältö */
.product-meta small{ color:#444; }
.product-title{
  margin:4px 0 6px 0;
  font-size:20px;
  line-height:1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.product-title a{ text-decoration:none; color:#111; }
.tuoteKuvaus{ color:#222; }

/* Alarivi: hinta / info / varasto */
.product-actions{
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
}

.price-tag{
  cursor:pointer;
  width:120px;
  margin:0;
  padding:8px 10px;
  border-radius:10px;
  color:#fff;
  font-size:16px;
  line-height:1;
  background:#3ba013;

  /* tärkeä: varaa tilaa cart-kuvalle */
  padding-right:34px;

  /* CART-IKONI: käytä absoluuttista polkua tai oikeaa suhteellista */
  background-image:url(/site_images/cart_w.png);
  background-size:20px;
  background-repeat:no-repeat;
  background-position:92% 50%;

  display:inline-block;
  user-select:none;
}

.price-tag small{
  color:inherit;
  font-size:14px;
  opacity:.95;
}

.product-row{
  padding:10px 0;
}

/* varsinainen kortti */
.product-card{
  background:#fff;
  border-radius:16px;
  padding:20px;
  box-shadow:0 2px 8px rgba(0,0,0,.18);
  transition:.15s ease;
}

.product-card:hover{
  box-shadow:0 6px 18px rgba(0,0,0,.12);
}

.sale-badge{
  position:relative;
  z-index:5;
  background:#e53935;
  color:#fff;
  font-size:12px;
  padding:4px 8px;
  border-radius:10px;
  font-weight:600;
}


/* jos alelappu on teksti/div */
.sale-badge span,
.sale-badge div{
  background:#e53935;
  color:#fff;
  font-size:12px;
  padding:4px 8px;
  border-radius:10px;
  font-weight:600;
}

/* Mobiili */
@media (max-width: 640px){
/* Kortin sisällä yksi palsta */
  .product-card{
    grid-template-columns: 1fr;
    gap:10px;
    padding: 14px;
  }

  /* Media-alueesta tehdään oma ylä-rivi: kuva + otsikko */
  .product-media{
    width:100%;
    display:flex;
    gap:10px;
    justify-content: center;
  }

  /* Kuva pienemmäksi ja pois negatiivisista marginaaleista */
  .product-thumb{
    width:84px;
    height:84px;
    margin-left:0;
    flex: 0 0 84px;
  }
  .product-thumb img{
    /*max-width:74px;
    max-height:74px;*/
  }

  /* Badge-rivi tiiviiksi */
  .product-badges{
    margin-top:0;
    align-self:center;
  }

  /* Meta vie koko leveyden */
  .product-meta{
    min-width:0;
  }

  /* Otsikko/kuvaus kompaktimmaksi */
  .product-title{ font-size:17px; margin:0 0 6px 0; }
  .tuoteKuvaus{ margin-top:6px; }

  /* Hinta + varasto koko leveydelle ja nätisti rivitettynä */
  .product-actions{
    justify-content:space-between;
    gap:8px;
  }

  .price-tag{
    width:auto;          /* ei lukittua leveyttä mobiilissa */
    min-width:100px;     /* mutta ei liian pieni */
  }

  .product-stock{
    flex: 1 1 1;
    font-size: smaller;
  }
}