/* products/static/products/css/products.css */

/* ---------- Category pills ---------- */
.cat-pills { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.cat-pill {
    border: 1px solid rgba(0, 0, 0, .12);
    background: #fff;
    color: #495057;
    border-radius: 50rem;
    padding: .5rem 1.1rem;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color .15s, color .15s, border-color .15s;
}
.cat-pill:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.cat-pill.active { background: var(--bs-primary); border-color: var(--bs-primary); color: #fff; }
.cat-pill:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb), .4); outline-offset: 2px; }

/* ---------- Card ---------- */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 1.25rem;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: box-shadow .2s ease, transform .2s ease;
}
.product-card:hover { box-shadow: 0 1rem 2rem rgba(0, 0, 0, .09); transform: translateY(-3px); color: inherit; }
.product-card:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb), .45); outline-offset: 2px; }
.product-card-img { position: relative; aspect-ratio: 4 / 3; background: #f3f4f8; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { display: flex; flex-direction: column; flex-grow: 1; padding: 1.25rem; }
.product-card-cat { font-size: .8rem; font-weight: 600; color: var(--bs-primary); text-decoration: none; margin-bottom: .35rem; }

.product-flag {
    position: absolute;
    top: .75rem;
    inset-inline-start: .75rem;
    background: #ffc107;
    color: #3d2f00;
    font-size: .75rem;
    font-weight: 600;
    padding: .25rem .65rem;
    border-radius: 50rem;
}
.product-flag-out { background: #dc3545; color: #fff; }
.product-flag-feat { background: var(--bs-primary); color: #fff; }

.product-price { font-size: 1.25rem; font-weight: 700; }
.product-price small { font-size: .75rem; font-weight: 500; color: #6c757d; }
.product-price-lg { font-size: 2rem; }
.product-price-lg small { font-size: 1rem; }

/* ---------- Detail gallery ---------- */
.product-main-img { aspect-ratio: 1 / 1; background: #f3f4f8; border-radius: 1.25rem; overflow: hidden; }
.product-main-img img { width: 100%; height: 100%; object-fit: cover; }
.product-thumbs { display: flex; gap: .6rem; flex-wrap: wrap; }
.product-thumb {
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: .75rem;
    overflow: hidden;
    background: #f3f4f8;
    opacity: .7;
    transition: opacity .15s, border-color .15s;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb:hover, .product-thumb.active { opacity: 1; }
.product-thumb.active { border-color: var(--bs-primary); }
.product-thumb:focus-visible { outline: 3px solid rgba(var(--bs-primary-rgb), .45); outline-offset: 2px; }

.product-specs {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .4rem 1.25rem;
    margin: 0;
    padding: 1rem 0;
    border-top: 1px solid rgba(0, 0, 0, .08);
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.product-specs dt { color: #6c757d; font-weight: 500; }
.product-specs dd { margin: 0; }

.product-qty { width: 84px; }

/* ---------- Cart & order summary ---------- */
.cart-lines { border-top: 1px solid rgba(0, 0, 0, .08); }
.cart-line { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.cart-line-img { width: 72px; height: 72px; object-fit: cover; border-radius: .75rem; background: #f3f4f8; flex-shrink: 0; }
.cart-line-info { flex: 1 1 auto; min-width: 0; }
.cart-line-total { min-width: 90px; text-align: end; font-weight: 600; }

@media (max-width: 575.98px) {
    .cart-line { flex-wrap: wrap; }
    .cart-line-info { flex-basis: calc(100% - 90px); }
    .cart-line-total { margin-inline-start: auto; }
}

.order-summary { background: #fff; border: 1px solid rgba(0, 0, 0, .08); border-radius: 1.25rem; padding: 1.5rem; }
aside.order-summary { position: sticky; top: 6rem; }

.success-mark {
    width: 72px;
    height: 72px;
    margin-inline: auto;
    border-radius: 50%;
    background: rgba(25, 135, 84, .12);
    color: #198754;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

@media (prefers-reduced-motion: reduce) {
    .product-card, .product-thumb, .cat-pill { transition: none; }
    .product-card:hover { transform: none; }
}

/* Fixed-size image box for every product card */
.product-card-img {
    position: relative;          /* keep badge positioned inside */
    width: 100%;
    aspect-ratio: 4 / 3;         /* or 1 / 1, 16 / 9, etc. — pick one */
    overflow: hidden;
    border-radius: 12px;         /* optional, matches your design */
    background: #f3f4f6;         /* placeholder colour while loading */
}

/* Image fills the box, cropped — never stretched */
.product-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;           /* or `contain` if you must show the whole image */
    object-position: center;
    display: block;
}

/* Optional: make the whole card equal height too */
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.product-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}
/* =====================================================================================================
   .cx shop pages (list, card, detail, cart, checkout) - built on the tokens of subscriptions/css/catalog.css
   (light/dark via [data-bs-theme]); logical properties for RTL. Older classes above stay for the detail
   gallery/specs and the stand pages.
   ===================================================================================================== */
.px-shop .px-kicker { margin-bottom: .75rem; background: var(--cx-brand-soft); color: var(--cx-brand); }
.px-steps { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 0;
    margin: 1.25rem 0 0; counter-reset: px-step; }
.px-steps li { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: 0 .85rem;
    border-radius: 999px; background: var(--cx-card); border: 1px solid var(--cx-line); font-weight: 700;
    font-size: .9rem; counter-increment: px-step; }
.px-steps li::before { content: counter(px-step); display: inline-grid; place-items: center; width: 22px; height: 22px;
    border-radius: 50%; background: var(--cx-brand); color: var(--cx-brand-ink); font-size: .75rem; }
.px-steps i { color: var(--cx-brand); }

.px-filter { justify-content: center; }
.px-filter button { display: inline-flex; align-items: center; gap: .35rem; }
.px-filter button:focus-visible { box-shadow: var(--cx-focus); }

.px-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.px-grid > .filter-item { display: flex; }
.px-grid > .filter-item.d-none { display: none !important; }
.px-grid > .filter-item > .px-card, .px-grid > .px-card { flex: 1; }

.px-card { gap: .55rem; padding: .75rem .75rem 1rem; }
.px-card-img { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--cx-radius-sm);
    background: var(--cx-surface); }
.px-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.px-card:hover .px-card-img img { transform: scale(1.03); }
.px-card h3 { font-size: 1.05rem; margin: 0; padding-inline: .25rem; }
.px-card .cx-for { min-height: 0; padding-inline: .25rem; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden; }
.px-card-title { color: var(--cx-text) !important; text-decoration: none; }
.px-card-title:hover { color: var(--cx-brand) !important; }
.px-cat { display: inline-flex; align-items: center; gap: .35rem; padding-inline: .25rem; font-size: .8rem;
    font-weight: 800; color: var(--cx-brand); }
.px-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding-inline: .25rem; flex-wrap: wrap; }
.px-price { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.px-price-lg { font-size: 1.9rem; }
.px-flag { position: absolute; inset-block-start: .6rem; inset-inline-start: .6rem; padding: .2rem .6rem; border-radius: 999px;
    font-size: .75rem; font-weight: 800; background: var(--cx-warn-soft); color: var(--cx-warn); }
.px-flag.is-out { background: #b42318; color: #fff; }
.px-flag.is-feat { background: var(--cx-brand); color: var(--cx-brand-ink); }

.cx .px-btn-auto { width: auto; }
.px-empty { align-items: center; text-align: center; padding-block: 2.5rem; grid-column: 1 / -1; }
.px-empty > i { font-size: 2.4rem; color: var(--cx-muted); }

/* detail */
.px-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: 1rem; font-size: .9rem;
    color: var(--cx-muted); }
.px-crumbs a { text-decoration: none; font-weight: 700; }
.px-crumbs i { font-size: .7rem; }
.px-detail { display: grid; gap: 1.25rem; align-items: start; }
.px-main-img { border-radius: var(--cx-radius); background: var(--cx-surface); }
.px-rating { display: inline-flex; align-items: center; gap: .3rem; text-decoration: none; font-size: .9rem; }
.px-rating .bi-star-fill { color: #f5a524; }
.px-stock { display: flex; align-items: center; gap: .35rem; margin: 0; font-weight: 700; color: var(--cx-accent); }
.px-stock.is-low { color: var(--cx-warn); }
.px-stock.is-out { color: #b42318; }
.px-buy-form { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.px-buy-form .cx-btn.is-ghost { grid-column: 1 / -1; }
.px-qty { min-height: 48px; text-align: center; font-size: 16px; border-radius: 12px; }
.px-desc { color: var(--cx-text); line-height: 1.8; }
.px-desc p:last-child { margin-bottom: 0; }
.cx .product-specs { border-color: var(--cx-line); }
.cx .product-specs dt { color: var(--cx-muted); }

/* cart + checkout */
.px-cols { display: grid; gap: 16px; align-items: start; }
.px-cols .cart-lines { border-top: 0; }
.px-cols .cart-line { border-bottom-color: var(--cx-line); }
.px-cols .cart-line:last-child { border-bottom: 0; }
.px-cols .cart-line a { color: var(--cx-text); text-decoration: none; }
.px-cols .cart-line-img { background: var(--cx-surface); }
.px-cols .px-qty { width: 84px; min-height: 44px; }
.px-icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px;
    background: transparent; color: #b42318; cursor: pointer; }
.px-icon-btn:hover { background: rgba(180, 35, 24, .08); }
.px-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.px-link { font-weight: 700; text-decoration: none; }
.px-summary { gap: .75rem; }
.px-total { display: flex; justify-content: space-between; align-items: baseline; padding-block: .75rem;
    border-block: 1px solid var(--cx-line); font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.px-mini-line { display: flex; align-items: center; gap: .75rem; }
.px-mini-line .cart-line-img { width: 56px; height: 56px; }
.min-w-0 { min-width: 0; }

@media (min-width: 576px) {
    .px-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
    .px-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
    .px-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
    .px-cols { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
    .px-summary { position: sticky; inset-block-start: 6rem; }
}
@media (prefers-reduced-motion: reduce) {
    .px-card-img img { transition: none; }
    .px-card:hover .px-card-img img { transform: none; }
}
