/*
Custom Css
*/

.category-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 350px;
  background: linear-gradient(160deg, #eaf6f3 0%, #dcefe9 100%);
  color: #28a745;
  font-size: 9rem !important;
  text-decoration: none;
}

.category-icon-tile:hover {
  color: #1e7e34;
}

.category-feature-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: #eaf6f3;
  color: #28a745;
  font-size: 1.5rem !important;
}

/* Long, unbroken product/company names must wrap instead of overflowing the
   viewport on narrow screens (card text, table cells, breadcrumb items). */
.card-text,
.breadcrumb-item {
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

/* /ws/it thumbnails are server-rendered at a fixed 110x110 (WsController::it()) - Bootstrap's
   .card-img-top{width:100%} stretches them to fill wide grid columns instead, upscaling a
   110px source into a blurry 280px+ tile on desktop. Pin the tile to its real resolution. */
.card-img-top[width='110'] {
  width: 110px;
  height: 110px;
  object-fit: contain;
  margin: 0 auto;
  display: block;
}

/* "Indice delle informazioni" TOC on the product page, ported verbatim from v2's real
   style.css (toc_container/toc_title/sp_method_toc rules) - numbered circular badges in
   a 2-column pill grid. */
.toc_container a {
  color: #333;
}

.toc_container p.toc_title {
  font-size: 20px;
  margin: 0;
  padding: 0;
}

.toc_container ul.sp_method_toc {
  counter-reset: li;
  list-style: none;
  padding: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  margin: 1.2em 0 1.2em 1em;
  /* v2's real style.css never clears the floated li's below either (same bug there) - without
       this the <ul> collapses to 0 height around them, so the next section overlaps the visible
       badge grid and its own border/background reads as a stray line under the TOC title. */
  display: flow-root;
}

.sp_method_toc li:before {
  content: counter(li);
  counter-increment: li;
  position: absolute;
  left: -1.3em;
  top: 20px;
  margin-top: -1.3em;
  background: #87ceeb;
  height: 2em;
  width: 2em;
  line-height: 1.3em;
  border: 0.3em solid #fff;
  text-align: center;
  font-weight: 700;
  border-radius: 2em;
  transition: all 0.3s ease-out;
}

.sp_method_toc li {
  margin: 0.6em 0;
  padding: 0.4em 0.4em 0.4em 2em;
  position: relative;
  display: block;
  background: #efefef;
  text-decoration: none;
  border-radius: 0.3em;
  font-size: 14px;
  margin-top: 2px;
  padding-top: 5px;
  padding-bottom: 5px;
  width: 49%;
  float: left;
}

@media (max-width: 768px) {
  .sp_method_toc li {
    width: auto;
    float: none;
  }
}

/* PrezziFarmaco price banner (components/pf-price-banner.blade.php), styles ported verbatim
   from v2's pf_price_banner.php inline <style> block. */
/* Only borders/pads once the AJAX call actually injects a match - v2's own CSS applies this
   unconditionally, leaving an empty bordered box whenever PrezziFarmaco has no price for the
   AIC (the common case for products it doesn't carry). */
#pf_price_banner:not(:empty) {
  border: 1px solid #66b332;
  border-radius: 5px;
  padding: 10px;
}

.pfb-item {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.pfb-button {
  color: white;
  padding: 10px;
  background: #66b332;
  border-radius: 10px;
  float: right;
}

.pfb-button:hover {
  color: #66b332;
  background: white;
  border: 1px solid #66b332;
}

.pfb-titolo {
  padding: 10px;
}

.pfb-prezzo {
  min-width: 180px;
}

/* v2 pulled .pfb-prezzo out of the flow with a hardcoded absolute offset on mobile, which made
   the buy button escape the "Quanto costa" box. Keep it stacked inside the banner instead. */
@media (max-width: 991px) {
  .pfb-item {
    display: block;
  }

  .pfb-prezzo {
    min-width: 0;
    margin-top: 10px;
    text-align: center;
  }

  .pfb-button {
    float: none;
    display: inline-block;
  }
}

/* The one product box (components/product-box.blade.php): homepage "piu' visti", the shared
   taxonomy listing, and the related products on a product page all render this markup, so the
   photo size and the name/manufacturer/meta rhythm are defined once here. */
.product-box__image {
  width: 110px;
  height: 110px;
  object-fit: contain;
}

.product-box__name {
  overflow-wrap: break-word;
}

.product-box--grid .product-box__name {
  font-weight: 600;
}

.product-box:hover .product-box__name {
  text-decoration: underline;
}

a {
  word-wrap: anywhere;
}
