/* Main Container */
.products-main {
    max-width: 75rem; /* 1200px */
    margin: 0 auto;
    padding: 0 1.25rem; /* 20px */
}

/* Breadcrumb Styles */
.breadcrumb {
    padding-top: 3.125rem; /* 50px */
    margin-bottom: 1.875rem; /* 30px */
    color: #666;
}

.breadcrumb a {
    color: #666;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #e31e24;
}

.breadcrumb .separator {
    margin: 0 10px;
    color: #666;
}

.breadcrumb .current-category {
    color: #e31e24;
}

/* Title Styles */
#productTitle {
    font-size: 2rem;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* Filters Section */
.filters-section {
    margin-bottom: 30px;
}

.filters-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sort-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Cairo', sans-serif;
}

.view-options {
    display: flex;
    gap: 8px;
}

.view-btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: #e31e24;
    color: white;
}

/* Products Grid Layout */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem; /* 20px */
    padding: 0.938rem; /* 15px */
    margin-bottom: 1.563rem; /* 25px */
}

/* Product Card Styles */
.product-item {
    aspect-ratio: 2/3;
    width: 100%;
    max-width: 15.625rem; /* 250px */
    margin: 0 auto;
}


.product-card {
    height: 100%;
    width: 100%;
    background: #ffffff;
    border-radius: 0.5rem; /* 8px */
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

/* Product Image Styles */
.product-image {
    position: relative;
    width: 100%;
    height: 60%; /* نسبة أقل للصورة */
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

/* Product Description Overlay */
.product-description {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(227, 30, 36, 0.95);
    color: #ffffff;
    padding: 20px;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transform: translateY(100%);
}

.product-card:hover .product-description {
    opacity: 1;
    transform: translateY(0);
}

/* Product Info Styles */
.product-info {
    padding: 15px;
    height: 35%; /* نسبة ثابتة من ارتفاع البطاقة */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #ffffff;
}

.product-name {
    font-size: 1.1rem;
    color: #333333;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    height: 3em; /* ارتفاع ثابت للعنوان */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: right;
}

.details-btn {
    padding: 8px 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    color: #e31e24;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}


.details-btn i {
    transition: transform 0.3s ease;
}

.product-card:hover .details-btn {
    color: #c41820;
}

.product-card:hover .details-btn i {
    transform: translateX(-5px);
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 30px 0;
}

.pagination-button {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e31e24;
    background: #ffffff;
    color: #e31e24;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.pagination-button:hover:not(.disabled) {
    background: #e31e24;
    color: #ffffff;
}

.pagination-button.active {
    background: #e31e24;
    color: #ffffff;
}

.pagination-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ccc;
    color: #ccc;
}

.pagination-button.disabled:hover {
    background: #ffffff;
    color: #ccc;
}

/* State Styles */
/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: #666666;
}

.loading i {
    font-size: 2rem;
    color: #e31e24;
    margin-bottom: 15px;
}

/* No Products State */
.no-products {
    text-align: center;
    padding: 40px;
    color: #666666;
}

.no-products i {
    font-size: 3rem;
    color: #e31e24;
    margin-bottom: 15px;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 40px;
    color: #666666;
}

.error-message i {
    font-size: 3rem;
    color: #e31e24;
    margin-bottom: 15px;
}

.error-message button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #e31e24;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.error-message button:hover {
    background: #c41820;
}

/* Responsive Design - Updated */
@media (max-width: 75rem) { /* 1200px */
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 62rem) { /* 992px */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .product-item {
        max-width: 100%;
        aspect-ratio: 2/2.8;
    }
}

@media (max-width: 48rem) { /* 768px */
    .products-grid {
        padding: 0.625rem;
    }
}

/* تحديث للشاشات الصغيرة لعرض منتجين في الصف */
@media (max-width: 36rem) { /* 576px */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem; /* 12px */
        padding: 0.5rem;
    }

    .product-item {
        aspect-ratio: 2/3;
        max-width: none;
    }

    .product-image {
        height: 55%;
    }

    .product-info {
        padding: 0.75rem;
        height: 45%;
    }

    .product-name {
        font-size: 0.875rem; /* 14px */
        height: 2.4em;
        margin-bottom: 0.5rem;
        -webkit-line-clamp: 2;
    }

    .details-btn {
        font-size: 0.813rem; /* 13px */
        padding: 0.375rem 0;
    }
}

/* تحسينات إضافية للشاشات الصغيرة جداً */
@media (max-width: 20rem) { /* 320px */
    .products-grid {
        gap: 0.5rem;
        padding: 0.375rem;
    }

    .product-item {
        aspect-ratio: 2/2.8;
    }

    .product-name {
        font-size: 0.75rem; /* 12px */
        -webkit-line-clamp: 2;
    }

    .details-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0;
    }

    .product-info {
        padding: 0.5rem;
    }
}