/* ============================================
   Product Card
   ============================================ */

.product-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    position: relative;
    text-decoration: none;
    color: inherit;
}

.product-card:active {
    background: var(--color-bg-glass);
}

.product-card + .product-card {
    border-top: 1px solid var(--color-border);
}

/* Product Image */
.product-card__image {
    flex-shrink: 0;
    width: 76px;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    /* background: var(--color-bg-glass); */
}

.product-card__image img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform var(--transition-slow);
}

.product-card:active .product-card__image img {
transform: scale(1.05);
}

.product-card__image--placeholder {
display: flex;
align-items: center;
justify-content: center;
color: var(--color-text-muted);
}

/* Product Info */
.product-card__info {
    flex: 1;
    min-width: 0;
}

/* Head row: left main block (badges + name) | right price block.
   align-items:flex-start so the price stays flush at the top of the
   row even when badges + a wrapping name push the left side taller. */
.product-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 2px;
}

/* Inner wrapper for the left column — stacks badges above the name.
   flex:1 + min-width:0 lets long product names wrap inside the row
   instead of pushing the price off-screen. */
.product-card__head-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-card__name {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: 0;
    line-height: 1.3;
    min-width: 0;
}

/* Badges inside head-main — drop the legacy bottom margin so the
   parent's flex `gap` is the single source of vertical rhythm. */
.product-card__head-main .product-card__badges {
    margin-bottom: 0;
}

.product-card__description {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

/* Badges */
.product-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--space-xs);
}

.product-badge {
    display: inline-flex;
    gap: 8px;
    padding: 4px 6px 4px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    /* text-transform: uppercase; */
    /* letter-spacing: 0.03em; */
    line-height: 10px;
    backdrop-filter: var(--card-glass-blur, var(--blur-md));
}

.product-badge--new {
    background: var(--color-success);
    color: #ffffff;
}

.product-badge--popular {
    background: var(--color-warning);;
    color: #fff;
}

.product-badge--chef {
    color: #fff;
    background: var(--color-primary);
}

/* Allergens */
.product-card__allergens {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.allergen-icon {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    opacity: 0.6;
}

.allergen-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Price column inside the head row.
   Lives inline with the name now (instead of as a third column on
   the outer flex). The description below uses the FULL info width,
   no longer squeezed under a price-shaped gap. */
.product-card__price {
    flex-shrink: 0;
    text-align: right;
    min-width: 60px;
}

.product-card__price-value {
    font-size: var(--text-base);
    font-weight: 700;
    /* Dark theme: lift the brand color toward white so price reads
       cleanly on a black bg even when the brand primary is a low-
       contrast tone (deep brown, navy, etc.). Light theme overrides
       below restore the pure brand color. */
    color: color-mix(in srgb, var(--color-primary) 40%, #fff);
    white-space: nowrap;
}

.product-card__variants {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-end;
}

.product-card__variant {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: var(--text-xs);
}

.product-card__variant-label {
    color: var(--color-text-muted);
}

.product-card__variant-price {
    font-weight: 600;
    color: color-mix(in srgb, var(--color-primary) 40%, #fff);
}

/* ============================================
   Product List Section
   ============================================ */

.product-section {
    margin-bottom: var(--space-lg);
}

.product-section__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    padding: var(--space-md) var(--space-md) var(--space-sm);
    color: var(--color-primary-light);
    position: sticky;
    top: 44px; /* Below category-tabs */
    background: var(--color-bg);
    z-index: 5;
}

.product-list {
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--color-bg);
}

/* ============================================
   Product Grid (alternative listing style)
   2 columns on mobile, 3 columns ≥767px.
   Used when category.listing_style = 'grid'.
   ============================================ */

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: var(--space-md);
    position: relative;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin-left: var(--space-md);
    margin-right: var(--space-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0) 100%);
    z-index: 2;
}
body:not(.theme-light) .category-sections .product-grid {
    box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.15);
    background: linear-gradient(180deg,rgba(40, 40, 40, 1) 0%, rgba(40, 40, 40, 0) 100%);

}
@media (min-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
}

.product-card-grid {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.product-card-grid:active {
    transform: scale(0.98);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    border-color: var(--color-border-light);
}

.product-card-grid__image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* JS clamps to natural ratio within [4/5 .. 5/4] */
    overflow: hidden;
    background: var(--color-bg-glass);
}

.product-card-grid__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card-grid:active .product-card-grid__image img {
    transform: scale(1.05);
}

.product-card-grid__image--placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    background:
        linear-gradient(135deg,
            color-mix(in srgb, var(--color-primary) 14%, transparent) 0%,
            color-mix(in srgb, var(--color-secondary, var(--color-primary)) 8%, transparent) 100%);
}

.product-card-grid__badges {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    pointer-events: none;
}

.product-card-grid__info {
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 1;
}

.product-card-grid__name {
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    /* Two-line clamp keeps card heights even across the grid row. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-grid__price {
    margin-top: auto;
}

.product-card-grid__price-value {
    font-size: var(--text-base);
    font-weight: 700;
    color: color-mix(in srgb, var(--color-primary) 40%, #fff);
    white-space: nowrap;
}

/* Light theme: restore pure brand primary for prices — black-on-white
   already reads fine and we want maximum brand presence. */
body.theme-light .product-card__price-value,
body.theme-light .product-card__variant-price,
body.theme-light .product-card-grid__price-value {
    color: var(--color-primary);
}

/* ============================================
   Similar Products (Horizontal Scroll)
   ============================================ */

.similar-products {
    padding: var(--space-lg) 0;
}

.similar-products__title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    padding: 0 var(--space-md) var(--space-md);
}

.similar-products__scroll {
    display: flex;
    gap: var(--space-md);
    padding: 0 var(--space-md);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.similar-products__scroll::-webkit-scrollbar {
    display: none;
}

.similar-card {
    flex-shrink: 0;
    width: 140px;
    scroll-snap-align: start;
    text-decoration: none;
    color: inherit;
}

.similar-card__image {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg-glass);
    margin-bottom: var(--space-sm);
}

.similar-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.similar-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;
}

.similar-card__price {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 2px;
}
