/* ==========================================================================
   Product card (shared by customer + staff)
   File: /css/product-card.css
   ========================================================================== */

/* Card wrapper */
.product-card {
  min-height: 130px;
  display: flex;
  gap: 12px;
  padding: 12px;
  overflow: hidden;

  border-radius: var(--border-radius-r);
  background: var(--color-containers);
  box-shadow: var(--box-shadow-containers);
}

/* Thumb (left) */
.product-card .card-thumb {
  flex: 0 0 110px;
  flex-shrink: 0; /*impedisce a flexbox di schiacciare l'immagine se lo spazio non è sufficiente*/
  height: 110px;

  border-radius: var(--border-radius-r);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.10);

  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background-color: var(--color-text-secondary);
}

.thumb-file-input {
  display: none;
}

/* Staff-only: make upload button look like an image */
.product-card .thumb-upload-btn {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 16px;
}

.product-card .thumb-upload-btn:focus-visible {
  outline: 3px solid var(--color-primary, #f6c400);
  outline-offset: 2px;
}

/* Body (right) */
.product-card .card-body {
  position: relative;
  flex: 1;
  min-width: 0; /* allow text wrapping in flex */
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* Favorite toggle (customer only) */
.product-card .fav-toggle {
  position: absolute;
  top: 0;
  right: 0;

  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 999px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.product-card .fav-toggle img {
  width: 22px;
  height: 22px;
  display: block;
}

/* Visual feedback for favorite state (JS toggles aria-pressed) */
.product-card .fav-toggle[aria-pressed="false"] {
  opacity: 1;
}

.product-card .fav-toggle[aria-pressed="true"] {
  opacity: 1;
  background: var(--color-primary);
}

/* Title */
.product-card .card-title {
  margin: 0;
  padding-right: 40px; /* keep room for star */
  color: var(--color-text, #111);

  font-size: 16px;
  font-weight: var(--font-weight-semi);
  line-height: 1.15;

  /* matches your mockup look */
  text-transform: uppercase;

  /* avoid overflow on long names */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
}

.product-card .card-thumb {
  flex: 0 0 120px;
  height: 96px;
}

/* Notes (customer only in HTML) */
/*
.product-card .card-notes {
  margin: 0;
  color: var(--color-text);
  font-size: 12.5px;
  line-height: 1.25;
}
*/


/* Bottom area: category + qty (if present) */
.product-card .card-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Make the category chip smaller inside cards
   (do NOT affect filter chips, because those are outside .product-card) */
.product-card .chip.category {
  width: fit-content;
  margin: 0;
  padding: 6px 10px;
  font-size: 12px;
  border-width: 2px;
}

/* Quantity controls (customer only in HTML) */
.product-card .qty-controls {
  border-radius: 999px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: var(--color-category-bg);
}

/* Round buttons like your mockup */
.product-card .btn-qty {
  width:36px;
  height: 36px;
  flex-shrink: 0; /*prevents buttons to BECOME OVAL*/

  border: 0;
  border-radius: 999px;
  background: var(--color-primary);
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow: var(--box-shadow-buttons);
}

.product-card .btn-qty img {
  width: 14px;
  height: 14px;
  display: block;
}

.product-card .btn-qty:focus-visible {
  outline: 3px solid rgba(0, 0, 0, 0.75);
  outline-offset: 2px;
}

/* Quantity number in the middle */
.product-card .qty-input {
  width: 100%;
  min-width: 30px;
  text-align: center;

  border: 0;
  background: transparent;

  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semi);
  color: var(--color-text);

  /* hide spinners */
  appearance: textfield;
}

.product-card .qty-input::-webkit-outer-spin-button,
.product-card .qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


/*Remove button for SUMMARY cards */
.card-remove {
  cursor: pointer;
  max-width: 40px;
  max-height: 40px;
  background-color: var(--color-primary);
  color: var(--color-text);

  border: 1px solid var(--color-text);
  border-radius: 999px;

  width: auto;
  height: min(45px, 40%);

  display: flex;
  align-items: center; 
}


/* =======================
   ADATTAMENTI MOBILE (Solo rimpicciolimenti tattici)
   ======================= */
@media (max-width: 480px) {
  
  /* Manteniamo il layout orizzontale, ma rimpiccioliamo proporzionalmente gli elementi */
  .product-card {
    padding: 10px;
    gap: 10px;
  }

  .product-card .card-thumb {
    flex: 0 0 90px; /* Immagine leggermente più piccola */
    height: 90px;
  }

  .product-card .card-title {
    font-size: 14px; /* Titolo leggermente più piccolo per evitare troppe righe a capo */
  }

  /* Rimpiccioliamo leggermente l'area dei bottoni per farla stare nei telefoni stretti */
  .product-card .btn-qty {
    width: 32px;
    height: 32px;
  }
}
