/* ==========================================================================
   PRODUCT / NOMINAL LIST  (namespace: .pl-*)
   Dipakai khusus pada bagian "Pilih Nominal" (halaman order).
   Semua selector diberi prefix .pl- agar tidak bentrok dengan CSS global,
   Tailwind build lama, maupun komponen lain (payment, footer, header, dll).
   ========================================================================== */

:root {
  --pl-radius: 0.75rem;
  --pl-accent: var(--warna_3, #f97316);
  --pl-surface: var(--warna_4, #34373b);
  --pl-surface-2: rgba(255, 255, 255, 0.04);
  --pl-border: rgba(255, 255, 255, 0.1);
  --pl-text: #f6f6f5;
  --pl-text-muted: rgba(246, 246, 245, 0.62);
}

/* ---------- Grid ---------- */
.pl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

@media (min-width: 640px) {
  .pl-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1280px) {
  .pl-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pl-grid > * {
  min-width: 0; /* cegah overflow / horizontal scroll saat teks panjang */
}

/* ---------- Judul varian ---------- */
.pl-group-title {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--pl-text);
  overflow-wrap: anywhere;
}

.pl-group-title:first-child {
  margin-top: 0;
}

/* ---------- Card ---------- */
.pl-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  height: 100%;
  border-radius: var(--pl-radius);
  background-color: var(--pl-surface);
  border: 1px solid var(--pl-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  outline: none;
  overflow: hidden;
  isolation: isolate;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .pl-card:hover {
    border-color: var(--pl-accent);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    transform: translateY(-2px);
  }
}

.pl-card:focus-visible {
  border-color: var(--pl-accent);
  box-shadow: 0 0 0 2px var(--pl-accent);
}

.pl-card:active {
  transform: translateY(0);
}

/* state terpilih (Alpine x-bind / class .active dari jQuery) */
.pl-card.pl-card--selected,
.pl-card.active {
  border-color: var(--pl-accent);
  box-shadow:
    0 0 0 2px var(--pl-accent),
    0 6px 16px rgba(0, 0, 0, 0.35);
  background-color: color-mix(in srgb, var(--pl-accent) 12%, var(--pl-surface));
}

/* state maintenance / kosong */
.pl-card.pl-card--empty {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.pl-card.pl-card--empty:hover {
  transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  border-color: var(--pl-border);
}

/* ---------- Struktur dalam card ---------- */
.pl-card__inner {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.pl-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.625rem 0.75rem;
  background-color: transparent;
  background-size: cover;
  background-position: center;
  background-blend-mode: overlay;
}

.pl-card__name {
  display: block;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pl-text);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.05em; /* tinggi konsisten untuk nama 1 & 2 baris */
}

.pl-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  min-height: 1.5rem; /* sejajar walau produk tanpa gambar */
  margin-top: auto;
}

.pl-card__thumb {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.25rem;
  overflow: hidden;
}

.pl-card__img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* gambar tidak gepeng / terpotong */
  object-position: center;
  display: block;
}

.pl-card__prices {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pl-card__price {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--pl-accent);
  overflow-wrap: anywhere;
}

.pl-card__price-old {
  display: block;
  font-size: 0.625rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.25;
  color: var(--pl-text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .pl-card__name {
    font-size: 0.8125rem;
  }

  .pl-card__price {
    font-size: 0.875rem;
  }

  .pl-card__thumb {
    width: 1.75rem;
    height: 1.75rem;
  }

  .pl-card__meta {
    min-height: 1.75rem;
  }
}

/* ---------- Footer: badge, info, logo ---------- */
.pl-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  min-width: 0;
  min-height: 2.125rem; /* tinggi footer konsisten walau badge/logo berbeda */
  padding: 0.375rem 0.5rem;
  border-top: 1px solid var(--pl-border);
  background-color: var(--pl-surface-2);
}

.pl-card__badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background-color: var(--pl-accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.pl-card__badge--muted {
  background-color: rgba(255, 255, 255, 0.16);
  color: var(--pl-text);
}

.pl-card__logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0.1875rem;
  border-radius: 0.25rem;
  background-color: #fff;
}

.pl-card__logo svg {
  display: block;
  width: 3rem;
  height: 0.75rem;
}

.pl-card__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin-right: auto; /* info di kiri, badge tetap di kanan */
  color: var(--pl-text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.pl-card__info:hover {
  color: var(--pl-accent);
}

.pl-card__info svg {
  width: 1rem;
  height: 1rem;
}

/* indikator animasi highlight tetap di dalam card */
.pl-card__indicator {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

/* ---------- Filter varian (scroll horizontal) ---------- */
.pl-filter {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  padding: 0.25rem 0 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.pl-filter::-webkit-scrollbar {
  height: 6px;
}

.pl-filter::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.pl-filter__btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.4375rem 0.875rem;
  border: 1px solid var(--pl-border);
  border-radius: 999px;
  background: var(--pl-surface-2);
  color: var(--pl-text);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.pl-filter__btn:hover {
  border-color: var(--pl-accent);
}

.pl-filter__btn:active {
  transform: translateY(1px);
}

/* ---------- Skeleton loading ---------- */
.pl-skeleton {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem;
}

@media (min-width: 640px) {
  .pl-skeleton {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1280px) {
  .pl-skeleton {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pl-skeleton__item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  height: 100%;
  padding: 0.75rem;
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius);
  background-color: var(--pl-surface);
}

.pl-skeleton__line {
  height: 0.75rem;
  border-radius: 0.25rem;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 25%,
    rgba(255, 255, 255, 0.14) 37%,
    rgba(255, 255, 255, 0.06) 63%
  );
  background-size: 400% 100%;
  animation: pl-skeleton-shimmer 1.4s ease infinite;
}

.pl-skeleton__line--title {
  width: 80%;
}

.pl-skeleton__line--price {
  width: 55%;
  height: 0.875rem;
}

.pl-skeleton__line--footer {
  width: 100%;
  height: 1.25rem;
  margin-top: auto;
}

@keyframes pl-skeleton-shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pl-card,
  .pl-filter__btn {
    transition: none;
  }

  .pl-card:hover {
    transform: none;
  }

  .pl-skeleton__line {
    animation: none;
  }
}

/* ---------- Empty state ---------- */
.pl-empty {
  grid-column: 1 / -1;
  padding: 1.5rem 1rem;
  border: 1px dashed var(--pl-border);
  border-radius: var(--pl-radius);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--pl-text-muted);
}
