/* ===========================
   Product Cart & Selection
   =========================== */

/* ===== Select column (desktop) ===== */
#pn-products .pn-th-select {
  width: 52px;
  min-width: 52px;
  text-align: center;
  cursor: pointer;
}

.pn-th-cart-icon {
  font-size: 16px;
  color: var(--pn-accent);
  filter: drop-shadow(0 0 4px rgba(var(--pn-accent-rgb), 0.6));
}

#pn-products .pn-td-select {
  width: 52px;
  min-width: 52px;
  text-align: center;
  padding: 0 !important;
  cursor: pointer;
}

.pn-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: rgba(var(--pn-accent-rgb), 0.45);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s, transform 0.15s;
  padding: 0;
  line-height: 1;
}

.pn-select-btn:hover,
.pn-td-select:hover .pn-select-btn {
  color: rgba(var(--pn-accent-rgb), 0.8);
  background: rgba(var(--pn-accent-rgb), 0.08);
}

.pn-select-btn.is-selected {
  color: var(--pn-accent);
}

.pn-select-btn.is-selected:hover,
.pn-td-select:hover .pn-select-btn.is-selected {
  color: #fff;
  background: rgba(255, 60, 60, 0.15);
}

/* Desktop: highlight individual cells */
#pn-products .pn-row.is-selected > td {
  background: rgba(var(--pn-accent-rgb), 0.13);
}

#pn-products .pn-row.is-selected:hover > td {
  background: rgba(var(--pn-accent-rgb), 0.17);
}

/* ===== Mobile card: select button ===== */
@media (max-width: 639px) {
  /* Mobile: highlight the whole card row, not individual tds */
  #pn-products .pn-row.is-selected > td {
    background: none;
  }
  #pn-products .pn-row.is-selected:hover > td {
    background: none;
  }
  #pn-products .pn-table tbody tr.pn-row.is-selected {
    background: rgba(var(--pn-accent-rgb), 0.07);
  }

  #pn-products .pn-table tbody td.pn-td-select {
    position: static;
    width: 34px;
    min-width: 34px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    grid-row: 1 / 3;
    grid-column: 4;
    align-self: stretch;
    z-index: 2;
    margin: 0;
    padding: 0 !important;
  }

  #pn-products .pn-table tbody tr.pn-row {
    position: relative;
    grid-template-columns: 50px minmax(0, 1fr) auto 34px;
    column-gap: 8px;
  }

  .pn-select-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 340px) {
  #pn-products .pn-table tbody tr.pn-row {
    grid-template-columns: 46px minmax(0, 1fr) 34px;
    grid-template-rows: auto auto auto auto;
    column-gap: 8px;
    row-gap: 2px;
  }

  #pn-products .pn-table tbody td:nth-child(1) {
    grid-row: 1 / 5;
    grid-column: 1;
    width: 46px;
    min-width: 46px;
  }

  #pn-products .pn-table tbody td:nth-child(2) {
    grid-row: 2;
    grid-column: 2;
    min-width: 0;
  }

  #pn-products .pn-table tbody td:nth-child(3) {
    grid-row: 1;
    grid-column: 2;
    min-width: 0;
  }

  #pn-products .pn-table tbody td:nth-child(4) {
    grid-row: 3;
    grid-column: 2;
    min-width: 0;
    justify-content: flex-start;
  }

  #pn-products .pn-table tbody td:nth-child(5) {
    grid-row: 4;
    grid-column: 2;
    min-width: 0;
    justify-content: flex-start;
  }

  #pn-products .pn-table tbody td.pn-td-select {
    grid-row: 1 / 5;
    grid-column: 3;
  }

  #pn-products .pn-table tbody td:nth-child(3) .pn-name {
    display: block;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.15;
  }

  #pn-products .pn-table tbody td:nth-child(3) .pn-latin {
    display: block;
    margin-top: 1px;
  }
}

@media (max-width: 300px) {
  #pn-products .pn-table tbody td {
    font-size: 12px;
  }

  #pn-products .pn-name {
    font-size: 12px;
  }

  .pn-cell-label {
    font-size: 10px;
  }
}

/* ===== Floating cart button ===== */
.pn-cart-fab {
  position: fixed;
  left: 15px;
  bottom: 70px;
  z-index: 99999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background-color: var(--accent-color, #429f09);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: opacity 0.35s ease, transform 0.35s ease, background-color 0.2s;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 60px, 0) scale(0.92);
}

.pn-cart-fab.active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.pn-cart-fab::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(91, 173, 40, 0.95) 20%,
    rgba(140, 255, 60, 0.85) 30%,
    rgba(200, 255, 140, 0.7) 38%,
    transparent 50%,
    transparent 100%
  );
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.pn-cart-fab.glow-spin::before {
  opacity: 1;
  animation: cartGlowSpin 0.8s ease-in-out forwards;
}

@keyframes cartGlowSpin {
  0% {
    transform: rotate(0deg);
    opacity: 0;
    filter: blur(4px) brightness(1);
  }
  15% {
    opacity: 0.5;
    filter: blur(3px) brightness(1.2);
  }
  35% {
    opacity: 1;
    filter: blur(2px) brightness(1.5);
  }
  60% {
    opacity: 0.9;
    filter: blur(3px) brightness(1.3);
  }
  85% {
    opacity: 0.4;
    filter: blur(4px) brightness(1.1);
  }
  100% {
    transform: rotate(360deg);
    opacity: 0;
    filter: blur(5px) brightness(1);
  }
}

.pn-cart-fab:hover {
  background-color: color-mix(in srgb, var(--accent-color, #429f09), transparent 15%);
}

.intro-lock .pn-cart-fab,
.hero-sequence-locking .pn-cart-fab,
.hero-sequence-scrollbar-held .pn-cart-fab {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.pn-cart-fab__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  padding: 0 4px;
  pointer-events: none;
}

.pn-cart-sprout {
  position: fixed;
  z-index: 200002;
  pointer-events: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  color: rgba(154, 235, 75, 0.96);
  text-shadow:
    0 0 8px rgba(91, 173, 40, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.65);
  filter: drop-shadow(0 7px 9px rgba(0,0,0,0.32));
  transform: translate(-50%, -50%);
  opacity: 0;
  animation:
    pnCartSproutFlyX 1000ms cubic-bezier(.42,0,.2,1) forwards,
    pnCartSproutFlyY 1000ms cubic-bezier(.42,0,.2,1) forwards,
    pnCartSproutFade 1000ms ease-in-out forwards;
  will-change: transform, opacity, filter;
}

.pn-cart-sprout i {
  display: block;
}

@keyframes pnCartSproutFlyX {
  0% {
    transform: translateX(-50%) scale(0.86);
  }
  14% {
    transform: translateX(-50%) scale(1.08);
  }
  100% {
    transform: translateX(calc(-50% + var(--pn-cart-sprout-dx))) scale(0.52);
  }
}

@keyframes pnCartSproutFlyY {
  0% {
    translate: 0 -50%;
  }
  100% {
    translate: 0 calc(-50% + var(--pn-cart-sprout-dy));
  }
}

@keyframes pnCartSproutFade {
  0% {
    opacity: 0;
    filter: drop-shadow(0 5px 7px rgba(0,0,0,0.24)) blur(0.2px);
  }
  14% {
    opacity: 1;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.32)) blur(0);
  }
  74% {
    opacity: 0.96;
  }
  100% {
    opacity: 0.18;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2)) blur(0.4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pn-cart-sprout {
    animation-duration: 280ms;
  }
}

/* ===== Cart modal ===== */
.pn-modal__card--cart {
  max-width: 480px;
  width: 92vw;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.pn-cart-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pn-cart-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.pn-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px;
  min-height: 0;
}

.pn-cart-empty {
  text-align: center;
  color: var(--pn-text-dim, rgba(222, 226, 230, 0.55));
  padding: 32px 0;
  font-size: 14px;
}

.pn-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pn-cart-item:last-child {
  border-bottom: none;
}

.pn-cart-item__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pn-cart-item__name {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pn-cart-item__size {
  color: var(--pn-text-dim, rgba(222, 226, 230, 0.55));
  font-size: 12px;
}

.pn-cart-item__qty {
  width: 64px;
  height: 34px;
  border: 1px solid rgba(var(--pn-accent-rgb, 91, 173, 40), 0.3);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 14px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  -moz-appearance: textfield;
}

.pn-cart-item__qty::-webkit-inner-spin-button,
.pn-cart-item__qty::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.pn-cart-item__qty:focus {
  border-color: var(--pn-accent, #5bad28);
  box-shadow: 0 0 0 2px rgba(var(--pn-accent-rgb, 91, 173, 40), 0.15);
}

.pn-cart-item__qty.is-empty {
  border-color: rgba(255, 100, 100, 0.4);
}

.pn-cart-item__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(229, 57, 53, 0.07);
  color: rgba(255, 112, 112, 0.78);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
  padding: 0;
  margin-left: 6px;
  flex-shrink: 0;
}

.pn-cart-item__remove:hover {
  color: #ff6b6b;
  background: rgba(229, 57, 53, 0.18);
}

.pn-cart-item__remove:active {
  color: #fff;
  background: rgba(229, 57, 53, 0.28);
}

/* ===== Cart footer ===== */
.pn-cart-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pn-cart-bulk-info {
  margin: 0 0 12px;
  font-size: 12px;
  color: rgba(var(--pn-accent-rgb, 91, 173, 40), 0.75);
  line-height: 1.5;
  text-align: center;
}

.pn-cart-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--pn-accent, #5bad28);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s, transform 0.15s;
}

.pn-cart-submit:hover:not(:disabled) {
  background: color-mix(in srgb, var(--pn-accent, #5bad28), #fff 12%);
  transform: translateY(-1px);
}

.pn-cart-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pn-cart-submit i {
  font-size: 18px;
}

/* ===== Mobile adjustments ===== */
@media (max-width: 639px) {
  .pn-modal__card--cart {
    width: 96vw;
    max-height: 90vh;
  }

  .pn-cart-header { padding: 16px 16px 10px; }
  .pn-cart-body { padding: 8px 16px; }
  .pn-cart-footer { padding: 12px 16px 16px; }

  .pn-cart-item__name { font-size: 13px; }
  .pn-cart-item__qty { width: 56px; height: 32px; font-size: 13px; }
}
