html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* ====== عناصر الأقسام العامة ====== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}
.section-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #2e7d32;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* ====== كروت المنتجات ====== */

.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;
    /* إخفاء الوصف الكامل وإظهار سطرين فقط */
    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.95rem;
    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;
}

/* ====== الفلتر (ترتيب المنتجات) ====== */

.product-filter-label-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
}

.product-filter-label {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2e7d32;
    cursor: pointer;
    white-space: nowrap;
}
.product-filter-label i {
    font-size: 0.65rem;
    transition: transform 0.18s ease;
}
.product-filter-label.open i {
    transform: rotate(180deg);
}

.product-filter-menu {
    position: absolute;
    top: 140%;
    right: 0;
    min-width: 150px;
    max-width: 200px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
    padding: 6px 0;
    z-index: 1000;
    display: none;
    overflow: hidden;
}
.product-filter-menu.show {
    display: block;
}

.product-filter-option {
    width: 100%;
    text-align: right;
    padding: 6px 10px;
    background: transparent;
    border: none;
    font-size: 0.8rem;
    color: #444;
    cursor: pointer;
    display: block;
    transition: background-color 0.15s ease, color 0.15s ease;
    white-space: normal;
}
.product-filter-option:hover {
    background-color: #f3f7f3;
    color: #2e7d32;
}
.product-filter-option.active {
    background-color: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
}

/* ====== حركة الطيران للسلة + توست السلة ====== */

.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: translateY(0);
}

#cartCount.shake-cart-count {
    animation: cart-bump 0.3s ease;
}
@keyframes cart-bump {
    0%   { transform: translate(0, 0) scale(1); }
    30%  { transform: translate(0, -1px) scale(1.2); }
    100% { transform: translate(0, 0) scale(1); }
}

/* ====== زر الصعود للأعلى ====== */

#scrollTopBtn {
    position: fixed;
    bottom: 32px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: #2e7d32;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.22);
    z-index: 99999;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#scrollTopBtn i {
    font-size: 0.85rem;
    pointer-events: none;
}
#scrollTopBtn.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ====== منطق الفوتر (نفس صفحة الحساب) ====== */

/* الوضع الافتراضي (ديسكتوب / تابلت): الفوتر ثابت في أسفل الشاشة ويظهر دائماً */
footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 10;
}

/* على الشاشات الأكبر: نزيد padding أسفل الـ main حتى لا يغطي الفوتر المحتوى */
@media (min-width: 577px) {
    .shop-main {
        padding-bottom: 140px;
    }
}

/* على الهاتف: تعديلات خاصة */
@media (max-width: 576px) {
    /* إخفاء الفوتر تماماً */
    footer {
        display: none !important;
    }

    .product-filter-menu {
        right: 0;
        max-width: 80vw;
    }
    #scrollTopBtn {
        bottom: 80px; /* فوق الهيدر السفلي في الهاتف */
        right: 12px;
    }
}
