/* PawonKu shim: utility kelas tambahan yang tidak ada di build Meridian
   (karena scanner Tailwind Meridian hanya include kelas yang dipakai di
   template aslinya). File ini HANYA boleh berisi utility yang benar-benar
   tidak tersedia di style.css -- jangan duplikasi kelas yang sudah ada di
   sana (mis. .w-full, .h-full), karena file ini dimuat SETELAH style.css
   sehingga aturan apa pun di sini otomatis menang di cascade meski
   spesifisitasnya sama, termasuk mengalahkan aturan responsive di dalam
   @media milik style.css.

   Aturan penataan: base (mobile-first, tanpa breakpoint) dulu, baru semua
   @media breakpoint terurut naik (sm -> md -> lg -> xl) di BAGIAN PALING
   BAWAH. Jangan sisipkan @media baru di tengah/append sembarangan -- taruh
   selalu di grup breakpoint yang sudah ada supaya urutan source tetap benar
   dan tidak salah menang cascade seperti sebelumnya. */

[x-cloak] { display: none !important; }

.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }

.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.mt-1 { margin-top: .25rem; }
.mt-4 { margin-top: 1rem; }
.ms-auto { margin-inline-start: auto; }

.space-y-1 > * + * { margin-top: .25rem; }

.list-disc { list-style-type: disc; }
.list-inside { list-style-position: inside; }

.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-end { text-align: end; }
.text-start { text-align: start; }
.text-center { text-align: center; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.hidden { display: none; }
.inline { display: inline; }
.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }
.items-center { align-items: center; }

.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }

.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-muted-foreground { color: var(--color-muted-foreground); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }

.field__error { font-size: .75rem; color: var(--color-danger); margin-top: .25rem; }
.field:has(.field__error) .input,
.field:has(.field__error) .select,
.field:has(.field__error) .textarea { border-color: var(--color-danger); }

.bg-muted { background-color: var(--color-surface-2); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

.aspect-square { aspect-ratio: 1 / 1; }

.opacity-50 { opacity: .5; }
.opacity-60 { opacity: .6; }

.pointer-events-none { pointer-events: none; }

.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: -webkit-sticky; position: sticky; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.top-1 { top: .25rem; }
.right-0 { right: 0; }
.right-1 { right: .25rem; }
.left-0 { left: 0; }
.z-10 { z-index: 10; }

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.max-h-full { max-height: 100%; }

.transition { transition: all .15s ease; }
.hover\:shadow-md:hover { box-shadow: var(--shadow-md); }
.hover\:border-primary:hover { border-color: var(--color-primary); }

.w-96 { width: 24rem; }

/* ===== Komponen khusus halaman POS / Catat Penjualan ===== */

.product-picker {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing) * 4);
    max-height: calc(100dvh - 14rem);
    overflow-y: auto;
    padding-right: calc(var(--spacing) * 1);
}

.product-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: start;
    cursor: pointer;
    background: var(--color-surface);
    border: var(--st-border-width, 1px) solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 0;
    transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.product-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.product-card:active { transform: scale(0.98); }
.product-card:focus-visible { outline: 2px solid var(--color-ring); outline-offset: 2px; }
.product-card[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

.product-card__media {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-card__badge { position: absolute; top: .375rem; right: .375rem; }
.product-card__body { padding: .625rem .75rem .75rem; display: flex; flex-direction: column; gap: .125rem; }
.product-card__name {
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.3em * 2);
}
.product-card__price { font-size: var(--text-sm); font-weight: 600; color: var(--color-primary-emphasis, var(--color-primary)); }
.product-card__stock { font-size: .6875rem; color: var(--color-muted-foreground); }

.pos-cart { position: -webkit-sticky; position: sticky; top: calc(var(--spacing) * 4); }

.cart-list { display: flex; flex-direction: column; }
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: .75rem;
    padding-block: .625rem;
    border-bottom: var(--st-border-width, 1px) solid var(--color-border);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item__name { font-size: var(--text-sm); font-weight: 500; line-height: 1.3; }
.cart-item__price { font-size: .75rem; color: var(--color-muted-foreground); }
.cart-item__qty { display: flex; align-items: center; gap: .375rem; }
.cart-item__qty-value { min-width: 1.5rem; text-align: center; font-size: var(--text-sm); font-weight: 500; }

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: .5rem;
    padding-block: calc(var(--spacing) * 8);
    color: var(--color-muted-foreground);
}
.cart-empty svg { width: 2.5rem; height: 2.5rem; opacity: .4; }
.cart-empty p { font-size: var(--text-sm); margin: 0; }

.qty-btn {
    width: calc(var(--spacing) * 7);
    height: calc(var(--spacing) * 7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: var(--st-border-width, 1px) solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-foreground);
    cursor: pointer;
    line-height: 1;
    font-size: 1rem;
    transition: background-color .15s ease, border-color .15s ease;
}
.qty-btn:hover:not(:disabled) { background: var(--color-accent); border-color: var(--color-primary); }
.qty-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== Breakpoints (mobile-first, urut naik) ===== */

@media (min-width: 640px) {
    .sm\:inline { display: inline; }
    .sm\:items-end { align-items: end; }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-\[1fr_9rem_auto\] { grid-template-columns: 1fr 9rem auto; }
    .product-picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .md\:items-center { align-items: center; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-\[1fr_8rem_10rem_8rem_auto\] { grid-template-columns: 1fr 8rem 10rem 8rem auto; }
    .md\:grid-cols-\[1fr_7rem_9rem_7rem_auto\] { grid-template-columns: 1fr 7rem 9rem 7rem auto; }
    .md\:grid-cols-\[1fr_7rem_8rem_7rem_auto\] { grid-template-columns: 1fr 7rem 8rem 7rem auto; }
    .md\:w-64 { width: 16rem; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .product-picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .xl\:grid-cols-\[1\.5fr_1fr\] { grid-template-columns: 1.5fr 1fr; }
    .xl\:grid-cols-\[1fr_1fr\] { grid-template-columns: 1fr 1fr; }
    .xl\:col-span-2 { grid-column: span 2 / span 2; }
    .product-picker-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1536px) {
    .product-picker-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
