html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.page-hero {
    background: linear-gradient(135deg, #e8f5e9, #ffffff);
    border-radius: 18px;
    padding: 20px 24px;
    margin-top: 16px;
    margin-bottom: 18px;
}

.page-hero-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2e7d32;
    margin: 0;
    text-align: start;
}

.product-card {
    background-color: #ffffff;
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.18s ease-in-out;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.product-card-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
}

.product-media {
    width: 100%;
    margin-bottom: 4px;
}

.product-image {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
    aspect-ratio: 1 / 1;
    background-color: #f7f7f7;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #222;
}

.product-desc {
    font-size: 0.72rem;
    color: #888;
    /* نفس منطق صفحة index: إظهار سطرين فقط */
    display: -webkit-box;
    -webkit-line-clamp: 2;       /* عدد الأسطر المراد إظهارها */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.4em;           /* تقريباً سطرين حسب حجم الخط */
    line-height: 1.2em;
    word-wrap: break-word;
}

.product-price {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2e7d32;
}

.product-old-price {
    font-size: 0.7rem;
    color: #b0b0b0;
    text-decoration: line-through;
    margin-right: 4px;
}

.btn-add-to-cart {
    margin-top: auto;
    font-size: 0.78rem;
    border-radius: 999px;
    padding-block: 4px;
}

.flying-item {
    position: fixed;
    width: 42px;
    height: 42px;
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.cart-toast {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translate(-50%, 10px);
    background-color: #2e7d32;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    opacity: 0;
    z-index: 9999;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.cart-toast i {
    font-size: 0.85rem;
}

.cart-toast-show {
    opacity: 1;
    transform: translate(-50%, 0);
}

#cartCount.shake-cart-count {
    animation: cart-bump 0.3s ease;
}

@keyframes cart-bump {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* منطق الفوتر في صفحة القسم */

/* الوضع الافتراضي (ديسكتوب / تابلت): الفوتر ثابت في أسفل الشاشة ويظهر دائماً */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10;
}

/* على الشاشات الأكبر: padding أسفل الـ main حتى لا يغطي الفوتر المحتوى */
@media (min-width: 577px) {
    .category-main {
        padding-bottom: 140px;
    }
}

@media (max-width: 576px) {
    .page-hero {
        padding: 16px 14px;
        margin-top: 10px;
        margin-bottom: 14px;
    }

    .page-hero-title {
        font-size: 1.2rem;
    }

    /* في وضع الهاتف: إخفاء الفوتر تماماً في صفحة القسم */
    footer {
        display: none !important;
    }
}
