/* Category page header */
.category-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px 4px;
    max-width: 920px;
    margin: 0 auto;
}

@media (min-width: 920px) {
    .category-page-header {
        padding: 16px 24px 4px;
    }
}

.category-page-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-primary, #332F2A);
    flex-shrink: 0;
}

.category-page-header__title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: var(--color-primary, #332F2A);
}

/* Sticky header wrapper */
.category-sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--color-bg, #f5f0eb);
}

/* Subcategory tabs bar */
.category-tabs {
    padding: 8px 0 0;
}

.category-tabs__inner {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 920px;
    margin: 0 auto;
    padding: 0 16px 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-tabs__inner::-webkit-scrollbar {
    display: none;
}

.category-tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: #fff;
    color: var(--color-secondary, #8C857C);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    text-decoration: none;
}

.category-tab--active,
.category-tab:active {
    background: var(--color-secondary, #8C857C);
    color: #fff;
}

/* Section / subsection headings — unified style */
.category-section,
.category-subsection {
    max-width: 920px;
    margin: 0 auto;
    padding: 12px 16px 4px;
}

.category-section__title,
.category-section__subtitle {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary, #332F2A);
    margin: 0;
    line-height: 1.2;
}

@media (min-width: 920px) {
    .category-section,
    .category-subsection {
        padding: 16px 24px 4px;
    }
}

/* Products grid */
.category-products {
    padding: 0 16px 16px;
    max-width: 920px;
    margin: 0 auto;
}

.category-products__grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Product card */
.bakery-product-card {
    background: #fff;
    border-radius: var(--radius, 20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bakery-product-card--inactive {
    opacity: 0.5;
    pointer-events: none;
}

.bakery-product-card__image-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 209 / 178;
    overflow: hidden;
    padding: 7px 7px 0;
}

.bakery-product-card__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* Badges */
.bakery-product-card__badges {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 1;
}

.bakery-product-card__badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    width: fit-content;
}

.bakery-product-card__badge--sale {
    background: var(--color-red, #FF2A2A);
}

.bakery-product-card__badge--new {
    background: #fff;
    color: var(--primary-color, #F5A623);
}

/* Card body */
.bakery-product-card__link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

.bakery-product-card__body {
    padding: 7px 7px 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bakery-product-card__footer {
    padding: 0 7px 7px;
}

@media screen and (min-width: 375px) {
    .bakery-product-card__image-wrap {
        padding: 12px 12px 0;
    }
    .bakery-product-card__body {
        padding: 10px 12px 0;
    }
    .bakery-product-card__footer {
        padding: 0 12px 12px;
    }
}

.bakery-product-card__name {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary, #332F2A);
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.bakery-product-card__allergens {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.bakery-product-card__allergen-tag {
    font-size: 10px;
    color: #92400e;
    background: #fef3c7;
    border-radius: 50px;
    padding: 1px 7px;
    line-height: 1.6;
}

.bakery-product-card__recommended-star {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bakery-product-card--recommended .bakery-product-card__badges {
    max-width: calc(100% - 62px);
}

.bakery-product-card__prices {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
    margin-top: auto;
}

.bakery-product-card__price {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary, #332F2A);
}

.bakery-product-card__old-price {
    font-size: 10px;
    color: #999;
    text-decoration: line-through;
}

@media screen and (min-width: 375px) {
    .bakery-product-card__price {
        font-size: 14px;
    }
    .bakery-product-card__old-price {
        font-size: 11px;
    }
}

@media screen and (min-width: 560px) {
    .bakery-product-card__price {
        font-size: 18px;
    }
    .bakery-product-card__old-price {
        font-size: 13px;
    }
}

.bakery-product-card__add-btn {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 12px;
    background: var(--primary-color, #F5A623);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.bakery-product-card__add-btn:active {
    opacity: 0.8;
}

.bakery-product-card__add-qty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    font-weight: 700;
    margin-left: 4px;
    vertical-align: middle;
}

/* Out of stock label */
.bakery-product-card__out-of-stock {
    display: none;
}

.bakery-product-card--inactive .bakery-product-card__out-of-stock {
    display: block;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #999;
    padding: 10px 0;
}

.bakery-product-card--inactive .bakery-product-card__add-btn {
    display: none;
}

/* ── List layout ── */
.category-products__grid--list {
    grid-template-columns: 1fr;
    grid-auto-rows: 160px;
    gap: 10px;
}

.bakery-product-card--list {
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    height: 160px;
}

.bakery-product-card--list .bakery-product-card__image-link {
    flex: 0 0 160px;
    align-self: stretch;
    display: flex;
    text-decoration: none;
}

.bakery-product-card--list .bakery-product-card__image-wrap {
    width: 100%;
    height: 100%;
    aspect-ratio: auto;
    padding: 0;
}

.bakery-product-card--list .bakery-product-card__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

.bakery-product-card__right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    min-width: 0;
    overflow: hidden;
}

.bakery-product-card__info-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    min-height: 0;
}

.bakery-product-card--list .bakery-product-card__name {
    font-size: 13px;
    margin-bottom: 2px;
    -webkit-line-clamp: 2;
}


.bakery-product-card--list .bakery-product-card__prices {
    margin-top: auto;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.bakery-product-card--list .bakery-product-card__footer {
    padding: 0;
}

.bakery-product-card--list .bakery-product-card__add-btn {
    font-size: 13px;
    padding: 7px 10px;
    flex-shrink: 0;
}

/* Empty state */
.category-empty {
    text-align: center;
    padding: 40px 16px;
    color: #999;
    font-size: 16px;
    max-width: 920px;
    margin: 0 auto;
}

/* Responsive */
@media screen and (min-width: 560px) {
    .category-products__grid:not(.category-products__grid--list) {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (min-width: 375px) {
    .bakery-product-card__name {
        font-size: 14px;
    }
}

@media screen and (min-width: 920px) {
    .category-products__grid:not(.category-products__grid--list) {
        grid-template-columns: repeat(4, 1fr);
    }
    .category-products__grid--list {
        grid-template-columns: repeat(2, 1fr);
    }
    .category-page-header {
        padding: 24px;
    }
    .category-products {
        padding: 0 24px 24px;
    }
}
