/* ── Product detail page ─────────────────────────────────────────────────── */
.product-page {
  max-width: 860px;
  margin: 7rem auto 4rem;
  padding: 0 1.5rem;
}

/* ── Product header ─────────────────────────────────────────────────────── */
.product-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}

.product-img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

.product-header-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.productTitle-Report {
  display: flex;
  gap: 1rem;
}

.productTitle-Report button {
  background: none;
  border: none;
  cursor: pointer;
}

.reportFlag-img {
  width: 18px;
  height: 18px;
  transition: transform 0.15s ease;
}

.reportFlag-img:hover {
  transform: translate(-2px, -2px);
}

.admin-button {
  text-decoration: none;
  color: black;
  background-color: #88D498;
  width: 30%;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  margin-top: 1rem;
  cursor: pointer;
}

.admin-button:hover {
  background-color: #6cb56d;
  color: white;
}

.product-title {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  line-height: 1.3;
}

.product-brand {
  font-size: 0.95rem;
  color: #777;
}

.product-price {
  font-size: 1.1rem;
  color: #555;
}

.product-link {
  display: inline-block;
  color: #6cb56d;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9rem;
}

.product-link:hover { text-decoration: underline; }

/* ── Ingredient list ─────────────────────────────────────────────────────── */
.ingredients-section {
  margin-bottom: 2rem;
}

.ingredients-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #6cb56d;
  padding-bottom: 0.4rem;
}

.ingredient-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ingredient-item {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

/* The clickable row for each ingredient */
.ingredient-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: white;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  transition: background 0.15s ease;
}

.ingredient-toggle:hover { background: #f7fff6; }

.ingredient-name {
  flex: 1;
  font-weight: 500;
}

/* Coloured safety score dot */
.safety-dot {
  font-size: 0.8rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 99px;
  color: white;
  flex-shrink: 0;
}

.safety-dot.safe    { background: #6cb56d; }
.safety-dot.caution { background: #e9a84c; }
.safety-dot.concern { background: #d9534f; }

.toggle-arrow {
  font-size: 0.85rem;
  color: #999;
  flex-shrink: 0;
}

/* Expanded ingredient panel */
.ingredient-detail {
  padding: 1rem 1.2rem 1.2rem;
  background: #fafafa;
  border-top: 1px solid #e0e0e0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.ingredient-detail.hidden { display: none; }

.ing-description {
  margin-bottom: 0.75rem;
  color: #333;
}

.ing-section {
  margin-bottom: 0.75rem;
}

.ing-section h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6cb56d;
  margin-bottom: 0.3rem;
}

.ing-section ul {
  padding-left: 1.2rem;
  color: #444;
}

.ing-science {
  font-size: 0.82rem;
  color: #777;
  border-top: 1px solid #e8e8e8;
  padding-top: 0.6rem;
  margin-top: 0.6rem;
}

.btn-analyze {
  display: inline-block;
  background-color: #6cb56d;
  color: white;
  font-weight: bold;
  text-decoration: none;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  margin-top: 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-analyze:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 #000;
}

.muted { color: #999; font-style: italic; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .product-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ── Report Overlay ───────────────────────────────────────────────────────────────── */
.reportContainer {
  position: fixed;
  display: none;
  justify-content: center;
  align-items: center;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
}

.reportContent {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 25px;
  width: 90%;
  height: 60vh;
  border: 4px solid #6cb56d;
  background-color: white;
  padding: 0 5%;
}

.reportContent textarea:focus {
  border: 2px solid #A3D0A1;
  outline: none;
  border-radius: 4px;
}

.visibleReport {
  display: flex;
}

.closebtn {
  position: absolute;
  left: 80%;
  font-size: 70px;
  font-weight: bold;
  color: black;
  cursor: pointer;
}

.reportForm {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 80%;
}

@media screen and (min-width: 768px) {
  .reportContent {
    width: 40%;
    min-width: 550px;
    height: 50vh;
  }

  .closebtn {
    top: 215px;
    right: 1050px;
  }

  .reportForm {
    width: 70%;
    height: 60%;
  }

}

/* ── Edit Overlay ───────────────────────────────────────────────────────────────── */
.editContainer {
  position: fixed;
  display: none;
  justify-content: center;
  align-items: center;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
}

.editContent {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  border-radius: 25px;
  width: 90%;
  height: 80vh;
  border: 4px solid #6cb56d;
  background-color: white;
  padding: 0 2.5%;
}

.editContent textarea:focus {
  border: 2px solid #A3D0A1;
  outline: none;
  border-radius: 4px;
}

.visibleEdit {
  display: flex;
}

.closebtn {
  position: absolute;
  left: 80%;
  font-size: 70px;
  font-weight: bold;
  color: black;
  cursor: pointer;
}

.editForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 80%;
  height: 45%;
  border: 3px solid #000;
  border-radius: 12px;
}

.deleteBtn {
  color: black;
  background-color: #D0A1A3;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
}

.deleteBtn:hover {
  background-color: #894852;
}

.edit-ingredients {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 40%;
  border: 1px solid #000;
  padding: 5px;
  overflow-y: auto;
}

.edit-ingredient-item button {
  text-decoration: none;
  color: black;
  background-color: #88D498;
  width: 25%;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.edit-ingredient-item button:hover {
  background-color: #6cb56d;
  color: white;
}

.add-ingredient {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  height: 50%;
  padding: 1rem;
  border: 2px solid #000;
}

.add-ingredient h3 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.add-ingredient input {
  width: 100%;
  padding: 8px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.add-ingredient button {
  background-color: #6cb56d;
  color: white;
  font-weight: bold;
  text-decoration: none;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  width: fit-content;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.add-ingredient button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 #000;
}

@media screen and (min-width: 768px) {
  .editContent {
    width: 60%;
    min-width: 550px;
    height: 60vh;
    gap: 1rem;
    flex-direction: row;
  }

  .closebtn {
    top: 215px;
    right: 1050px;
  }

  .editForm {
    width: 50%;
    height: 80%;
  }

}
