/* ============================================
   صفحة المنتجات - products.css
   امتداد لتنسيقات style.css
   ============================================ */

/* عنوان الصفحة */
.products-page {
    margin-top: 70px;
    padding: 3rem 0 5rem;
    background-color: var(--bg);
    min-height: calc(100vh - 70px);
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin: 0;
}

/* مربع البحث */
.search-bar {
    max-width: 600px;
    margin: 0 auto 2rem;
}

.search-bar input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background-color: var(--card-bg);
    color: var(--text);
    transition: var(--transition);
    font-family: inherit;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-bar input::placeholder {
    color: #a8a29e;
}

/* تخطيط الصفحة */
.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 90px;
}

.sidebar-toggle {
    display: none;
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-family: inherit;
}

.category-tree {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.tree-all {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg);
    border: 2px solid transparent;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    color: var(--text);
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

.tree-all:hover,
.tree-all.active {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

/* شجرة الأقسام */
.tree-item {
    margin-bottom: 0.25rem;
}

.tree-toggle {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.tree-toggle:hover {
    background-color: var(--bg);
}

.tree-toggle.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

.tree-arrow {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.tree-toggle.expanded .tree-arrow {
    transform: rotate(180deg);
}

.tree-children {
    display: none;
    padding-right: 1.5rem;
    margin-top: 0.25rem;
}

.tree-children.expanded {
    display: block;
}

.tree-child-btn {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.9375rem;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    color: var(--text-secondary);
    border-radius: 0.5rem;
    transition: var(--transition);
}

.tree-child-btn:hover {
    background-color: var(--bg);
    color: var(--text);
}

.tree-child-btn.active {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

/* عداد المنتجات */
.products-count {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

/* شبكة المنتجات في صفحة المنتجات */
.products-main .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.products-main .product-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.products-main .product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.products-main .product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: var(--bg);
}

.products-main .product-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.products-main .product-info h3 {
    font-size: 1.0625rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.products-main .product-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.products-main .product-price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    margin-top: auto;
}

.products-main .add-to-cart {
    width: 100%;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.625rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    font-family: inherit;
}

.products-main .add-to-cart:hover {
    background-color: var(--primary-dark);
}

/* لا توجد نتائج */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.no-results-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ============================================
   Responsive - صفحة المنتجات
   ============================================ */
@media (max-width: 768px) {
    .products-page {
        padding: 2rem 0 3rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .products-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .sidebar {
        position: static;
        order: -1;
    }

    .sidebar-toggle {
        display: flex;
    }

    .category-tree {
        display: none;
        padding: 1rem;
    }

    .category-tree.expanded {
        display: block;
    }

    .products-main .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .products-main .product-image {
        height: 140px;
    }

    .products-main .product-info {
        padding: 1rem;
    }

    .products-main .product-info h3 {
        font-size: 0.9375rem;
    }

    .products-main .product-price {
        font-size: 1rem;
    }

    .products-main .add-to-cart {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .products-main .products-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 240px 1fr;
    }

    .products-main .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
