/*
 * product-card.css
 * Content of the product card (components/_productCardBody.jinja).
 * Only the content under the image is styled here; card width and image size are untouched.
 */

.pc-body {
  --pc-bg: #00223b;
  --pc-text: #fff;
  --pc-muted: #94a3b8;
  --pc-accent: #0096ff;
  --pc-price: #ff4d5e;
  --pc-line: rgba(255, 255, 255, 0.7);
  --pc-h: 34px;
  --pc-radius: 8px;

  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background-color: var(--pc-bg);
  color: var(--pc-text);
  text-align: start;
}

/* Row 1: starts from + price */
html body .pc-body .pc-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  line-height: 1.3;
}

html body .pc-body .pc-price-label {
  color: var(--pc-text) !important;
  font-weight: 500;
}

html body .pc-body .pc-price-current {
  color: var(--pc-price) !important;
  font-weight: 700;
}

html body .pc-body .pc-price-old {
  color: var(--pc-muted) !important;
  font-size: 11px;
}

/* Row 2: name */
html body .pc-body .pc-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

/* Number of lines comes from the header setting "line_clamp" (.product .title a in header.jinja) */
html body .pc-body .pc-name a {
  color: var(--pc-text) !important;
  line-height: 1.35;
}

/* Row 3: option block — "<name> *", small hint, full-width bar (same structure in every card) */
.pc-body .pc-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pc-body .pc-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

html body .pc-body .pc-option-label {
  color: var(--pc-text) !important;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.pc-body .pc-required {
  color: var(--pc-price);
}

html body .pc-body .pc-option-hint {
  color: var(--pc-muted) !important;
  font-size: 11px;
  line-height: 1.3;
  min-height: 14px;
}

.pc-body .pc-dd {
  position: relative;
}

/* Blue bar that opens the dropdown */
html body .pc-body .pc-dd-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: var(--pc-h);
  padding: 0 30px;
  border: 1.5px solid var(--pc-accent) !important;
  border-radius: 6px;
  background: var(--pc-accent) !important;
  color: #fff !important;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: none !important;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

html body .pc-body .pc-dd-btn:hover {
  filter: brightness(1.06);
}

html body .pc-body .pc-dd-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.pc-body .pc-dd-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-body .pc-dd-chevron {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  margin-top: -4px;
  transition: transform 0.2s ease;
}

.pc-body .pc-dd-btn.is-open .pc-dd-chevron {
  transform: rotate(180deg);
}

/* A value is chosen: outlined bar so the choice reads as "done" */
html body .pc-body .pc-dd-btn.is-chosen {
  background: rgba(0, 150, 255, 0.12) !important;
  color: #fff !important;
}

html body .pc-body .pc-dd-btn.is-invalid {
  border-color: var(--pc-price) !important;
  box-shadow: 0 0 0 2px rgba(255, 77, 94, 0.35) !important;
}

html body .pc-body .pc-dd-btn[disabled] {
  cursor: wait;
  opacity: 0.85;
}

/* Availability bar for cards without options / out of stock (same size as the blue bar) */
html body .pc-body .pc-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--pc-h);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

html body .pc-body .pc-status--ok {
  border: 1.5px solid rgba(93, 202, 165, 0.6);
  color: #9fe1cb !important;
  background: rgba(93, 202, 165, 0.08);
}

html body .pc-body .pc-status--out {
  border: 1.5px solid rgba(255, 77, 94, 0.5);
  color: #ff8a95 !important;
  background: rgba(255, 77, 94, 0.08);
}

/* Floating dropdown panel (attached to <body>) */
.pc-dd-panel {
  position: fixed;
  z-index: 10050;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  background: #0a3254;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  animation: pc-dd-in 0.14s ease-out;
  overscroll-behavior: contain;
}

.pc-dd-panel.is-above {
  animation-name: pc-dd-in-above;
}

@keyframes pc-dd-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pc-dd-in-above {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

html body .pc-dd-panel .pc-dd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #fff !important;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: start;
  cursor: pointer;
}

html body .pc-dd-panel .pc-dd-item + .pc-dd-item {
  margin-top: 2px;
}

html body .pc-dd-panel .pc-dd-item:hover,
html body .pc-dd-panel .pc-dd-item:focus-visible {
  background: rgba(0, 150, 255, 0.16);
  outline: none;
}

html body .pc-dd-panel .pc-dd-item.is-selected {
  background: rgba(0, 150, 255, 0.22);
  color: #7cc7ff !important;
}

.pc-dd-panel .pc-dd-item-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pc-dd-panel .pc-dd-extra {
  flex: 0 0 auto;
  margin-inline-start: auto;
  color: #9fe1cb;
  font-size: 12px;
  white-space: nowrap;
}

.pc-dd-panel .pc-dd-check {
  flex: 0 0 auto;
  font-size: 12px;
  color: #7cc7ff;
  visibility: hidden;
}

.pc-dd-panel .pc-dd-item.is-selected .pc-dd-check {
  visibility: visible;
}

html body .pc-dd-panel .pc-dd-item[disabled] {
  cursor: not-allowed;
  color: #94a3b8 !important;
}

html body .pc-dd-panel .pc-dd-item[disabled] .pc-dd-item-text {
  text-decoration: line-through;
}

.pc-dd-panel .pc-dd-badge {
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 1px solid rgba(255, 77, 94, 0.5);
  border-radius: 10px;
  color: #ff8a95;
  font-size: 11px;
  line-height: 1.4;
}

/* Equal-height cards: the card fills its grid column and the buttons sit at the bottom,
   so the quantity row and "Add to cart" line up even when names wrap differently */
html body .product.product-1:has(> .pc-body),
html body .product.product-card-home:has(> .pc-body) {
  height: 100%;
  display: flex;
  flex-direction: column;
}

html body .product > .pc-body {
  flex: 1 1 auto;
}

html body .pc-body .pc-actions {
  margin-top: auto;
}

/* Row 4: qty stepper + wishlist + share */
.pc-body .pc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-body .pc-qty {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--pc-h);
  border: 1.5px solid var(--pc-line);
  border-radius: var(--pc-radius);
  overflow: hidden;
}

.pc-body .pc-qty.is-disabled {
  opacity: 0.5;
}

html body .pc-body .pc-qty-btn {
  flex: 0 0 30px;
  height: 100%;
  border: 0;
  background: transparent !important;
  color: var(--pc-text) !important;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

html body .pc-body .pc-qty-input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent !important;
  color: var(--pc-text) !important;
  text-align: center;
  font-size: 14px;
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
}

.pc-body .pc-qty-input::-webkit-outer-spin-button,
.pc-body .pc-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

html body .pc-body .pc-icon-btn {
  position: relative;
  flex: 0 0 var(--pc-h);
  width: var(--pc-h);
  height: var(--pc-h);
  margin: 0;
  padding: 0;
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--pc-line);
  border-radius: var(--pc-radius);
  background: transparent !important;
  color: var(--pc-text) !important;
  cursor: pointer;
  z-index: auto;
}

/* Wishlist span reuses .add-to-wishlist (absolute circle in main.css) — make it an inline square here */
html body .pc-body .add-to-wishlist.pc-wishlist {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  margin: 0 !important;
  width: var(--pc-h) !important;
  height: var(--pc-h) !important;
  border-radius: var(--pc-radius) !important;
  border: 1.5px solid var(--pc-line) !important;
  background: transparent !important;
}

/* Icon only (the box keeps --pc-h). !important beats the global 32px heart rule in header.jinja */
html body .pc-body .pc-wishlist .icon-heart-mask {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  background-color: #fff;
  -webkit-mask-size: contain !important;
  mask-size: contain !important;
  -webkit-mask-position: center;
  mask-position: center;
}

html body .pc-body .pc-wishlist .icon-heart-mask.filled {
  background-color: var(--pc-price);
}

html body .pc-body .pc-wishlist .heart-loader {
  color: #fff;
  margin: 0 !important;
}

/* Row 5: add to cart */
html body .pc-body .pc-add-btn,
html body .pc-body .pc-cart .btn-cart {
  position: static !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 38px;
  padding: 0 10px !important;
  border: 0 !important;
  border-radius: var(--pc-radius) !important;
  background-color: var(--pc-accent) !important;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

html body .pc-body .pc-add-btn:hover {
  filter: brightness(1.08);
}

html body .pc-body .pc-add-btn[disabled] {
  opacity: 0.7;
  cursor: wait;
}

html body .pc-body .pc-cart .btn-out-of-stock {
  background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Weight / quantity badges (optional setting) */
.pc-body .product-card-weight-quantity {
  margin: 0 !important;
}

@media (max-width: 767.98px) {
  .pc-body {
    --pc-h: 32px;
    gap: 5px;
    padding: 6px;
  }

  .pc-body .pc-actions {
    gap: 4px;
  }

  html body .pc-body .pc-qty-btn {
    flex-basis: 24px;
  }

  html body .pc-body .pc-name {
    font-size: 13px;
  }

  html body .pc-body .pc-add-btn,
  html body .pc-body .pc-cart .btn-cart {
    height: 36px;
    font-size: 13px;
  }
}
