/* Reusable component classes — see docs/design-system.md #5 */

/* Buttons */
.bb-btn-primary,
.bb-btn-secondary,
.bb-btn-accent,
.bb-btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--fs-body);
    padding: 0.625rem 1.25rem;
    min-height: 44px;
    transition: background-color var(--motion-fast) var(--motion-ease),
                border-color var(--motion-fast) var(--motion-ease),
                color var(--motion-fast) var(--motion-ease);
}

.bb-btn-primary {
    background-color: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: #fff;
}
.bb-btn-primary:hover {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary-light);
    color: #fff;
}

.bb-btn-secondary {
    background-color: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}
.bb-btn-secondary:hover {
    background-color: var(--color-primary);
    color: #fff;
}

/* Alias kept for existing views (product-card.php, home sections) using the
   original .bb-btn-gold class name — see docs/design-system.md #5 */
.bb-btn-accent,
.bb-btn-gold {
    background-color: var(--color-accent);
    border: 1px solid var(--color-accent);
    color: var(--color-primary-dark);
}
.bb-btn-accent:hover,
.bb-btn-gold:hover {
    background-color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    color: var(--color-primary-dark);
}

.bb-btn-text {
    background: transparent;
    border: 1px solid transparent;
    color: var(--color-primary);
    padding-inline: var(--space-2);
    min-height: auto;
}
.bb-btn-text:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Cards */
.bb-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.bb-card--flush { padding: 0; }
.bb-card--pad { padding: var(--space-4); }
@media (min-width: 992px) {
    .bb-card--pad { padding: var(--space-5); }
}

/* Badges */
.bb-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding-inline: var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--fs-caption);
    font-weight: 700;
    line-height: 1;
}
.bb-badge--new { background-color: var(--color-accent); color: var(--color-primary-dark); }
.bb-badge--sale { background-color: var(--color-danger); color: #fff; }
.bb-badge--bestseller { background-color: var(--color-primary); color: #fff; }
.bb-badge--tier { background-color: var(--color-surface-soft); border: 1px solid var(--color-border); color: var(--color-text); }
.bb-badge--countdown { background-color: rgba(255, 255, 255, 0.92); color: var(--color-primary-dark); }

/* Forms */
.bb-field { margin-bottom: var(--space-4); }
.bb-field label {
    display: block;
    font-size: var(--fs-small);
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--color-text);
}
.bb-field .bb-field__help {
    font-size: var(--fs-caption);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}
.bb-field .bb-field__error {
    font-size: var(--fs-caption);
    color: var(--color-danger);
    margin-top: var(--space-1);
}
.form-control,
.form-select {
    border-color: var(--color-border);
    border-radius: var(--radius-sm);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

/* Empty states */
.bb-empty-state {
    text-align: center;
    padding: var(--space-7) var(--space-4);
    color: var(--color-text-muted);
}
.bb-empty-state i {
    font-size: 2rem;
    color: var(--color-border);
    margin-bottom: var(--space-3);
}
.bb-empty-state h3 {
    color: var(--color-text);
    font-size: var(--fs-h4);
    margin-bottom: var(--space-2);
}
.bb-empty-state p { margin-bottom: var(--space-4); }

/* Skeleton loaders */
.bb-skeleton {
    position: relative;
    overflow: hidden;
    background-color: var(--color-surface-soft);
    border-radius: var(--radius-sm);
}
.bb-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: bb-skeleton-shimmer 1.4s infinite;
}
@keyframes bb-skeleton-shimmer {
    100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
    .bb-skeleton::after { animation: none; }
}

/* Product card */
.bb-product-card {
    position: relative;
    display: block;
    height: 100%;
    overflow: hidden;
    transition: box-shadow var(--motion-base) var(--motion-ease), transform var(--motion-base) var(--motion-ease);
}
.bb-product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}
.bb-product-card__link {
    display: block;
    text-decoration: none;
    color: var(--color-text);
}
.bb-product-card__link:hover {
    color: var(--color-text);
}
.bb-product-card__actions {
    position: absolute;
    top: var(--space-2);
    inset-inline-end: var(--space-2);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.bb-product-card__wishlist-form,
.bb-product-card__add-to-cart-form {
    /* No box of its own — its child button lays out directly inside
       .bb-product-card__actions, same as the guest wishlist <a> variant. */
    display: contents;
}
.bb-product-card__wishlist,
.bb-product-card__add-to-cart,
.bb-product-card__quick-view {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
    transition: background-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.bb-product-card__wishlist:hover,
.bb-product-card__add-to-cart:hover,
.bb-product-card__quick-view:hover {
    background-color: #fff;
}
.bb-product-card__quick-view:hover {
    color: var(--color-primary);
}
.bb-product-card__wishlist:hover {
    color: var(--color-danger);
}
.bb-product-card__wishlist.is-active {
    color: var(--color-danger);
}
.bb-product-card__add-to-cart:hover {
    color: var(--color-primary);
}
.bb-product-card__add-to-cart.is-added {
    background-color: var(--color-success);
    color: #fff;
}
.bb-product-card__add-to-cart:disabled {
    background-color: rgba(255, 255, 255, 0.6);
    color: var(--color-text-muted);
    cursor: not-allowed;
}
.bb-product-card__media {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.bb-product-card__media img {
    display: block;
    width: 100%;
    transition: transform var(--motion-slow) var(--motion-ease), opacity var(--motion-slow) var(--motion-ease);
}
.bb-product-card:hover .bb-product-card__media img {
    transform: scale(1.04);
}
.bb-product-card__img--secondary {
    position: absolute;
    inset: 0;
    opacity: 0;
}
.bb-product-card:hover .bb-product-card__img--secondary {
    opacity: 1;
}
.bb-product-card:hover .bb-product-card__media--has-secondary .bb-product-card__img--primary {
    opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
    .bb-product-card,
    .bb-product-card__media img { transition: none; }
    .bb-product-card:hover .bb-product-card__media img { transform: none; }
    .bb-product-card:hover { transform: none; }
}
.bb-product-card__badges {
    position: absolute;
    top: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.bb-badge--stock-out { background-color: var(--color-text-muted); color: #fff; }
.bb-badge--stock-low { background-color: var(--color-warning); color: #fff; }
.bb-product-card__body {
    padding: var(--space-3);
}
.bb-product-card__meta {
    font-size: var(--fs-caption);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bb-product-card__name {
    font-size: var(--fs-small);
    margin-bottom: var(--space-1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(var(--fs-small) * 1.3 * 2);
}
.bb-product-card__rating {
    display: flex;
    align-items: center;
    gap: 2px;
    color: var(--color-accent-dark);
    font-size: 0.7rem;
    margin-bottom: var(--space-1);
}
.bb-product-card__rating-count {
    color: var(--color-text-muted);
    font-size: var(--fs-caption);
    margin-inline-start: var(--space-1);
}
/* Price display component (components/price-display.php) — used by the
   product card ("sm") and the product detail page ("lg"). */
.bb-price-display--sm {
    font-weight: 700;
    font-size: var(--fs-body-lg);
}
.bb-price-display--sm .bb-price-display__was {
    color: var(--color-text-muted);
    text-decoration: line-through;
    font-weight: 400;
    font-size: var(--fs-caption);
    margin-inline-start: var(--space-2);
}
.bb-price-display__savings {
    color: var(--color-success);
    font-size: var(--fs-caption);
    font-weight: 600;
    margin-top: var(--space-1);
}
.bb-price-display--lg {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}
.bb-price-display--lg .bb-price-display__current {
    font-size: var(--fs-h2);
    font-weight: 700;
}
.bb-price-display--lg .bb-price-display__was {
    color: var(--color-text-muted);
    text-decoration: line-through;
}

/* Category card */
.bb-category-card {
    display: block;
    text-decoration: none;
    color: var(--color-text);
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--motion-base) var(--motion-ease), transform var(--motion-base) var(--motion-ease);
}
.bb-category-card:hover {
    color: var(--color-text);
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}
.bb-category-card img {
    display: block;
    width: 100%;
    transition: transform var(--motion-slow) var(--motion-ease);
}
.bb-category-card:hover img {
    transform: scale(1.04);
}
.bb-category-card__label {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: var(--space-4) var(--space-3) var(--space-3);
    background: linear-gradient(0deg, rgba(var(--color-overlay-dark-rgb), 0.7) 0%, rgba(var(--color-overlay-dark-rgb), 0) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
}
.bb-category-card__name {
    font-weight: 700;
    font-size: var(--fs-body);
}
.bb-category-card__cta {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding-inline: var(--space-3);
    border-radius: var(--radius-sm);
    background-color: var(--color-primary);
    color: #fff;
    font-size: var(--fs-caption);
    font-weight: 700;
}
.bb-category-card__badge {
    position: absolute;
    inset-inline-start: var(--space-3);
    top: var(--space-3);
}
/* Editorial-scale variant for room/collection grids — same card, bigger image + name. */
.bb-category-card--lg .bb-category-card__name { font-size: var(--fs-h4); }
.bb-category-card--lg .bb-category-card__label { padding: var(--space-5) var(--space-4) var(--space-4); }
@media (prefers-reduced-motion: reduce) {
    .bb-category-card,
    .bb-category-card img { transition: none; }
    .bb-category-card:hover img { transform: none; }
    .bb-category-card:hover { transform: none; }
}

/* Icon button — shared by the customer header and the admin top bar */
.bb-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    color: var(--color-text);
    text-decoration: none;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    transition: background-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.bb-icon-btn:hover {
    background-color: var(--color-surface-soft);
    color: var(--color-primary);
}
.bb-icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    background-color: var(--color-surface-soft);
}
.bb-icon-btn__badge {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background-color: var(--color-accent);
    color: var(--color-primary-dark);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Breadcrumbs */
.bb-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-4);
    font-size: var(--fs-small);
    color: var(--color-text-muted);
}
.bb-breadcrumb a {
    color: var(--color-text-muted);
    text-decoration: none;
}
.bb-breadcrumb a:hover { color: var(--color-primary); }
.bb-breadcrumb li:not(:last-child)::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-inline-start: var(--space-2);
    border-inline-start: 1.5px solid var(--color-border);
    border-bottom: 1.5px solid var(--color-border);
    transform: rotate(-45deg);
}
[dir="rtl"] .bb-breadcrumb li:not(:last-child)::after {
    transform: rotate(135deg);
}
.bb-breadcrumb li[aria-current="page"] { color: var(--color-text); font-weight: 600; }

/* Long-form CMS page content (resources/views/page/show.php) */
.bb-page-content {
    max-width: 760px;
}

/* Filter bar + active-filter chips */
.bb-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-3);
}
.bb-filter-bar__search {
    max-width: 260px;
}
.bb-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 36px;
    padding-inline: var(--space-3);
    border-radius: var(--radius-pill);
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: var(--fs-small);
    font-weight: 600;
    text-decoration: none;
    transition: border-color var(--motion-fast) var(--motion-ease), background-color var(--motion-fast) var(--motion-ease);
}
.bb-filter-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.bb-filter-chip--active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.bb-filter-chip--active:hover { color: #fff; }
.bb-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-4);
}
.bb-active-filters__tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 30px;
    padding-inline-start: var(--space-3);
    padding-inline-end: var(--space-2);
    border-radius: var(--radius-pill);
    background-color: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    font-size: var(--fs-caption);
    color: var(--color-text);
    text-decoration: none;
}
.bb-active-filters__tag:hover { color: var(--color-danger); border-color: var(--color-danger); }
.bb-active-filters__clear {
    font-size: var(--fs-caption);
    color: var(--color-text-muted);
    text-decoration: underline;
}

/* Pagination */
.pagination .page-link {
    color: var(--color-text);
    border-color: var(--color-border);
}
.pagination .page-item.active .page-link {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.pagination .page-link:hover {
    color: var(--color-primary);
    background-color: var(--color-surface-soft);
}

/* Enhanced pagination (components/pagination.php: shop/category/collection) —
   layered on top of the base .pagination rules above, not a replacement,
   so admin's plain Bootstrap .pagination usage is untouched. */
.bb-pagination {
    gap: var(--space-1);
}
.bb-pagination .page-link {
    border-radius: var(--radius-pill);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-weight: 600;
}
.bb-pagination .page-item.disabled .page-link {
    color: var(--color-text-muted);
    background-color: transparent;
    border-color: transparent;
    pointer-events: none;
}
.bb-pagination__ellipsis .page-link {
    border: none;
    background: transparent;
}

/* Listing filters sidebar (shop/category/collection) */
.bb-filters-col {
    align-self: start;
}
.bb-filters-sidebar {
    position: sticky;
    top: calc(var(--space-4) + 128px); /* clears the sticky header + category nav row */
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.bb-filters-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}
.bb-filters-sidebar__title {
    font-size: var(--fs-h4);
    font-weight: 700;
    margin: 0;
}
.bb-filters-sidebar__clear {
    font-size: var(--fs-small);
    color: var(--color-text-muted);
    text-decoration: underline;
}
.bb-filters-sidebar__clear:hover { color: var(--color-danger); }
.bb-filters-sidebar__section {
    padding-block: var(--space-3);
    border-top: 1px solid var(--color-border);
}
.bb-filters-sidebar__section:first-of-type { border-top: none; padding-top: 0; }
.bb-filters-sidebar__heading {
    font-size: var(--fs-small);
    font-weight: 700;
    margin-bottom: var(--space-2);
}
.bb-filters-sidebar__checkbox,
.bb-filters-sidebar__radio {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-small);
    padding-block: var(--space-1);
    cursor: pointer;
}
.bb-filters-sidebar__price-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.bb-filters-sidebar__price-inputs input {
    width: 0;
    flex: 1 1 0;
}
.bb-filters-sidebar__price-apply {
    width: 100%;
    margin-top: var(--space-2);
}
.bb-filters-sidebar__more summary {
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    padding-block: var(--space-1);
    list-style: none;
}
.bb-filters-sidebar__more summary::-webkit-details-marker { display: none; }
.bb-filters-sidebar__more summary::before {
    content: "\f107";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-inline-end: var(--space-2);
    display: inline-block;
    transition: transform var(--motion-fast) var(--motion-ease);
}
.bb-filters-sidebar__more[open] summary::before { transform: rotate(180deg); }

/* Listing toolbar (result count + sort + grid/list toggle) */
.bb-listing-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.bb-listing-toolbar__count {
    margin: 0;
    color: var(--color-text-muted);
}
.bb-listing-toolbar__controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.bb-listing-toolbar__sort-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.bb-listing-toolbar__sort-label {
    font-size: var(--fs-small);
    color: var(--color-text-muted);
    white-space: nowrap;
}
.bb-listing-toolbar__sort-form select {
    min-width: 180px;
    border-radius: var(--radius-pill);
    padding-inline-start: var(--space-4);
}
.bb-view-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.bb-view-toggle__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--color-text-muted);
    transition: background-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.bb-view-toggle__btn:hover { color: var(--color-primary); }
.bb-view-toggle__btn.is-active {
    background-color: var(--color-primary);
    color: #fff;
}
.bb-view-toggle__btn:not(:last-child) { border-inline-end: 1px solid var(--color-border); }

/* List-view override — reuses the exact same .bb-product-card markup,
   just relaid out horizontally, so product-card.php never branches on
   view mode. */
.bb-product-grid--list {
    --list-media-width: 220px;
}
.bb-product-grid--list .bb-product-card {
    display: flex;
    flex-direction: row;
    height: auto;
}
.bb-product-grid--list .bb-product-card__link {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
}
.bb-product-grid--list .bb-product-card__media {
    width: var(--list-media-width);
    flex-shrink: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.bb-product-grid--list .bb-product-card__body {
    flex: 1 1 auto;
    min-width: 0;
}
.bb-product-grid--list .bb-product-card__name {
    -webkit-line-clamp: 1;
    min-height: 0;
}
.bb-product-grid--list .bb-product-card__actions {
    position: static;
    flex-direction: row;
    align-self: flex-start;
    padding: var(--space-3);
}
@media (max-width: 575.98px) {
    .bb-product-grid--list .bb-product-card { flex-direction: column; }
    .bb-product-grid--list .bb-product-card__media { width: 100%; border-radius: var(--radius-md) var(--radius-md) 0 0; }
    .bb-product-grid--list .bb-product-card__actions { position: absolute; top: var(--space-2); inset-inline-end: var(--space-2); flex-direction: column; padding: 0; }
}

/* Listing page hero (category/collection banner) — a real <picture>/<img>
   layer rather than an inline background-image style, so mobile_image can
   actually be swapped in via a <source> media query. */
.bb-listing-hero {
    position: relative;
    overflow: hidden;
    min-height: 320px;
    display: flex;
    align-items: flex-end;
}
@media (min-width: 992px) {
    .bb-listing-hero { min-height: 420px; }
}
.bb-listing-hero__media {
    position: absolute;
    inset: 0;
    display: block;
    margin: 0;
}
.bb-listing-hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.bb-listing-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(var(--color-overlay-dark-rgb), 0.65) 0%, rgba(var(--color-overlay-dark-rgb), 0.15) 55%, rgba(var(--color-overlay-dark-rgb), 0) 80%);
}
.bb-listing-hero__content {
    position: relative;
    color: #fff;
    padding-block: var(--space-6);
    width: 100%;
}
.bb-listing-hero__content .bb-body-lg { color: rgba(255, 255, 255, 0.9); }
.bb-listing-hero__description { max-width: 640px; }
.bb-listing-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}
.bb-breadcrumb--on-image,
.bb-breadcrumb--on-image a { color: rgba(255, 255, 255, 0.75); }
.bb-breadcrumb--on-image a:hover { color: #fff; }
.bb-breadcrumb--on-image li:not(:last-child)::after { border-inline-start-color: rgba(255, 255, 255, 0.5); border-bottom-color: rgba(255, 255, 255, 0.5); }
.bb-breadcrumb--on-image li[aria-current="page"] { color: #fff; }
.bb-badge--on-image { background-color: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.4); color: #fff; }

/* Subcategory chip row under a category hero — reuses .bb-filter-chip's
   visual language (pill, bordered) for a plain navigation link instead of
   a toggleable filter. */
.bb-subcategory-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

/* Stock status — shared by product detail and cart */
.bb-stock {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--fs-small);
    font-weight: 600;
}
.bb-stock--in { color: var(--color-success); }
.bb-stock--low { color: var(--color-warning); }
.bb-stock--out { color: var(--color-danger); }

/* Quantity stepper — shared by product detail and cart */
.bb-qty-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 44px;
}
.bb-qty-stepper--sm { height: 36px; }
.bb-qty-stepper--sm button { width: 36px; }
.bb-qty-stepper--sm input { width: 44px; }
.bb-qty-stepper button {
    width: 44px;
    border: none;
    background-color: var(--color-surface-soft);
    color: var(--color-text);
    font-size: 1rem;
    line-height: 1;
}
.bb-qty-stepper button:hover { background-color: var(--color-border); }
.bb-qty-stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.bb-qty-stepper input {
    width: 52px;
    border: none;
    border-inline: 1px solid var(--color-border);
    text-align: center;
    font-weight: 600;
    -moz-appearance: textfield;
}
.bb-qty-stepper input::-webkit-outer-spin-button,
.bb-qty-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Accordion (product specs/FAQ, loyalty rules) — restyle Bootstrap defaults
   to match tokens. Shared across pages, hence living here rather than a
   page-scoped stylesheet. */
.bb-specs-accordion .accordion-item {
    border-color: var(--color-border);
    border-radius: var(--radius-md) !important;
    margin-bottom: var(--space-2);
    overflow: hidden;
}
.bb-specs-accordion .accordion-button {
    font-weight: 600;
    color: var(--color-text);
    background-color: var(--color-surface);
}
.bb-specs-accordion .accordion-button:not(.collapsed) {
    background-color: var(--color-surface-soft);
    color: var(--color-primary);
    box-shadow: none;
}
.bb-specs-accordion .accordion-button:focus { box-shadow: var(--shadow-focus); }

/* Checkout guest-details "you already have an account" inline prompt
   (checkout-account-prompt.js) — shares the register-prompt modal's page,
   hence living here rather than a page-scoped stylesheet. */
.bb-account-prompt {
    margin-top: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-soft);
    border: 1px solid var(--color-border);
}
.bb-account-prompt p {
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

/* Account dashboard */
.bb-account-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}
#bb-account-orders,
#bb-account-showroom,
#bb-account-wishlist,
#bb-account-addresses {
    scroll-margin-top: calc(var(--space-8) + 40px); /* clears the sticky header */
}
.bb-account-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    transition: background-color var(--motion-fast) var(--motion-ease);
}
.bb-account-row:last-child { border-bottom: none; }
.bb-account-row:hover { background-color: var(--color-surface-soft); color: var(--color-text); }
.bb-account-row__chevron {
    color: var(--color-text-muted);
    font-size: var(--fs-small);
}
@media (prefers-reduced-motion: reduce) {
    .bb-account-row { transition: none; }
}

/* Checkout: single-method payment row (no fake interactive control) */
.bb-payment-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.bb-payment-option__icon {
    font-size: 1.25rem;
    color: var(--color-success);
}

/* Cart item row */
.bb-cart-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-4);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
}
.bb-cart-item__image {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.bb-cart-item__body {
    flex: 1 1 auto;
    min-width: 0;
}
.bb-cart-item__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-2);
}
.bb-cart-item__name {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}
.bb-cart-item__name:hover { color: var(--color-primary); }
.bb-cart-item__variant {
    color: var(--color-text-muted);
    font-size: var(--fs-small);
    margin-top: 2px;
}
.bb-cart-item__footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.bb-cart-item__price {
    text-align: end;
}
.bb-cart-item__price-total {
    font-weight: 700;
}
.bb-cart-item__price-unit {
    color: var(--color-text-muted);
    font-size: var(--fs-small);
}
@media (max-width: 575.98px) {
    .bb-cart-item { gap: var(--space-3); padding: var(--space-3); }
    .bb-cart-item__image { width: 64px; height: 64px; }
}

/* Sticky order summary — shared by cart + checkout, replacing the
   inline style="position:sticky; top:..." each page used to hardcode. */
.bb-order-summary {
    position: sticky;
    top: calc(var(--space-4) + 128px);
}

/* Free-shipping progress bar (cart page) */
.bb-shipping-progress {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface-soft);
}
.bb-shipping-progress__label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-small);
    font-weight: 600;
    margin-bottom: var(--space-2);
}
.bb-shipping-progress__label i { color: var(--color-success); }
.bb-shipping-progress__track {
    height: 8px;
    border-radius: var(--radius-pill);
    background-color: var(--color-border);
    overflow: hidden;
}
.bb-shipping-progress__fill {
    height: 100%;
    width: calc(var(--bb-progress-percent, 0) * 1%);
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-dark));
    border-radius: var(--radius-pill);
    transition: width var(--motion-slow) var(--motion-ease);
}
@media (prefers-reduced-motion: reduce) {
    .bb-shipping-progress__fill { transition: none; }
}

/* Checkout step indicator (presentational only — the form itself stays a
   single page/POST, see docs/design-system.md and the redesign plan). */
.bb-checkout-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    list-style: none;
    padding: 0;
    margin-bottom: var(--space-4);
}
.bb-checkout-steps__step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--fs-small);
    font-weight: 600;
}
.bb-checkout-steps__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    font-size: var(--fs-caption);
    color: var(--color-text);
}

/* Checkout trust badges */
.bb-trust-badges {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
    font-size: var(--fs-caption);
    color: var(--color-text-muted);
}
.bb-trust-badges span {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.bb-trust-badges i { color: var(--color-success); width: 16px; text-align: center; }

/* Circular progress ring (loyalty tier progress, account dashboard) */
.bb-progress-ring {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
}
.bb-progress-ring--sm { width: 64px; height: 64px; }
.bb-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.bb-progress-ring__track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.25);
    stroke-width: 8;
}
.bb-progress-ring--on-light .bb-progress-ring__track { stroke: var(--color-border); }
.bb-progress-ring__fill {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: calc(283 - (283 * var(--bb-progress, 0)) / 100);
    transition: stroke-dashoffset var(--motion-slow) var(--motion-ease);
}
.bb-progress-ring__label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--fs-small);
}
.bb-progress-ring--sm .bb-progress-ring__label { font-size: var(--fs-caption); }
@media (prefers-reduced-motion: reduce) {
    .bb-progress-ring__fill { transition: none; }
}

/* Tier badge image (loyalty_tiers.badge_image, falls back to an icon) */
.bb-membership-card__tier-badge {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* Reward catalog card (loyalty page) */
.bb-reward-card {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    transition: border-color var(--motion-fast) var(--motion-ease);
}
.bb-reward-card:last-child { margin-bottom: 0; }
.bb-reward-card.is-redeemable { border-color: var(--color-accent); }
.bb-reward-card.is-locked { opacity: 0.6; }
.bb-reward-card__points {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 700;
    font-size: var(--fs-small);
    color: var(--color-accent-dark);
}
.bb-reward-card__name {
    font-weight: 600;
    margin-top: var(--space-1);
}
.bb-reward-card__desc {
    color: var(--color-text-muted);
    font-size: var(--fs-caption);
    margin: var(--space-1) 0 0;
}

/* Saved address card (account dashboard, display-only) */
.bb-address-card {
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    font-size: var(--fs-small);
}
.bb-address-card:last-child { margin-bottom: 0; }
.bb-address-card__label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-weight: 700;
    margin-bottom: var(--space-1);
}

/* Order timeline — checkout confirmation page + account dashboard's
   most-recent-order widget, same OrderRepository::historyFor() data. */
.bb-order-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface-soft);
}
.bb-order-timeline__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--fs-small);
}
.bb-order-timeline__item i {
    width: 20px;
    text-align: center;
    color: var(--color-primary);
}

/* Cart promo/loyalty preview widgets */
.bb-cart-widget {
    margin-bottom: var(--space-3);
}
.bb-cart-widget__row {
    display: flex;
    gap: var(--space-2);
}
.bb-cart-widget__row input { flex: 1 1 auto; }
.bb-cart-widget__result {
    margin-top: var(--space-2);
    font-size: var(--fs-small);
    display: none;
}
.bb-cart-widget__result.is-visible { display: block; }
.bb-cart-widget__result--success { color: var(--color-success); }
.bb-cart-widget__result--error { color: var(--color-danger); }

/* Password field with visibility toggle */
.bb-password-field {
    position: relative;
}
.bb-password-field input {
    padding-inline-end: 2.75rem;
}
.bb-password-field button {
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    width: 2.75rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
}
.bb-password-field button:hover { color: var(--color-primary); }

/* OTP code input */
.bb-otp-input {
    letter-spacing: 0.5em;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
}
.bb-otp-resend {
    background: none;
    border: none;
    color: var(--color-primary);
    font-weight: 600;
    font-size: var(--fs-small);
    padding: 0;
}
.bb-otp-resend:disabled {
    color: var(--color-text-muted);
    cursor: not-allowed;
}

/* Auth pages */
.bb-auth-card {
    max-width: 440px;
    margin-inline: auto;
}
.bb-auth-card--narrow { max-width: 380px; }
.bb-auth-icon {
    width: 64px;
    height: 64px;
    margin-inline: auto;
    margin-bottom: var(--space-3);
    border-radius: 50%;
    background-color: var(--color-surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--color-primary);
}
.bb-auth-tabs {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 4px;
    margin-bottom: var(--space-4);
}
.bb-auth-tabs__tab {
    flex: 1 1 0;
    border: none;
    background: transparent;
    border-radius: var(--radius-pill);
    padding-block: var(--space-2);
    font-size: var(--fs-small);
    font-weight: 600;
    color: var(--color-text-muted);
    transition: background-color var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease);
}
.bb-auth-tabs__tab.is-active {
    background-color: var(--color-primary);
    color: #fff;
}
@media (prefers-reduced-motion: reduce) {
    .bb-auth-tabs__tab { transition: none; }
}

/* Quick-view modal */
.bb-quick-view {
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}
.bb-quick-view__close {
    position: absolute;
    top: var(--space-3);
    inset-inline-end: var(--space-3);
    z-index: 2;
}

/* Added-to-cart modal */
.bb-added-to-cart {
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

/* Toasts (Bootstrap .toast structural base + brand color) */
.bb-toast-container { z-index: 1080; }
.bb-toast {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.bb-toast--success { border-inline-start: 4px solid var(--color-success); }
.bb-toast--danger { border-inline-start: 4px solid var(--color-danger); }

/* Mobile touch-target pass — these are fine as compact desktop hover
   targets (mouse pointers are precise), but too small a tap area on
   touch. Bumped toward the ~44px recommendation only ≤991.98px. */
@media (max-width: 991.98px) {
    .bb-product-card__wishlist,
    .bb-product-card__add-to-cart,
    .bb-product-card__quick-view {
        width: 40px;
        height: 40px;
        font-size: 1.05rem;
    }
    .bb-view-toggle__btn {
        width: 44px;
        height: 44px;
    }
    .bb-qty-stepper--sm {
        height: 40px;
    }
    .bb-qty-stepper--sm button {
        width: 40px;
    }
}
