/* ============================================================
   PRODUCT CARDS — PROFESSIONAL POLISH 2026
   Layered on top of modern-2026.css. Upgrades:
   - Grid card hover lift + image zoom
   - Lazy-load fade-in (with optional CSS-only blur-up)
   - Sleeker discount / calorie badges
   - Add-to-cart button with rotate animation
   - Refined list view (horizontal restaurant-menu style)
   - Skeleton loader pulse
   ============================================================ */


/* ----------------------------------------------------------------
   1. GRID CARD — base polish (hover lift, image zoom, shadow)
   ---------------------------------------------------------------- */
.wsus__menu_item {
    background: var(--m-surface, #fff);
    border: 1px solid var(--m-line, rgba(0,0,0,.06));
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform .35s var(--m-ease, cubic-bezier(.2,.7,.2,1)),
                box-shadow .35s var(--m-ease, cubic-bezier(.2,.7,.2,1)),
                border-color .25s ease;
    will-change: transform;
    position: relative;
}
.wsus__menu_item:hover {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--m-brand, #b8541a) 35%, transparent);
    box-shadow:
        0 16px 32px -16px rgba(var(--theme-brand-rgb, 184,84,26), .30),
        0 8px 16px -8px rgba(0,0,0,.10);
}

/* Image area — square, with zoom-on-hover */
.wsus__menu_item_img {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--m-bg-2, #f7f3ea), var(--m-bg, #ece7da));
    border-radius: 18px 18px 0 0;
}
.wsus__menu_item_img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .55s var(--m-ease, cubic-bezier(.2,.7,.2,1)),
                opacity .35s ease;
}
.wsus__menu_item:hover .wsus__menu_item_img img { transform: scale(1.06); }

/* Subtle dark overlay on hover for legibility of badges */
.wsus__menu_item_img::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.30));
    opacity: 0;
    transition: opacity .35s ease;
    pointer-events: none;
}
.wsus__menu_item:hover .wsus__menu_item_img::after { opacity: 1; }


/* ----------------------------------------------------------------
   2. BADGES — discount / calorie / category — sleeker capsules
   ---------------------------------------------------------------- */
.wsus__menu_item_img .discount_badge {
    position: absolute;
    top: 10px; inset-inline-start: 10px;
    background: linear-gradient(135deg, #c63838, #8a1f1f);
    color: #fff;
    font-size: 11.5px; font-weight: 800;
    padding: 5px 11px;
    border-radius: 999px;
    z-index: 3;
    box-shadow: 0 6px 12px -4px rgba(198,56,56,.45);
    font-family: ui-monospace, monospace;
    letter-spacing: .02em;
}

.wsus__menu_item_img .calorie-badge {
    position: absolute;
    bottom: 10px; inset-inline-end: 10px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
    color: var(--m-text, #2a1f17);
    font-size: 11px; font-weight: 800;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    z-index: 3;
    display: inline-flex; align-items: center; gap: 5px;
    box-shadow: 0 4px 10px -2px rgba(0,0,0,.20);
}
.wsus__menu_item_img .calorie-badge i {
    color: #ff5722; font-size: 10px;
}

/* Category chip — bottom-left, fades in from hover overlay */
.wsus__menu_item_img > a.category,
.wsus__menu_item_img .category {
    position: absolute;
    bottom: 10px; inset-inline-start: 10px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(8px);
    color: var(--m-brand, #b8541a);
    font-size: 11px; font-weight: 800;
    padding: 4px 12px;
    border-radius: 999px;
    z-index: 3;
    text-decoration: none !important;
    transition: all .2s ease;
    box-shadow: 0 4px 10px -2px rgba(0,0,0,.15);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.wsus__menu_item_img > a.category:hover {
    background: var(--m-brand, #b8541a);
    color: #fff;
}

/* Wishlist heart — top-right, fills on hover */
.wsus__menu_item_img .wishlist_overlay {
    position: absolute;
    top: 10px; inset-inline-end: 10px;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(8px);
    color: #c63838;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px;
    z-index: 3;
    text-decoration: none !important;
    transition: all .25s ease;
    box-shadow: 0 4px 10px -2px rgba(0,0,0,.20);
    transform: scale(0);
    opacity: 0;
}
.wsus__menu_item:hover .wishlist_overlay {
    transform: scale(1); opacity: 1;
}
.wsus__menu_item .wishlist_overlay:hover {
    background: #c63838;
    color: #fff;
    transform: scale(1.08);
}


/* ----------------------------------------------------------------
   3. CARD TEXT BODY — refined typography + spacing
   ---------------------------------------------------------------- */
.wsus__menu_item_text {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
}

.wsus__menu_item_text .rating {
    margin: 0;
    color: #f5b50a;
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.wsus__menu_item_text .rating .far,
.wsus__menu_item_text .rating .fas { font-size: 12px; }
.wsus__menu_item_text .rating span {
    color: var(--m-text-mute, #8C7A66);
    margin-inline-start: 4px;
    font-size: 11.5px;
    font-weight: 600;
}

.wsus__menu_item_text .title {
    font-weight: 800;
    font-size: 15px;
    line-height: 1.35;
    color: var(--m-text, #2a1f17);
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    transition: color .2s;
    min-height: 2.7em;
}
.wsus__menu_item_text .title:hover {
    color: var(--m-brand, #b8541a);
}

/* Allergen indicator pill */
.m-allergen-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(245, 158, 11, .12);
    color: #b45309;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    width: max-content;
    margin: 2px 0;
}
.m-allergen-indicator i { font-size: 10px; }


/* ----------------------------------------------------------------
   4. CARD FOOTER — price + add-to-cart button
   ---------------------------------------------------------------- */
.wsus__menu_card_footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed var(--m-line, rgba(0,0,0,.08));
}

.wsus__menu_card_footer .price {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--m-brand, #b8541a);
    line-height: 1;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-family: ui-monospace, "SF Mono", monospace;
    letter-spacing: -.01em;
    flex: 1 1 auto;
    min-width: 0;
}
.wsus__menu_card_footer .price img.Saudi_Riyal {
    width: 14px !important;
    height: auto !important;
    margin-inline-start: 2px;
}
.wsus__menu_card_footer .price del {
    color: var(--m-text-mute, #8C7A66);
    font-size: 12px;
    font-weight: 500;
    opacity: .7;
    margin-inline-start: 6px;
}
.wsus__menu_card_footer .price del img.Saudi_Riyal { width: 9px !important; }

/* Add-to-cart — large round terra brand button with rotating icon */
.wsus__add_btn {
    flex-shrink: 0;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--m-brand, #b8541a), var(--m-brand-dark, #8B3F12));
    color: #fff;
    border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 900;
    cursor: pointer;
    transition: all .25s var(--m-ease, cubic-bezier(.2,.7,.2,1));
    box-shadow: 0 8px 16px -4px rgba(var(--theme-brand-rgb, 184,84,26), .40);
    position: relative;
    overflow: hidden;
}
.wsus__add_btn::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, var(--m-brand-dark, #8B3F12), var(--m-brand, #b8541a));
    opacity: 0;
    transition: opacity .25s ease;
}
.wsus__add_btn i { position: relative; z-index: 1; transition: transform .35s var(--m-ease); }
.wsus__add_btn:hover {
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 12px 22px -4px rgba(var(--theme-brand-rgb, 184,84,26), .55);
}
.wsus__add_btn:hover::before { opacity: 1; }
.wsus__add_btn:active { transform: scale(.95) rotate(90deg); }


/* ----------------------------------------------------------------
   5. LAZY LOADING — blur-up reveal when image actually loads
   Works alongside browser-native `loading="lazy"` attribute. The
   image starts hidden + blurred; small JS adds .is-loaded on the
   image's `load` event to trigger the smooth reveal.
   ---------------------------------------------------------------- */
.wsus__menu_item_img img {
    opacity: 0;
    transform: scale(1.04);
    filter: blur(6px);
    transition:
        opacity .45s var(--m-ease, cubic-bezier(.2,.7,.2,1)),
        transform .55s var(--m-ease, cubic-bezier(.2,.7,.2,1)),
        filter .45s var(--m-ease, cubic-bezier(.2,.7,.2,1));
}
.wsus__menu_item_img img.is-loaded {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}
/* Honour the hover zoom even after load */
.wsus__menu_item:hover .wsus__menu_item_img img.is-loaded { transform: scale(1.06); }

/* Fallback for browsers without JS — show after a fixed delay */
@media (prefers-reduced-motion: reduce) {
    .wsus__menu_item_img img { transition: none; opacity: 1; transform: none; filter: none; }
}


/* ----------------------------------------------------------------
   6. LIST VIEW — horizontal restaurant-menu style (refined)
   ---------------------------------------------------------------- */
.m-view-list .wsus__menu_item {
    flex-direction: row !important;
    min-height: 140px;
    border-radius: 16px;
}
.m-view-list .wsus__menu_item:hover {
    transform: translateX(-3px);
}
[dir="rtl"] .m-view-list .wsus__menu_item:hover { transform: translateX(3px); }

.m-view-list .wsus__menu_item_img {
    flex: 0 0 140px !important;
    width: 140px !important;
    height: 140px !important;
    aspect-ratio: 1/1 !important;
    border-radius: 16px 0 0 16px !important;
}
[dir="rtl"] .m-view-list .wsus__menu_item_img {
    border-radius: 0 16px 16px 0 !important;
}

.m-view-list .wsus__menu_item_text {
    padding: 12px 16px !important;
}
.m-view-list .wsus__menu_item_text .title {
    font-size: 14.5px !important;
    min-height: 0 !important;
    -webkit-line-clamp: 2;
}

.m-view-list .wsus__add_btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 13px;
}

/* Hide wishlist on list view (image is small) */
.m-view-list .wishlist_overlay { display: none !important; }


/* ----------------------------------------------------------------
   7. SKELETON LOADER — pulse while products load
   ---------------------------------------------------------------- */
.m-prod-skel {
    background: var(--m-surface, #fff);
    border: 1px solid var(--m-line, rgba(0,0,0,.06));
    border-radius: 18px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.m-prod-skel__img {
    aspect-ratio: 1 / 1;
    background: linear-gradient(
        90deg,
        var(--m-bg-2, #f7f3ea) 0%,
        var(--m-bg, #ece7da) 50%,
        var(--m-bg-2, #f7f3ea) 100%
    );
    background-size: 200% 100%;
    animation: m-skel-shimmer 1.4s linear infinite;
}
.m-prod-skel__body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.m-prod-skel__line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--m-bg-2, #f7f3ea) 0%,
        var(--m-bg, #ece7da) 50%,
        var(--m-bg-2, #f7f3ea) 100%
    );
    background-size: 200% 100%;
    animation: m-skel-shimmer 1.4s linear infinite;
}
.m-prod-skel__line.is-short { width: 60%; }
.m-prod-skel__line.is-tall  { height: 18px; }
@keyframes m-skel-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ----------------------------------------------------------------
   8. EMPTY STATE — when products list is empty
   ---------------------------------------------------------------- */
.m-empty-state {
    background: var(--m-surface, #fff);
    border: 2px dashed var(--m-line, rgba(0,0,0,.10));
    border-radius: 18px;
    padding: 50px 20px;
    text-align: center;
    color: var(--m-text-mute, #8C7A66);
}
.m-empty-state i {
    font-size: 56px;
    color: var(--m-line-strong, #d6c9b5);
    margin-bottom: 14px;
    display: block;
    opacity: .7;
}
.m-empty-state h3 {
    font-weight: 800;
    color: var(--m-text, #2a1f17);
    margin: 0 0 6px;
    font-size: 18px;
}
.m-empty-state p { margin: 0; font-size: 14px; }


/* ----------------------------------------------------------------
   9. RESPONSIVE — tighten paddings on phones
   ---------------------------------------------------------------- */
@media (max-width: 575.98px) {
    .wsus__menu_item { border-radius: 14px; }
    .wsus__menu_item_img { border-radius: 14px 14px 0 0; }
    .wsus__menu_item_text { padding: 10px 12px; gap: 4px; }
    .wsus__menu_item_text .title { font-size: 13px; min-height: 2.6em; }
    .wsus__menu_card_footer .price { font-size: 15px; }
    .wsus__add_btn { width: 36px; height: 36px; font-size: 12px; }
    .wsus__menu_item_img .discount_badge { font-size: 10px; padding: 3px 8px; }
    .wsus__menu_item_img .calorie-badge { font-size: 10px; padding: 3px 8px 3px 6px; }
    .wsus__menu_item_img .category { font-size: 10px; padding: 3px 9px; }

    /* List view on mobile — single column */
    .m-view-list .wsus__menu_item_img { flex-basis: 110px !important; width: 110px !important; height: 110px !important; }
    .m-view-list .wsus__menu_item { min-height: 110px; }
}
